You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Would be very grateful if anyone could let me know why the below is not generating a landscape orientation document. Cannot find any working examples with odfpy.
Thanks a lot!
from odf.opendocument import OpenDocumentText
from odf.style import Style, ParagraphProperties, PageLayout, PageLayoutProperties, MasterPage
from odf.text import P, Page
textdoc = OpenDocumentText()
pageStyle = PageLayout(name="Standard")
pageStyle.addElement(PageLayoutProperties(printorientation="landscape"))
textdoc.automaticstyles.addElement(pageStyle)
mp = MasterPage(name="Standard", pagelayoutname=pageStyle)
textdoc.masterstyles.addElement(mp)
s = textdoc.stylesxml()
# Create a style for the paragraph with page-break
withbreak = Style(name="WithBreak", parentstylename="Standard", family="paragraph")
withbreak.addElement(ParagraphProperties(breakbefore="page"))
textdoc.automaticstyles.addElement(withbreak)
page = Page(masterpagename=mp)
p = P(text="Hello World!")
textdoc.text.addElement(p)
The text was updated successfully, but these errors were encountered:
If anyone else struggles like me, I suggest you use XML Notepad to figure out how tags exactly have to look. Here is a working example that spits out a Landscape page with headers / footers (page number), hyperlinks and custom formatting. Hope it helps others who use this library!
Hi! Would be very grateful if anyone could let me know why the below is not generating a landscape orientation document. Cannot find any working examples with odfpy.
Thanks a lot!
The text was updated successfully, but these errors were encountered: