1 from odf
.opendocument
import OpenDocumentText
3 from odf
.style
import Style
, MasterPage
, PageLayout
, PageLayoutProperties
, TextProperties
, GraphicProperties
, ParagraphProperties
, DrawingPageProperties
, BackgroundImage
4 from odf
.draw
import Page
, Frame
, TextBox
, Image
6 doc
= OpenDocumentText()
8 graphicStyleA
= Style(name
="graphicstyleA", family
="graphic")
9 gpA
= GraphicProperties(border
="1cm double #000000", padding
="1cm", backgroundcolor
="#cccccc")
10 graphicStyleA
.addElement(gpA
)
12 textStyleA
= Style(name
="textstyleA", family
="paragraph")
13 tpA
= TextProperties(fontsize
="16pt", fontfamily
="Limousine")
14 textStyleA
.addElement(tpA
)
15 ppA
= ParagraphProperties(textalign
="right")
16 textStyleA
.addElement(ppA
)
18 graphicStyleB
= Style(name
="graphicstyleB", family
="graphic")
19 gpB
= GraphicProperties(border
="1cm double #000000", padding
="1cm", backgroundcolor
="#ff0000")
20 graphicStyleB
.addElement(gpB
)
22 textStyleB
= Style(name
="textstyleB", family
="paragraph")
23 tpB
= TextProperties(fontsize
="16pt", fontfamily
="diluvienne")
24 textStyleB
.addElement(tpB
)
26 frameA
= Frame(stylename
=graphicStyleA
, height
="15cm", width
="10cm")
27 frameB
= Frame(stylename
=graphicStyleB
, height
="10cm", width
="15cm")
29 doc
.styles
.addElement(graphicStyleA
)
30 doc
.styles
.addElement(textStyleA
)
32 doc
.styles
.addElement(graphicStyleB
)
33 doc
.styles
.addElement(textStyleB
)
38 frameA
.addElement(textboxA
)
39 frameB
.addElement(textboxB
)
41 pA
= P(stylename
="textstyleA", text
="aaaaaah")
42 pB
= P(stylename
="textstyleB", text
="bbbbbah")
44 textboxA
.addElement(pA
)
45 textboxB
.addElement(pB
)
47 doc
.text
.addElement(frameA
)
48 doc
.text
.addElement(frameB
)