I've got a macro (Basic on Windows) that reformats documents. Among other things it adds headers and footers, and puts page numbering (e.g. "page 1 of 6") in the footer. I want the page numbering centred. So I write one tab, chr(9), before "Page", and it moves from the left end to the centre, because there are only three such tab positions in a normal document: left, centre, and right. This worked fine until now.

Now the document I receive has changed format. (This is out of my control.) It's a .docx and it has ten or more tab positions. I don't want any of these, I just want my old left, centre, and right back. (I want all three because I fill them by hand in the header: it's not just about the automatic pagination.) I've read anything I can find about headers, tabs, and styles, without finding an answer. I don't use tabs in the body text, only in the header and footer. Here is the relevant code, cut down to essentials:

Tabs are a property of the "paragraph style" (different than "page styles"). Check out Andrew Pitonyak's book OpenOffice Macros Explained (available for free download on his website), there is a section "Paragraph properties" with a table "Properties supported by the com.sun.style.ParagraphProperties service" including the property "ParaTabStops":

This is an array of structures of type com.sun.star.style.TabStop. Each structure contains the following properties:•Position – Long integer position relative to the left border.•Alignment – Alignment of the text range before the tab. This is an enumeration of type com.sun.star.style.TabAlign. Valid values include LEFT, RIGHT, CENTER, DECIMAL, and DEFAULT.•DecimalChar – Specifies which character is the decimal.•FillChar – Character used to fill space between the text.

Thank you. With that I've made a crude fix. I don't know whether my problem is 'solved'. I haven't got tabs at left, centre, and right as I wanted, but at left, 90 mm from left, and 160 mm from left, which is good enough for these documents. I didn't work out what any of the other fields in the struct did, but it turns out they're not needed. I just set the position: