Andrew Douglas Pitonyak ha scritto:
Cristian Fonti wrote:
Hi to all,
i want to insert a page number in a Writer document with Java Api.
All is ok when the page number start from 1, but how can i do if i
want that the page number start from a variable value???
This is my code to insert a Page Number from 1:
Object
pn=mxDocFactory.createInstance("com.sun.star.text.TextField.PageNumber");
XTextField xTextField = (XTextField)
UnoRuntime.queryInterface(XTextField.class,pn);
XPropertySet xPropertySetTextField = (XPropertySet)
UnoRuntime.queryInterface(
XPropertySet.class,xTextField);
xPropertySetTextField.setPropertyValue("NumberingType",new
Short(NumberingType.ARABIC));
xPropertySetTextField.setPropertyValue("SubType",om.sun.star.text.PageNumberType.CURRENT);
Thanks to all
Cristian
The page numbers are not set based on the field that you insert, but
rather, the field displays the current page number. If you want to set
the page number, you insert a page break and tell it to start with a
new page number and style. My free macro document contains examples in
a section on inserting page breaks. You need to set two properties in
the paragraph.
Thanks!!
i use this code at the beginning of my document
....
xps.setPropertyValue("PageDescName",new String("Standard"));
xps.setPropertyValue("PageNumberOffset",new Short(number))
...
and all is ok!!
Cristian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]