コード例 #1
0
ファイル: test.py プロジェクト: ssx86/soffice
from PyQt4.QtCore import QTextCodec

QTextCodec.setCodecForTr(QTextCodec.codecForName("UTF-8"))
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
QTextCodec.setCodecForLocale(QTextCodec.codecForName("UTF-8"))

office = OpenOffice('走你.odt')

# Insert some text
office.setListFormat(QTextListFormat.ListUpperAlpha)

office.insertImage("./123.png", 50, 200, QTextFrameFormat.FloatRight)

office.insertList()

office.insertText("中文\n")
office.insertText("two\n")
office.insertText("three\n")
office.insertText("\n")
office.insertText("\n")
office.insertText("\n")

office.reset()

#cursor.insertBlock()
#
#listFormat.clearProperty(QTextFormat.ListStyle)
#
#cursor.insertBlock()
#
#cursor.insertText("one")
コード例 #2
0
ファイル: MainWindow.py プロジェクト: ssx86/soffice
    def openDocument( self, bCheck):
        print "mainWindow openDocument..."
        
        office = OpenOffice("怎么回事儿.odt")

        # Insert some text
        office.setListFormat(QTextListFormat.ListUpperAlpha)

        office.insertImage("img/123.png", 50, 200, QTextFrameFormat.FloatRight)
        office.insertList()

        office.insertText("中文\n")
        office.insertText("two\n")
        office.insertText("three\n")
        office.insertText("\n")
        office.insertText("\n")
        office.insertText("\n")

        office.reset()

        #cursor.insertBlock()
        #
        #listFormat.clearProperty(QTextFormat.ListStyle)
        #
        #cursor.insertBlock()
        #
        #cursor.insertText("one")
        #cursor.insertText("\ntwo")
        #cursor.insertText("\nthree")


        office.setBlockBgColor(QColor(255, 0, 0))
        office.insertText("123")

        office.setBlockBgColor(QColor(255, 255, 0))
        office.insertText("456")

        office.setBlockBgColor(QColor(0, 255, 0))
        office.insertText("789\n101001 ")

        table = office.insertTable(10, 3)
        office.tableMergeCells(table, 2, 2, 4, 1)

        office.tableMoveToCell(table, 4, 1)

        office.insertText("asdfasdf")

        office.done()
コード例 #3
0
ファイル: MainWindow.py プロジェクト: ssx86/soffice
    def openDocument(self, bCheck):
        print "mainWindow openDocument..."

        office = OpenOffice("怎么回事儿.odt")

        # Insert some text
        office.setListFormat(QTextListFormat.ListUpperAlpha)

        office.insertImage("img/123.png", 50, 200, QTextFrameFormat.FloatRight)
        office.insertList()

        office.insertText("中文\n")
        office.insertText("two\n")
        office.insertText("three\n")
        office.insertText("\n")
        office.insertText("\n")
        office.insertText("\n")

        office.reset()

        #cursor.insertBlock()
        #
        #listFormat.clearProperty(QTextFormat.ListStyle)
        #
        #cursor.insertBlock()
        #
        #cursor.insertText("one")
        #cursor.insertText("\ntwo")
        #cursor.insertText("\nthree")

        office.setBlockBgColor(QColor(255, 0, 0))
        office.insertText("123")

        office.setBlockBgColor(QColor(255, 255, 0))
        office.insertText("456")

        office.setBlockBgColor(QColor(0, 255, 0))
        office.insertText("789\n101001 ")

        table = office.insertTable(10, 3)
        office.tableMergeCells(table, 2, 2, 4, 1)

        office.tableMoveToCell(table, 4, 1)

        office.insertText("asdfasdf")

        office.done()
コード例 #4
0
ファイル: test.py プロジェクト: ssx86/soffice
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"));
QTextCodec.setCodecForLocale(QTextCodec.codecForName("UTF-8"));

office = OpenOffice('走你.odt')

# Insert some text
office.setListFormat(QTextListFormat.ListUpperAlpha)

office.insertImage("./123.png", 50, 200, QTextFrameFormat.FloatRight)




office.insertList()

office.insertText("中文\n")
office.insertText("two\n")
office.insertText("three\n")
office.insertText("\n")
office.insertText("\n")
office.insertText("\n")

office.reset()

#cursor.insertBlock()
#
#listFormat.clearProperty(QTextFormat.ListStyle)
#
#cursor.insertBlock()
#
#cursor.insertText("one")