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.


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to