Code: Select all
FTR_FONT = "Calibri"
FTR_SIZE = 8
' Short names for stupidly named things
kARABIC = com.sun.star.style.NumberingType.ARABIC
kPAGENO = "com.sun.star.text.textfield.PageNumber"
kPAGECT = "com.sun.star.text.textfield.PageCount"
' . . .
cur4 = style.footertext.text.createtextcursor
cur4.charfontname = FTR_FONT
cur4.charheight = FTR_SIZE
' . . .
pageno = doc.createinstance(kPAGENO)
pageno.numberingtype = kARABIC ' default is A, B, C ...!
pageno.subtype = 1 ' subtype 1 = use current page no.
pagect = doc.createinstance(kPAGECT)
pagect.numberingtype = kARABIC
style.footertext.text.insertstring(cur4, chr(9) & "page ", 0) ' 9 = tab
style.footertext.text.inserttextcontent(cur4, pageno, 0)
style.footertext.text.insertstring(cur4, " of ", 0)
style.footertext.text.inserttextcontent(cur4, pagect, 0)
Edited: Didn't notice pageno and pagect were my own variable names, so I've added their definitions.