OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
The Structure of Spreadsheets<br />
HContent = DefPage.RightPageHeaderContent<br />
HText = HContent.LeftText<br />
HText.String = "Just a Test."<br />
DefPage.RightPageHeaderContent = HContent<br />
Note the last line in the example: Once the text is changed, the TextContent object must be assigned to the<br />
header again so that the change is effective.<br />
Another mechanism for changing the text of headers and footers is available for text documents (<strong>OpenOffice</strong>.<strong>org</strong><br />
Writer) because these consist of a single block of text. The following properties are defined in the<br />
com.sun.star.style.PageProperties service:<br />
HeaderText (Object)<br />
text object with content of the header (com.sun.star.text.XText service)<br />
HeaderTextLeft (Object)<br />
text object with content of headers on left-hand pages (com.sun.star.text.XText service)<br />
HeaderTextRight (Object)<br />
text object with content of headers on right-hand pages (com.sun.star.text.XText service)<br />
FooterText (Object)<br />
text object with content of the footer (com.sun.star.text.XText service)<br />
FooterTextLeft (Object)<br />
text object with content of footers on left-hand pages (com.sun.star.text.XText service)<br />
FooterTextRight (Object)<br />
text object with content of footers on right-hand pages (com.sun.star.text.XText service)<br />
The following example creates a header in the "Default" page style for text documents and adds the text "Just a<br />
Test" to the header.<br />
Dim Doc As Object<br />
Dim Sheet As Object<br />
Dim StyleFamilies As Object<br />
Dim PageStyles As Object<br />
Dim DefPage As Object<br />
Dim HText As Object<br />
Doc = ThisComponent<br />
StyleFamilies = Doc.StyleFamilies<br />
PageStyles = StyleFamilies.getByName("PageStyles")<br />
DefPage = PageStyles.getByName("Default")<br />
DefPage.HeaderIsOn = True<br />
HText = DefPage.HeaderText<br />
HText.String = "Just a Test."<br />
In this instance, access is provided directly through the HeaderText property of the page style rather than the<br />
HeaderFooterContent object.<br />
Centering (Spreadsheets Only)<br />
The com.sun.star.sheet.TablePageStyle service is only used in <strong>OpenOffice</strong>.<strong>org</strong> Calc page styles and allows cell<br />
ranges that you want printed to be centered on the page. This service provides the following properties:<br />
CenterHorizontally (Boolean)<br />
table content is centered horizontally<br />
CenterVertically (Boolean)<br />
table content is centered vertically<br />
106 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010