On Fri, Mar 9, 2012 at 3:49 AM, <[email protected]> wrote: > Hello, > > I am using simple ODF API to create a Text document. > > How can i set the page orientation to landscape ? > > I checked the javadoc but did not find anything. >
Easiest way to debug issues like this is to create an ODF document with your word processor each way, and then compare the markup. When I do that I see that portrait documents have this in styles.xml: <style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in"> and landscape documents have this: <style:page-layout-properties fo:page-width="11in" fo:page-height="8.5in" style:num-format="1" style:print-orientation="landscape" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in"> That is for US 8.5"x11" paper. A4 would obviously have different dimensions. I don't think we have a Simple API that wraps this functionality. But I think it would be great if we had the ability to set page size, and have some pre-defined sizes to pick from, like common ISO, DIN, JISC and US sizes, envelopes, etc. And another function to specify orientation. An alternative approach would be to access this via the lower-level ODFDOM: http://odfdom.odftoolkit.org/0.8.7/odfdom/apidocs/org/odftoolkit/odfdom/dom/element/style/StylePageLayoutPropertiesElement.html Regards, -Rob > Thanks
