Talk:Documentation
From Apache OpenOffice Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
There are things listed in the "documentation" box on the frontpage that are missing here (for example: OOoHelpOutline, Documentation/Dashboard/Application_Online_Help). So these are either:
- outdated/obsolete and should be removed from the frontpage
- not outdated/obsolete and should be linked from here
--B michaelsen 16:07, 20 October 2009 (UTC)
- I've simplified things for the Users section, adding just a single link to the doc project page. The other links were to outdated info, or to info that isn't much help to general users. --ccornell 10:31, 26 October 2009 (UTC)
To get Sheet Number Instead of Page Number
Hi.
I am having a little problem: I need to get sheet number instead of page number;
I made this routine:
Sub SetCurrSheet
dim NumFol, NumPg, TotFol, oDoc as object, dispatcher as object, gVC
oDoc = ThisComponent
gVC = oDoc.CurrentController.getViewCursor()
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
TotFol = oDoc.CurrentController.PageCount ' Total de Páginas
gVC.jumpToFirstPage rem posiciona primeira pagina
for M = 1 to TotFol
sName = oDoc.getCurrentController().getViewCursor().PageStyleName
oST = oDoc.StyleFamilies.getByName("PageStyles").getByName(sName)
oST.HeaderIsOn = false
oST.HeaderIsShared = false
oST.HeaderIsOn = true
oST.HeaderIsShared = false
oText = oST.HeaderText
oCur = oText.createTextCursor()
NumPg = gVC.getPage()
msgbox "Pagina atual: " & NumPg
Select Case NumPg
Case NumPg = 1
NumFol = 1
Case Else
NumFol = iif(NumPg Mod 2, int(NumPg / 2 + 1),NumPg / 2)
End Select
MsgBox "Folha Passada: " & NumFol
' oCur.setString("Folha " & NumFol)
oText.setString("Folha " & NumFol, False)
msgbox "Numero de Páginas: " & TotFol
gVC.jumpToNextPage()
next M
End Sub
But it returns only a static information, not a user field. I did like to utilize that routine used on our wiki, at final of page:
/** This method inserts both a date field and a user field containing the number '42' */ protected void TextFieldExample() { try { // Use the text document's factory to create a DateTime text field, // and access it's // XTextField interface XTextField xDateField = (XTextField) UnoRuntime.queryInterface( XTextField.class, mxDocFactory.createInstance( "com.sun.star.text.textfield.DateTime")); // Insert it at the end of the document mxDocText.insertTextContent ( mxDocText.getEnd(), xDateField, false ); // Use the text document's factory to create a user text field, // and access it's XDependentTextField interface XDependentTextField xUserField = (XDependentTextField) UnoRuntime.queryInterface ( XDependentTextField.class, mxDocFactory.createInstance( "com.sun.star.text.textfield.User")); // Create a fieldmaster for our newly created User Text field, and access it's // XPropertySet interface XPropertySet xMasterPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, mxDocFactory.createInstance( "com.sun.star.text.fieldmaster.User")); // Set the name and value of the FieldMaster xMasterPropSet.setPropertyValue ("Name", "UserEmperor"); xMasterPropSet.setPropertyValue ("Value", new Integer(42)); // Attach the field master to the user field xUserField.attachTextFieldMaster (xMasterPropSet); // Move the cursor to the end of the document mxDocCursor.gotoEnd(false); // insert a paragraph break using the XSimpleText interface mxDocText.insertControlCharacter( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false); // Insert the user field at the end of the document mxDocText.insertTextContent(mxDocText.getEnd(), xUserField, false); } catch (Exception e) { e.printStackTrace (System.out); } }
Instead of "42", to bring sheet # (that is: PageNumber MOD 2). I do not know to codificate this. Somebody help me to achieve it, please... Morvan