page break
new page
Matthias Prem
How can a page break be inserted?
/* InsertPageBreak.rex */
/* Macro */
/* get the script context, the document service and the XTextDocument */
xScriptContext=uno.getScriptContext()
oDoc=xScriptContext~getDocument
xTextDoc=oDoc~{%see com.sun.star.text.XTextDocument%XTextDocument}
/* create the cursor */
xTextCursor=xTextDoc~getText~createTextCursor()
xText=xTextDoc~getText()
xTextDoc~getText~getEnd~setString("This text is on page number 1.")
/* set cursor properties and define BreakType */
xCursorProps=xTextCursor~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xCursorProps~setPropertyValue("BreakType", bsf.getConstant("{%see com.sun.star.style.BreakType}", "PAGE_AFTER"))
xTextDoc~getText~getEnd~setString("13" ~d2c)
/* set text on page 2 */
xTextDoc~getText~getEnd~setString("This text is on page number 2.")
::requires UNO.CLS
Initial version