<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Norrin</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Norrin"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Norrin"/>
	<updated>2026-12-04T11:54:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Structure_of_Spreadsheets&amp;diff=124591</id>
		<title>Documentation/BASIC Guide/Structure of Spreadsheets</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Structure_of_Spreadsheets&amp;diff=124591"/>
		<updated>2009-05-10T03:17:17Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Spreadsheets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:The Structure of Spreadsheet Documents}}&lt;br /&gt;
{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Spreadsheets&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Rows and Columns&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
 &lt;br /&gt;
The document object of a spreadsheet is based on the &amp;lt;idl&amp;gt;com.sun.star.sheet.SpreadsheetDocument&amp;lt;/idl&amp;gt; service. Each of these documents may contain several spreadsheets. In this guide, a table-based document or spreadsheet document is the entire document, whereas a spreadsheet (or sheet for short) is a sheet (table) in the document.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|Different terminology for spreadsheets and their content is used in VBA and {{OOo}} Basic. Whereas the document object in VBA is called a Workbook and its individual pages Worksheets, they are called SpreadsheetDocument and Sheet in {{OOo}} Basic.}}&lt;br /&gt;
&lt;br /&gt;
== Spreadsheets ==&lt;br /&gt;
&lt;br /&gt;
You can access the individual sheets of a spreadsheet document through the &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list.&lt;br /&gt;
&lt;br /&gt;
The following examples show you how to access a sheet either through its number or its name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example 1: access by means of the number (numbering begins with 0)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets (0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|&amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; returns the last previously active document.}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example 2: access by means of the name&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the first example, the sheet is accessed by its number (counting begins at 0). In the second example, the sheet is accessed by its name and the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt; object that is obtained by the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.Spreadsheet&amp;lt;/idl&amp;gt; service. In addition to providing several interfaces for editing the content, this service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsVisible (Boolean)&amp;lt;/tt&amp;gt;:the spreadsheet is visible.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PageStyle (String)&amp;lt;/tt&amp;gt;:name of the page template for the spreadsheet.&lt;br /&gt;
&lt;br /&gt;
=== Creating, Deleting and Renaming Sheets ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list for a &amp;lt;tt&amp;gt;spreadsheet&amp;lt;/tt&amp;gt; document is also used to create, delete, and rename individual sheets. The following example uses the &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt; method to check if a sheet called &amp;#039;&amp;#039;&amp;#039;MySheet&amp;#039;&amp;#039;&amp;#039; exists. If it does, the method determines a corresponding object reference by using the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method and then saves the reference in a variable in &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt;. If the corresponding sheet does not exist, it is created by the &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; call and inserted in the spreadsheet document by the &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
If Doc.Sheets.hasByName(&amp;quot;MySheet&amp;quot;) Then&lt;br /&gt;
   Sheet = Doc.Sheets.getByName(&amp;quot;MySheet&amp;quot;)&lt;br /&gt;
Else&lt;br /&gt;
   Sheet = Doc.createInstance(&amp;quot;com.sun.star.sheet.Spreadsheet&amp;quot;)&lt;br /&gt;
   Doc.Sheets.insertByName(&amp;quot;MySheet&amp;quot;, Sheet)&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt; methods are from the &amp;lt;idl&amp;gt;com.sun.star.container.XNameContainer&amp;lt;/idl&amp;gt; interface as described in [[Documentation/BASIC Guide/API Intro|Introduction to the API]].&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Structure of Spreadsheets}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Structure_of_Spreadsheets&amp;diff=124590</id>
		<title>Documentation/BASIC Guide/Structure of Spreadsheets</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Structure_of_Spreadsheets&amp;diff=124590"/>
		<updated>2009-05-10T03:12:01Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Spreadsheets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:The Structure of Spreadsheet Documents}}&lt;br /&gt;
{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Spreadsheets&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Rows and Columns&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
 &lt;br /&gt;
The document object of a spreadsheet is based on the &amp;lt;idl&amp;gt;com.sun.star.sheet.SpreadsheetDocument&amp;lt;/idl&amp;gt; service. Each of these documents may contain several spreadsheets. In this guide, a table-based document or spreadsheet document is the entire document, whereas a spreadsheet (or sheet for short) is a sheet (table) in the document.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|Different terminology for spreadsheets and their content is used in VBA and {{OOo}} Basic. Whereas the document object in VBA is called a Workbook and its individual pages Worksheets, they are called SpreadsheetDocument and Sheet in {{OOo}} Basic.}}&lt;br /&gt;
&lt;br /&gt;
== Spreadsheets ==&lt;br /&gt;
&lt;br /&gt;
You can access the individual sheets of a spreadsheet document through the &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list.&lt;br /&gt;
&lt;br /&gt;
The following examples show you how to access a sheet either through its number or its name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example 1: access by means of the number (numbering begins with 0)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets (0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example 2: access by means of the name&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the first example, the sheet is accessed by its number (counting begins at 0). In the second example, the sheet is accessed by its name and the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt; object that is obtained by the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.Spreadsheet&amp;lt;/idl&amp;gt; service. In addition to providing several interfaces for editing the content, this service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsVisible (Boolean)&amp;lt;/tt&amp;gt;:the spreadsheet is visible.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PageStyle (String)&amp;lt;/tt&amp;gt;:name of the page template for the spreadsheet.&lt;br /&gt;
&lt;br /&gt;
=== Creating, Deleting and Renaming Sheets ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list for a &amp;lt;tt&amp;gt;spreadsheet&amp;lt;/tt&amp;gt; document is also used to create, delete, and rename individual sheets. The following example uses the &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt; method to check if a sheet called &amp;#039;&amp;#039;&amp;#039;MySheet&amp;#039;&amp;#039;&amp;#039; exists. If it does, the method determines a corresponding object reference by using the &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; method and then saves the reference in a variable in &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt;. If the corresponding sheet does not exist, it is created by the &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; call and inserted in the spreadsheet document by the &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
If Doc.Sheets.hasByName(&amp;quot;MySheet&amp;quot;) Then&lt;br /&gt;
   Sheet = Doc.Sheets.getByName(&amp;quot;MySheet&amp;quot;)&lt;br /&gt;
Else&lt;br /&gt;
   Sheet = Doc.createInstance(&amp;quot;com.sun.star.sheet.Spreadsheet&amp;quot;)&lt;br /&gt;
   Doc.Sheets.insertByName(&amp;quot;MySheet&amp;quot;, Sheet)&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;getByName&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt; methods are from the &amp;lt;idl&amp;gt;com.sun.star.container.XNameContainer&amp;lt;/idl&amp;gt; interface as described in [[Documentation/BASIC Guide/API Intro|Introduction to the API]].&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Structure of Spreadsheets}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Editing_Spreadsheet_Documents&amp;diff=124589</id>
		<title>Documentation/BASIC Guide/Editing Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Editing_Spreadsheet_Documents&amp;diff=124589"/>
		<updated>2009-05-10T03:10:33Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Searching and Replacing Cell Contents */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Structure of Spreadsheets&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Drawings Presentations&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Editing Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Whereas the previous section described the main structure of spreadsheet documents, this section describes the services that allow you to easily access individual cells or cell ranges.&lt;br /&gt;
&lt;br /&gt;
== Cell Ranges ==&lt;br /&gt;
In addition to an object for individual cells (&amp;lt;idl&amp;gt;com.sun.star.table.Cell&amp;lt;/idl&amp;gt; service), {{OOo}} also provides objects that represent cell ranges. Such &amp;lt;tt&amp;gt;CellRange&amp;lt;/tt&amp;gt; objects are created using the &amp;lt;tt&amp;gt;getCellRangeByName&amp;lt;/tt&amp;gt; call of the spreadsheet object:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;A1:C15&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A colon (:) is used to specify a cell range in a spreadsheet document. For example, A1:C15 represents all the cells in rows 1 to 15 in columns A, B, and C.&lt;br /&gt;
&lt;br /&gt;
The location of individual cells in a cell range can be determined using the &amp;lt;tt&amp;gt;getCellByPosition&amp;lt;/tt&amp;gt; method, where the coordinates of the top left cell in the cell range is (0, 0). The following example uses this method to create an object of cell C3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;B2:D4&amp;quot;)&lt;br /&gt;
Cell = CellRange.GetCellByPosition(1, 1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Formatting Cell Ranges ===&lt;br /&gt;
Just like individual cells, you can apply formatting to cell ranges using the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. For more information and examples of this service, see [[Documentation/BASIC Guide/Formatting Spreadsheet Documents|Formatting Spreadsheet Documents]].&lt;br /&gt;
&lt;br /&gt;
=== Computing With Cell Ranges ===&lt;br /&gt;
You can use the &amp;lt;tt&amp;gt;computeFunction&amp;lt;/tt&amp;gt; method to perform mathematical operations on cell ranges. The &amp;lt;tt&amp;gt;computeFunction&amp;lt;/tt&amp;gt; expects a constant as the parameter that describes the mathematical function that you want to use. The associated constants are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.GeneralFunction&amp;lt;/idl&amp;gt; enumeration. The following values are available:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;SUM&amp;lt;/tt&amp;gt;:sum of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;COUNT&amp;lt;/tt&amp;gt;:total number of all values (including non-numerical values)&lt;br /&gt;
;&amp;lt;tt&amp;gt;COUNTNUMS&amp;lt;/tt&amp;gt;:total number of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;AVERAGE&amp;lt;/tt&amp;gt;:average of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;MAX&amp;lt;/tt&amp;gt;:largest numerical value&lt;br /&gt;
;&amp;lt;tt&amp;gt;MIN&amp;lt;/tt&amp;gt;:smallest numerical value&lt;br /&gt;
;&amp;lt;tt&amp;gt;PRODUCT&amp;lt;/tt&amp;gt;:product of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;STDEV&amp;lt;/tt&amp;gt;:standard deviation&lt;br /&gt;
;&amp;lt;tt&amp;gt;VAR&amp;lt;/tt&amp;gt;:variance&lt;br /&gt;
;&amp;lt;tt&amp;gt;STDEVP&amp;lt;/tt&amp;gt;:standard deviation based on the total population&lt;br /&gt;
;&amp;lt;tt&amp;gt;VARP&amp;lt;/tt&amp;gt;:variance based on the total population&lt;br /&gt;
&lt;br /&gt;
The following example computes the average value of the &amp;lt;tt&amp;gt;A1:C3&amp;lt;/tt&amp;gt; range and prints the result in a message box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;A1:C3&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
MsgBox CellRange.computeFunction(com.sun.star.sheet.GeneralFunction.AVERAGE)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deleting Cell Contents ===&lt;br /&gt;
The &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt; method simplifies the process of deleting cell contents and cell ranges in that it deletes one specific type of content from a cell range.&lt;br /&gt;
&lt;br /&gt;
The following example removes all the strings and the direct formatting information from the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
Dim Flags As Long&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;B2:C3&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Flags = com.sun.star.sheet.CellFlags.STRING + _&lt;br /&gt;
      com.sun.star.sheet.CellFlags.HARDATTR&lt;br /&gt;
&lt;br /&gt;
CellRange.clearContents(Flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flags specified in &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt; come from the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellFlags&amp;lt;/idl&amp;gt; constants list. This list provides the following elements:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;VALUE&amp;lt;/tt&amp;gt;:numerical values that are not formatted as date or time&lt;br /&gt;
;&amp;lt;tt&amp;gt;DATETIME&amp;lt;/tt&amp;gt;:numerical values that are formatted as date or time&lt;br /&gt;
;&amp;lt;tt&amp;gt;STRING&amp;lt;/tt&amp;gt;:strings&lt;br /&gt;
;&amp;lt;tt&amp;gt;ANNOTATION&amp;lt;/tt&amp;gt;:comments that are linked to cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;FORMULA&amp;lt;/tt&amp;gt;:formulas&lt;br /&gt;
;&amp;lt;tt&amp;gt;HARDATTR&amp;lt;/tt&amp;gt;:direct formatting of cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;STYLES&amp;lt;/tt&amp;gt;:indirect formatting&lt;br /&gt;
;&amp;lt;tt&amp;gt;OBJECTS&amp;lt;/tt&amp;gt;:drawing objects that are connected to cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;EDITATTR&amp;lt;/tt&amp;gt;:character formatting that only applies to parts of the cells&lt;br /&gt;
&lt;br /&gt;
You can also add the constants together to delete different information using a call from &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Searching and Replacing Cell Contents ==&lt;br /&gt;
Spreadsheet documents, like text documents, provide a function for searching and replacing.&lt;br /&gt;
&lt;br /&gt;
The descriptor objects for searching and replacing in spreadsheet documents are not created directly through the document object, but rather through the &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list. The following is an example of a search and replace process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim ReplaceDescriptor As Object&lt;br /&gt;
Dim I As Integer&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
ReplaceDescriptor = Sheet.createReplaceDescriptor()&lt;br /&gt;
ReplaceDescriptor.SearchString = &amp;quot;is&amp;quot;&lt;br /&gt;
ReplaceDescriptor.ReplaceString = &amp;quot;was&amp;quot;&lt;br /&gt;
For I = 0 to Doc.Sheets.Count - 1&lt;br /&gt;
   Sheet = Doc.Sheets(I)&lt;br /&gt;
   Sheet.ReplaceAll(ReplaceDescriptor) &lt;br /&gt;
Next I&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example uses the first page of the document to create a &amp;lt;tt&amp;gt;ReplaceDescriptor&amp;lt;/tt&amp;gt; and then applies this to all pages in a loop.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Editing Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Editing_Spreadsheet_Documents&amp;diff=124588</id>
		<title>Documentation/BASIC Guide/Editing Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Editing_Spreadsheet_Documents&amp;diff=124588"/>
		<updated>2009-05-10T03:10:10Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Cell Ranges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Structure of Spreadsheets&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Drawings Presentations&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Editing Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Whereas the previous section described the main structure of spreadsheet documents, this section describes the services that allow you to easily access individual cells or cell ranges.&lt;br /&gt;
&lt;br /&gt;
== Cell Ranges ==&lt;br /&gt;
In addition to an object for individual cells (&amp;lt;idl&amp;gt;com.sun.star.table.Cell&amp;lt;/idl&amp;gt; service), {{OOo}} also provides objects that represent cell ranges. Such &amp;lt;tt&amp;gt;CellRange&amp;lt;/tt&amp;gt; objects are created using the &amp;lt;tt&amp;gt;getCellRangeByName&amp;lt;/tt&amp;gt; call of the spreadsheet object:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;A1:C15&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A colon (:) is used to specify a cell range in a spreadsheet document. For example, A1:C15 represents all the cells in rows 1 to 15 in columns A, B, and C.&lt;br /&gt;
&lt;br /&gt;
The location of individual cells in a cell range can be determined using the &amp;lt;tt&amp;gt;getCellByPosition&amp;lt;/tt&amp;gt; method, where the coordinates of the top left cell in the cell range is (0, 0). The following example uses this method to create an object of cell C3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;B2:D4&amp;quot;)&lt;br /&gt;
Cell = CellRange.GetCellByPosition(1, 1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Formatting Cell Ranges ===&lt;br /&gt;
Just like individual cells, you can apply formatting to cell ranges using the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. For more information and examples of this service, see [[Documentation/BASIC Guide/Formatting Spreadsheet Documents|Formatting Spreadsheet Documents]].&lt;br /&gt;
&lt;br /&gt;
=== Computing With Cell Ranges ===&lt;br /&gt;
You can use the &amp;lt;tt&amp;gt;computeFunction&amp;lt;/tt&amp;gt; method to perform mathematical operations on cell ranges. The &amp;lt;tt&amp;gt;computeFunction&amp;lt;/tt&amp;gt; expects a constant as the parameter that describes the mathematical function that you want to use. The associated constants are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.GeneralFunction&amp;lt;/idl&amp;gt; enumeration. The following values are available:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;SUM&amp;lt;/tt&amp;gt;:sum of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;COUNT&amp;lt;/tt&amp;gt;:total number of all values (including non-numerical values)&lt;br /&gt;
;&amp;lt;tt&amp;gt;COUNTNUMS&amp;lt;/tt&amp;gt;:total number of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;AVERAGE&amp;lt;/tt&amp;gt;:average of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;MAX&amp;lt;/tt&amp;gt;:largest numerical value&lt;br /&gt;
;&amp;lt;tt&amp;gt;MIN&amp;lt;/tt&amp;gt;:smallest numerical value&lt;br /&gt;
;&amp;lt;tt&amp;gt;PRODUCT&amp;lt;/tt&amp;gt;:product of all numerical values&lt;br /&gt;
;&amp;lt;tt&amp;gt;STDEV&amp;lt;/tt&amp;gt;:standard deviation&lt;br /&gt;
;&amp;lt;tt&amp;gt;VAR&amp;lt;/tt&amp;gt;:variance&lt;br /&gt;
;&amp;lt;tt&amp;gt;STDEVP&amp;lt;/tt&amp;gt;:standard deviation based on the total population&lt;br /&gt;
;&amp;lt;tt&amp;gt;VARP&amp;lt;/tt&amp;gt;:variance based on the total population&lt;br /&gt;
&lt;br /&gt;
The following example computes the average value of the &amp;lt;tt&amp;gt;A1:C3&amp;lt;/tt&amp;gt; range and prints the result in a message box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.getByName(&amp;quot;Sheet 1&amp;quot;)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;A1:C3&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
MsgBox CellRange.computeFunction(com.sun.star.sheet.GeneralFunction.AVERAGE)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deleting Cell Contents ===&lt;br /&gt;
The &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt; method simplifies the process of deleting cell contents and cell ranges in that it deletes one specific type of content from a cell range.&lt;br /&gt;
&lt;br /&gt;
The following example removes all the strings and the direct formatting information from the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRange As Object&lt;br /&gt;
Dim Flags As Long&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
CellRange = Sheet.getCellRangeByName(&amp;quot;B2:C3&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Flags = com.sun.star.sheet.CellFlags.STRING + _&lt;br /&gt;
      com.sun.star.sheet.CellFlags.HARDATTR&lt;br /&gt;
&lt;br /&gt;
CellRange.clearContents(Flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flags specified in &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt; come from the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellFlags&amp;lt;/idl&amp;gt; constants list. This list provides the following elements:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;VALUE&amp;lt;/tt&amp;gt;:numerical values that are not formatted as date or time&lt;br /&gt;
;&amp;lt;tt&amp;gt;DATETIME&amp;lt;/tt&amp;gt;:numerical values that are formatted as date or time&lt;br /&gt;
;&amp;lt;tt&amp;gt;STRING&amp;lt;/tt&amp;gt;:strings&lt;br /&gt;
;&amp;lt;tt&amp;gt;ANNOTATION&amp;lt;/tt&amp;gt;:comments that are linked to cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;FORMULA&amp;lt;/tt&amp;gt;:formulas&lt;br /&gt;
;&amp;lt;tt&amp;gt;HARDATTR&amp;lt;/tt&amp;gt;:direct formatting of cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;STYLES&amp;lt;/tt&amp;gt;:indirect formatting&lt;br /&gt;
;&amp;lt;tt&amp;gt;OBJECTS&amp;lt;/tt&amp;gt;:drawing objects that are connected to cells&lt;br /&gt;
;&amp;lt;tt&amp;gt;EDITATTR&amp;lt;/tt&amp;gt;:character formatting that only applies to parts of the cells&lt;br /&gt;
&lt;br /&gt;
You can also add the constants together to delete different information using a call from &amp;lt;tt&amp;gt;clearContents&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Searching and Replacing Cell Contents ==&lt;br /&gt;
Spreadsheet documents, like text documents, provide a function for searching and replacing.&lt;br /&gt;
&lt;br /&gt;
The descriptor objects for searching and replacing in spreadsheet documents are not created directly through the document object, but rather through the &amp;lt;tt&amp;gt;Sheets&amp;lt;/tt&amp;gt; list. The following is an example of a search and replace process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim ReplaceDescriptor As Object&lt;br /&gt;
Dim I As Integer&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
ReplaceDescriptor = Sheet.createReplaceDescriptor()&lt;br /&gt;
ReplaceDescriptor.SearchString = &amp;quot;is&amp;quot;&lt;br /&gt;
ReplaceDescriptor.ReplaceString = &amp;quot;was&amp;quot;&lt;br /&gt;
For I = 0 to Doc.Sheets.Count - 1&lt;br /&gt;
   Sheet = Doc.Sheets(I)&lt;br /&gt;
   Sheet.ReplaceAll(ReplaceDescriptor) &lt;br /&gt;
Next I&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example uses the first page of the document to create a &amp;lt;tt&amp;gt;ReplaceDescriptor&amp;lt;/tt&amp;gt; and then applies this to all pages in a loop.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Editing Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124587</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124587"/>
		<updated>2009-05-10T03:09:01Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Changing the Text of Headers and Footers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124586</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124586"/>
		<updated>2009-05-10T03:08:25Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Page Margin, Border, and Shadow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124585</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124585"/>
		<updated>2009-05-10T03:08:03Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Page Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124584</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124584"/>
		<updated>2009-05-10T03:07:44Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Number, Date and Text Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124582</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124582"/>
		<updated>2009-05-10T03:06:49Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Justification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124581</id>
		<title>Documentation/BASIC Guide/Formatting Spreadsheet Documents</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Formatting_Spreadsheet_Documents&amp;diff=124581"/>
		<updated>2009-05-10T03:06:26Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Background Color and Shadows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Cells and Ranges&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Editing Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Formatting Spreadsheet Documents}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
A spreadsheet document provides properties and methods for formatting cells and pages.&lt;br /&gt;
&lt;br /&gt;
== Cell Properties ==&lt;br /&gt;
&lt;br /&gt;
There are numerous options for formatting cells, such as specifying the font type and size for text. Each cell supports the &amp;lt;idl&amp;gt;com.sun.star.style.CharacterProperties&amp;lt;/idl&amp;gt; and &amp;lt;idl&amp;gt;com.sun.star.style.ParagraphProperties&amp;lt;/idl&amp;gt; services, the main properties of which are described in [[Documentation/BASIC Guide/Text Documents|Text Documents]]. Special cell formatting is handled by the &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service. The main properties of this service are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
You can apply all of the named properties to individual cells and to cell ranges.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;CellProperties&amp;lt;/tt&amp;gt; object in the {{OOo}} API is comparable with the &amp;lt;tt&amp;gt;Interior&amp;lt;/tt&amp;gt; object from VBA which also defines cell-specific properties.}}&lt;br /&gt;
&lt;br /&gt;
== Background Color and Shadows ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.CellProperties&amp;lt;/idl&amp;gt; service provides the following properties for defining background colors and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CellBackColor (Long)&amp;lt;/tt&amp;gt;:background color of the table cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsCellBackgroundTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the background color to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifies the shadow for cells (structure in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure and the detailed specifications for cell shadows have the following structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Location (enum)&amp;lt;/tt&amp;gt;:position of shadow (value from the &amp;lt;idl&amp;gt;com.sun.star.table.ShadowLocation&amp;lt;/idl&amp;gt; structure).&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowWidth (Short)&amp;lt;/tt&amp;gt;:size of shadow in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTransparent (Boolean)&amp;lt;/tt&amp;gt;:sets the shadow to transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;Color (Long)&amp;lt;/tt&amp;gt;:color of shadow&lt;br /&gt;
&lt;br /&gt;
The following example writes the number 1000 to the B2 cell, changes the background color to red using the &amp;lt;tt&amp;gt;CellBackColor&amp;lt;/tt&amp;gt; property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim ShadowFormat As New com.sun.star.table.ShadowFormat&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.CellBackColor = RGB(255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT&lt;br /&gt;
ShadowFormat.ShadowWidth = 100&lt;br /&gt;
ShadowFormat.Color = RGB(160, 160, 160)&lt;br /&gt;
&lt;br /&gt;
Cell.ShadowFormat = ShadowFormat&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides various functions that allow you to change the justification of a text in a table cell.&lt;br /&gt;
&lt;br /&gt;
The following properties define the horizontal and vertical justification of a text: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HoriJustify (enum)&amp;lt;/tt&amp;gt;:horizontal justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellHoriJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;VertJustify (enum)&amp;lt;/tt&amp;gt;:vertical justification of the text (value from &amp;lt;idl&amp;gt;com.sun.star.table.CellVertJustify&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Orientation (enum)&amp;lt;/tt&amp;gt;:orientation of text (value in accordance with &amp;lt;idl&amp;gt;com.sun.star.table.CellOrientation&amp;lt;/idl&amp;gt;)&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsTextWrapped (Boolean)&amp;lt;/tt&amp;gt;:permits automatic line breaks within the cell&lt;br /&gt;
;&amp;lt;tt&amp;gt;RotateAngle (Long)&amp;lt;/tt&amp;gt;:angle of rotation of text in hundredths of a degree&lt;br /&gt;
&lt;br /&gt;
The following example shows how you can &amp;quot;stack&amp;quot; the contents of a cell so that the individual characters are printed one under another in the top left corner of the cell. The characters are not rotated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Cell.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT&lt;br /&gt;
Cell.VertJustify = com.sun.star.table.CellVertJustify.TOP&lt;br /&gt;
Cell.Orientation = com.sun.star.table.CellOrientation.STACKED&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Number, Date and Text Format ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} provides a whole range of predefined date and time formats. Each of these formats has an internal number that is used to assign the format to cells using the &amp;lt;tt&amp;gt;NumberFormat&amp;lt;/tt&amp;gt; property. {{OOo}} provides the &amp;lt;tt&amp;gt;queryKey&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;addNew&amp;lt;/tt&amp;gt; methods so that you can access existing number formats as well as create your own number formats. The methods are accessed through the following object call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A format is specified using a format string that is structured in a similar way to the format function of {{OOo}} Basic. However there is one major difference: whereas the command format expects English abbreviations and decimal points or characters as thousands separators, the country-specified abbreviations must be used for the structure of a command format for the &amp;lt;tt&amp;gt;NumberFormats&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
The following example formats the B2 cell so that numbers are displayed with three decimal places and use commas as a thousands separator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
Dim NumberFormats As Object&lt;br /&gt;
Dim NumberFormatString As String&lt;br /&gt;
Dim NumberFormatId As Long&lt;br /&gt;
Dim LocalSettings As New com.sun.star.lang.Locale&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 23400.3523565&lt;br /&gt;
&lt;br /&gt;
LocalSettings.Language = &amp;quot;en&amp;quot;&lt;br /&gt;
LocalSettings.Country = &amp;quot;us&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormats = Doc.NumberFormats&lt;br /&gt;
NumberFormatString = &amp;quot;#,##0.000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)&lt;br /&gt;
If NumberFormatId = -1 Then&lt;br /&gt;
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
MsgBox NumberFormatId&lt;br /&gt;
Cell.NumberFormat = NumberFormatId&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Format Cells&amp;#039;&amp;#039;&amp;#039; dialog in {{OOo}} Calc provides an overview of the different formatting options for cells.&lt;br /&gt;
&lt;br /&gt;
== Page Properties ==&lt;br /&gt;
&lt;br /&gt;
Page properties are the formatting options that position document content on a page as well as visual elements that are repeated page after page. These include&lt;br /&gt;
&lt;br /&gt;
* Paper formats&lt;br /&gt;
* Page margins&lt;br /&gt;
* Headers and footers.&lt;br /&gt;
&lt;br /&gt;
The procedure for defining page formats differs from other forms of formatting. Whereas cell, paragraph, and character elements can be formatted directly, page formats can also be defined and indirectly applied using page styles. For example, headers or footers are added to the page style.&lt;br /&gt;
&lt;br /&gt;
The following sections describe the main formatting options for spreadsheet pages. Many of the styles that are described are also available for text documents. The page properties that are valid for both types of documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The page properties that only apply to spreadsheet documents are defined in the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The page properties (page margins, borders, and so on) for a Microsoft Office document are defined by means of a &amp;lt;tt&amp;gt;PageSetup&amp;lt;/tt&amp;gt; object at the &amp;lt;tt&amp;gt;Worksheet&amp;lt;/tt&amp;gt; object (Excel) or &amp;lt;tt&amp;gt;Document&amp;lt;/tt&amp;gt; object (Word) level. In {{OOo}}, these properties are defined using a page style which in turn is linked to the associated document.}}&lt;br /&gt;
&lt;br /&gt;
== Page Background ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service defines the following properties of a pages background:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackColor (long)&amp;lt;/tt&amp;gt;:color of background&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics (value according to enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BackTransparent (Boolean)&amp;lt;/tt&amp;gt;:makes the background transparent&lt;br /&gt;
&lt;br /&gt;
== Page Format ==&lt;br /&gt;
&lt;br /&gt;
The page format is defined using the following properties of the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsLandscape (Boolean)&amp;lt;/tt&amp;gt;:landscape format&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of page in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrinterPaperTray (String)&amp;lt;/tt&amp;gt;:name of the printer paper tray that you want to use&lt;br /&gt;
&lt;br /&gt;
The following example sets the page size of the &amp;quot;Default&amp;quot; page style to the DIN A5 landscape format (height 14.8 cm, width 21 cm):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.IsLandscape = True&lt;br /&gt;
DefPage.Width = 21000&lt;br /&gt;
DefPage.Height = 14800&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Page Margin, Border, and Shadow ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service provides the following properties for adjusting page margins as well as borders and shadows:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftMargin (long)&amp;lt;/tt&amp;gt;:width of the left hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightMargin (long)&amp;lt;/tt&amp;gt;:width of the right hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopMargin (long)&amp;lt;/tt&amp;gt;:width of the top page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomMargin (long)&amp;lt;/tt&amp;gt;:width of the bottom page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorder (struct)&amp;lt;/tt&amp;gt;:specifications for left-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorder (struct)&amp;lt;/tt&amp;gt;:specifications for right-hand line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorder (struct)&amp;lt;/tt&amp;gt;:specifications for top line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorder (struct)&amp;lt;/tt&amp;gt;:specifications for bottom line of page border (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;TopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;BottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom page border and page content in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;ShadowFormat (struct)&amp;lt;/tt&amp;gt;:specifications for shadow of content area of page (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The following example sets the left and right-hand borders of the &amp;quot;Default&amp;quot; page style to 1 centimeter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.LeftMargin = 1000&lt;br /&gt;
DefPage.RightMargin = 1000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The headers and footers of a document form part of the page properties and are defined using the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service. The properties for formatting headers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsOn (Boolean)&amp;lt;/tt&amp;gt;:header is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between header and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightMargin (long)&amp;lt;/tt&amp;gt;:distance between header and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between header and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderHeight (long)&amp;lt;/tt&amp;gt;:height of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of header is automatically adapted to content&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of the left-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorder (struct)&amp;lt;/tt&amp;gt;:details of the right-hand border of frame around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorder (struct)&amp;lt;/tt&amp;gt;:details of the top line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of the bottom line of the border around header (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of header in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderIsShared (Boolean)&amp;lt;/tt&amp;gt;:headers on even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;HeaderTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;HeaderTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackColor (long)&amp;lt;/tt&amp;gt;:background color of header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the header&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of the background graphics for the header (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderBackTransparent (Boolean)&amp;lt;/tt&amp;gt;:shows the background of the header as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of header (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
The properties for formatting footers are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsOn (Boolean)&amp;lt;/tt&amp;gt;:footer is activated&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and left-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightMargin (long)&amp;lt;/tt&amp;gt;:distance between footer and right-hand page margin in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBodyDistance (long)&amp;lt;/tt&amp;gt;:distance between footer and main body of document in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterHeight (long)&amp;lt;/tt&amp;gt;:height of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsDynamicHeight (Boolean)&amp;lt;/tt&amp;gt;:height of footer is adapted automatically to the content&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorder (struct)&amp;lt;/tt&amp;gt;:details of left-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorder (struct)&amp;lt;/tt&amp;gt;:details of right-hand line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorder (struct)&amp;lt;/tt&amp;gt;:details of top line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorder (struct)&amp;lt;/tt&amp;gt;:details of bottom line of border around footer (&amp;lt;idl&amp;gt;com.sun.star.table.BorderLine&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterLeftBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between left-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterRightBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between right-hand border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTopBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between top border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBottomBorderDistance (long)&amp;lt;/tt&amp;gt;:distance between bottom border and content of footer in hundredths of a millimeter&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterIsShared (Boolean)&amp;lt;/tt&amp;gt;:the footers on the even and odd pages have the same content (refer to &amp;lt;tt&amp;gt;FooterText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FooterTextLeft&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;FooterTextRight&amp;lt;/tt&amp;gt; )&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackColor (long)&amp;lt;/tt&amp;gt;:background color of footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicURL (String)&amp;lt;/tt&amp;gt;:URL of the background graphics that you want to use&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicFilter (String)&amp;lt;/tt&amp;gt;:name of the filter for interpreting the background graphics for the footer&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackGraphicLocation (Enum)&amp;lt;/tt&amp;gt;:position of background graphics for the footer (value according to &amp;lt;idl&amp;gt;com.sun.star.style.GraphicLocation&amp;lt;/idl&amp;gt; enumeration)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterBackTransparent (Boolean) &amp;lt;/tt&amp;gt;:shows the background of the footer as transparent&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterShadowFormat (struct)&amp;lt;/tt&amp;gt;:details of shadow of footer (&amp;lt;idl&amp;gt;com.sun.star.table.ShadowFormat&amp;lt;/idl&amp;gt; structure)&lt;br /&gt;
&lt;br /&gt;
== Changing the Text of Headers and Footers ==&lt;br /&gt;
&lt;br /&gt;
The content of headers and footers in a spreadsheet is accessed through the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageHeaderContent (Object)&amp;lt;/tt&amp;gt;:content of headers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;LeftPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for even pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;RightPageFooterContent (Object)&amp;lt;/tt&amp;gt;:content of footers for odd pages (&amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
If you do not need to distinguish between headers or footers for odd and even pages (the &amp;lt;tt&amp;gt;FooterIsShared&amp;lt;/tt&amp;gt; property is &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;), then set the properties for headers and footers on odd pages.&lt;br /&gt;
&lt;br /&gt;
All the named objects return an object that supports the &amp;lt;idl&amp;gt;com.sun.star.sheet.HeaderFooterContent&amp;lt;/idl&amp;gt; service. By means of the (non-genuine) properties &amp;lt;tt&amp;gt;LeftText&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;CenterText&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;RightText&amp;lt;/tt&amp;gt;, this service provides three text elements for the headers and footers of {{OOo}} Calc.&lt;br /&gt;
&lt;br /&gt;
The following example writes the &amp;quot;Just a Test.&amp;quot; value in the left-hand text field of the header from the &amp;quot;Default&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
Dim HContent As Object&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HContent = DefPage.RightPageHeaderContent&lt;br /&gt;
HText = HContent.LeftText&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
DefPage.RightPageHeaderContent = HContent&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the last line in the example: Once the text is changed, the &amp;lt;tt&amp;gt;TextContent&amp;lt;/tt&amp;gt; object must be assigned to the header again so that the change is effective.&lt;br /&gt;
&lt;br /&gt;
Another mechanism for changing the text of headers and footers is available for text documents ({{OOo}} Writer) because these consist of a single block of text. The following properties are defined in the &amp;lt;idl&amp;gt;com.sun.star.style.PageProperties&amp;lt;/idl&amp;gt; service:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderText (Object) &amp;lt;/tt&amp;gt;:text object with content of the header (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;HeaderTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of headers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterText (Object)&amp;lt;/tt&amp;gt;:text object with content of the footer (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextLeft (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on left-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
;&amp;lt;tt&amp;gt;FooterTextRight (Object)&amp;lt;/tt&amp;gt;:text object with content of footers on right-hand pages (&amp;lt;idl&amp;gt;com.sun.star.text.XText&amp;lt;/idl&amp;gt; service)&lt;br /&gt;
&lt;br /&gt;
The following example creates a header in the &amp;quot;Default&amp;quot; page style for text documents and adds the text &amp;quot;Just a Test&amp;quot; to the header.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim StyleFamilies As Object &lt;br /&gt;
Dim PageStyles As Object&lt;br /&gt;
Dim DefPage As Object&lt;br /&gt;
Dim HText As Object&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
StyleFamilies = Doc.StyleFamilies&lt;br /&gt;
PageStyles = StyleFamilies.getByName(&amp;quot;PageStyles&amp;quot;)&lt;br /&gt;
DefPage = PageStyles.getByName(&amp;quot;Default&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
DefPage.HeaderIsOn = True&lt;br /&gt;
HText = DefPage.HeaderText &lt;br /&gt;
&lt;br /&gt;
HText.String = &amp;quot;Just a Test.&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this instance, access is provided directly through the &amp;lt;tt&amp;gt;HeaderText&amp;lt;/tt&amp;gt; property of the page style rather than the &amp;lt;tt&amp;gt;HeaderFooterContent&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
== Centering (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service is only used in {{OOo}} Calc page styles and allows cell ranges that you want printed to be centered on the page. This service provides the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterHorizontally (Boolean)&amp;lt;/tt&amp;gt;:table content is centered horizontally&lt;br /&gt;
;&amp;lt;tt&amp;gt;CenterVertically (Boolean)&amp;lt;/tt&amp;gt;:table content is centered vertically&lt;br /&gt;
&lt;br /&gt;
== Definition of Elements to be Printed (Spreadsheets Only) ==&lt;br /&gt;
&lt;br /&gt;
When you format sheets, you can define whether page elements are visible. For this purpose, the &amp;lt;idl&amp;gt;com.sun.star.sheet.TablePageStyle&amp;lt;/idl&amp;gt; service provides the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintAnnotations (Boolean)&amp;lt;/tt&amp;gt;:prints cell comments&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintGrid (Boolean)&amp;lt;/tt&amp;gt;:prints the cell gridlines&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintHeaders (Boolean)&amp;lt;/tt&amp;gt;:prints the row and column headings&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintCharts (Boolean)&amp;lt;/tt&amp;gt;:prints charts contained in a sheet&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintObjects (Boolean)&amp;lt;/tt&amp;gt;:prints embedded objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDrawing (Boolean)&amp;lt;/tt&amp;gt;:prints draw objects&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintDownFirst (Boolean)&amp;lt;/tt&amp;gt;:if the contents of a sheet extend across several pages, they are first printed in vertically descending order, and then down the right-hand side.&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintFormulas (Boolean)&amp;lt;/tt&amp;gt;:prints the formulas instead of the calculated values&lt;br /&gt;
;&amp;lt;tt&amp;gt;PrintZeroValues (Boolean)&amp;lt;/tt&amp;gt;:prints the zero values&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Formatting Spreadsheet Documents}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Cells_and_Ranges&amp;diff=124580</id>
		<title>Documentation/BASIC Guide/Cells and Ranges</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Cells_and_Ranges&amp;diff=124580"/>
		<updated>2009-05-10T03:03:29Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Inserting, Deleting, Copying and Moving Cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Rows and Columns&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Formatting Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Cells and Ranges}}&lt;br /&gt;
 &lt;br /&gt;
A spreadsheet consists of a two-dimensional list containing cells. Each cell is defined by its X and Y-position with respect to the top left cell which has the position (0,0).&lt;br /&gt;
&lt;br /&gt;
== Addressing and Editing Individual Cells ==&lt;br /&gt;
&lt;br /&gt;
The following example creates an object that references the top left cell and inserts a text in the cell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object   &lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.String = &amp;quot;Test&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In addition to numerical coordinates, each cell in a sheet has a name, for example, the top left cell (0,0) of a spreadsheet is called &amp;lt;tt&amp;gt;A1&amp;lt;/tt&amp;gt;. The letter &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; stands for the column and the number 1 for the row. It is important that the &amp;#039;&amp;#039;&amp;#039;name&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;position&amp;#039;&amp;#039;&amp;#039; of a cell are not confused because row counting for names begins with 1 but the counting for position begins with 0.&lt;br /&gt;
&lt;br /&gt;
In {{OOo}}, a table cell can be empty or contain text, numbers, or formulas. The cell type is not determined by the content that is saved in the cell, but rather the object property which was used for its entry. Numbers can be inserted and called up with the &amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; property, text with the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; property, and formulas with the &amp;lt;tt&amp;gt;Formula&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object   &lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.Value = 100&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 1)&lt;br /&gt;
Cell.String = &amp;quot;Test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 2)&lt;br /&gt;
Cell.Formula = &amp;quot;=A1&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example inserts one number, one text, and one formula in the fields A1 to A3.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Formula&amp;lt;/tt&amp;gt; properties supersede the &amp;lt;tt&amp;gt;PutCell&amp;lt;/tt&amp;gt; method for setting the values of a table cell.}}&lt;br /&gt;
&lt;br /&gt;
{{OOo}} treats cell content that is entered using the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; property as text, even if the content is a number. Numbers are left-aligned in the cell instead of right-aligned. You should also note the difference between text and numbers when you use formulas:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.Value = 100&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 1)&lt;br /&gt;
Cell.String = 1000&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 2)&lt;br /&gt;
Cell.Formula = &amp;quot;=A1+A2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
MsgBox Cell.Value &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although cell A1 contains the value 100 and cell A2 contains the value 1000, the A1+A2 formula returns the value 100. This is because the contents of cell A2 were entered as a string and not as a number.&lt;br /&gt;
&lt;br /&gt;
To check if the contents of a cell contains a number or a string, use the &amp;lt;tt&amp;gt;Type&amp;lt;/tt&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Select Case Cell.Type &lt;br /&gt;
Case com.sun.star.table.CellContentType.EMPTY &lt;br /&gt;
   MsgBox &amp;quot;Content: Empty&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.VALUE&lt;br /&gt;
   MsgBox &amp;quot;Content: Value&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.TEXT&lt;br /&gt;
   MsgBox &amp;quot;Content: Text&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.FORMULA&lt;br /&gt;
   MsgBox &amp;quot;Content: Formula&amp;quot;&lt;br /&gt;
End Select&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Cell.Type&amp;lt;/tt&amp;gt; property returns a value for the &amp;lt;idl&amp;gt;com.sun.star.table.CellContentType&amp;lt;/idl&amp;gt; enumeration which identifies the contents type of a cell. The possible values are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;EMPTY&amp;lt;/tt&amp;gt;:no value&lt;br /&gt;
;&amp;lt;tt&amp;gt;VALUE&amp;lt;/tt&amp;gt;:number&lt;br /&gt;
;&amp;lt;tt&amp;gt;TEXT&amp;lt;/tt&amp;gt;:strings&lt;br /&gt;
;&amp;lt;tt&amp;gt;FORMULA&amp;lt;/tt&amp;gt;:formula&lt;br /&gt;
&lt;br /&gt;
== Inserting, Deleting, Copying and Moving Cells ==&lt;br /&gt;
&lt;br /&gt;
In addition to directly modifying cell content, {{OOo}} Calc also provides an interface that allows you to insert, delete, copy, or merge cells. The interface (&amp;lt;idl&amp;gt;com.sun.star.sheet.XRangeMovement&amp;lt;/idl&amp;gt;) is available through the spreadsheet object and provides four methods for modifying cell content.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;insertCell&amp;lt;/tt&amp;gt; method is used to insert cells into a sheet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
Sheet.insertCells(CellRangeAddress, com.sun.star.sheet.CellInsertMode.DOWN)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example inserts a cells range that is two rows by two columns in size into the second column and row (each bear the number 1) of the first sheet (number 0) in the spreadsheet. Any existing values in the specified cell range are moved below the range.&lt;br /&gt;
&lt;br /&gt;
To define the cell range that you want to insert, use the &amp;lt;idl&amp;gt;com.sun.star.table.CellRangeAddress&amp;lt;/idl&amp;gt; structure. The following values are included in this structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Sheet (short)&amp;lt;/tt&amp;gt;:number of the sheet (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;StartColumn (long)&amp;lt;/tt&amp;gt;:first column in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;StartRow (long)&amp;lt;/tt&amp;gt;:first row in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;EndColumn (long)&amp;lt;/tt&amp;gt;:final column in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;EndRow (long)&amp;lt;/tt&amp;gt;:final row in the cell range (numbering begins with 0).&lt;br /&gt;
&lt;br /&gt;
The completed &amp;lt;tt&amp;gt;CellRangeAddress&amp;lt;/tt&amp;gt; structure must be passed as the first parameter to the &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; method. The second parameter of &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; contains a value of the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellInsertMode&amp;lt;/idl&amp;gt; enumeration and defines what is to be done with the values that are located in front of the insert position. The &amp;lt;tt&amp;gt;CellInsertMode&amp;lt;/tt&amp;gt; enumeration recognizes the following values: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;NONE&amp;lt;/tt&amp;gt;:the current values remain in their present position.&lt;br /&gt;
;&amp;lt;tt&amp;gt;DOWN&amp;lt;/tt&amp;gt;:the cells at and under the insert position are moved downwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;RIGHT&amp;lt;/tt&amp;gt;:the cells at and to the right of the insert position are moved to the right. &lt;br /&gt;
;&amp;lt;tt&amp;gt;ROWS&amp;lt;/tt&amp;gt;:the rows after the insert position are moved downwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;COLUMNS&amp;lt;/tt&amp;gt;:the columns after the insert position are moved to the right.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt; method is the counterpart to the &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; method. This method deletes the range that is defined in the &amp;lt;tt&amp;gt;CellRangeAddress&amp;lt;/tt&amp;gt; structure from the sheet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
Sheet.removeRange(CellRangeAddress, com.sun.star.sheet.CellDeleteMode.UP)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example removes the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; cell range from the sheet and then shifts the underlying cells up by two rows. The type of removal is defined by one of the following values from the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellDeleteMode&amp;lt;/idl&amp;gt; enumeration:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;NONE&amp;lt;/tt&amp;gt;:the current values remain in their current position.&lt;br /&gt;
;&amp;lt;tt&amp;gt;UP&amp;lt;/tt&amp;gt;:the cells at and below the insert position are moved upwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;LEFT&amp;lt;/tt&amp;gt;:the cells at and to the right of the insert position are moved to the left.&lt;br /&gt;
;&amp;lt;tt&amp;gt;ROWS&amp;lt;/tt&amp;gt;:the rows after the insert position are moved upwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;COLUMNS&amp;lt;/tt&amp;gt;:the columns after the insert position are moved to the left.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;XRangeMovement&amp;lt;/tt&amp;gt; interface provides two additional methods for moving (&amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt;) or copying (&amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt;) cell ranges. The following example moves the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; range so that the range starts at position &amp;lt;tt&amp;gt;A6&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
Dim CellAddress As New com.sun.star.table.CellAddress&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
CellAddress.Sheet = 0&lt;br /&gt;
CellAddress.Column = 0&lt;br /&gt;
CellAddress.Row = 5&lt;br /&gt;
&lt;br /&gt;
Sheet.moveRange(CellAddress, CellRangeAddress)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the &amp;lt;tt&amp;gt;CellRangeAdress&amp;lt;/tt&amp;gt; structure, the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method expects a &amp;lt;idl&amp;gt;com.sun.star.table.CellAddress&amp;lt;/idl&amp;gt; structure to define the origin of the move&amp;#039;s target region. The &amp;lt;tt&amp;gt;CellAddress&amp;lt;/tt&amp;gt; method provides the following values:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Sheet (short)&amp;lt;/tt&amp;gt;:number of the spreadsheet (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;Column (long)&amp;lt;/tt&amp;gt;:number of the addressed column (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;Row (long)&amp;lt;/tt&amp;gt;:number of the addressed row (numbering begins with 0).&lt;br /&gt;
&lt;br /&gt;
The cell contents in the target range are always overwritten by the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method. Unlike in the &amp;lt;tt&amp;gt;InsertCells&amp;lt;/tt&amp;gt; method , a parameter for performing automatic moves is not provided in the &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; method functions in the same way as the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method, except that &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; inserts a copy of the cell range instead of moving it.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|In terms of their function, the {{OOo}} Basic &amp;lt;tt&amp;gt;insertCell&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; methods are comparable with the VBA &amp;lt;tt&amp;gt;Range.Insert&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Range.Delete&amp;lt;/tt&amp;gt; ,and &amp;lt;tt&amp;gt;Range.Copy&amp;lt;/tt&amp;gt; methods. Whereas in VBA, the methods are applied to the corresponding &amp;lt;tt&amp;gt;Range&amp;lt;/tt&amp;gt; object, in {{OOo}} Basic they are applied to the associated &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt; object.}}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Cells and Ranges}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Cells_and_Ranges&amp;diff=124576</id>
		<title>Documentation/BASIC Guide/Cells and Ranges</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Cells_and_Ranges&amp;diff=124576"/>
		<updated>2009-05-10T03:01:18Z</updated>

		<summary type="html">&lt;p&gt;Norrin: /* Addressing and Editing Individual Cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Rows and Columns&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Formatting Spreadsheet Documents&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Cells and Ranges}}&lt;br /&gt;
 &lt;br /&gt;
A spreadsheet consists of a two-dimensional list containing cells. Each cell is defined by its X and Y-position with respect to the top left cell which has the position (0,0).&lt;br /&gt;
&lt;br /&gt;
== Addressing and Editing Individual Cells ==&lt;br /&gt;
&lt;br /&gt;
The following example creates an object that references the top left cell and inserts a text in the cell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object   &lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.String = &amp;quot;Test&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In addition to numerical coordinates, each cell in a sheet has a name, for example, the top left cell (0,0) of a spreadsheet is called &amp;lt;tt&amp;gt;A1&amp;lt;/tt&amp;gt;. The letter &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; stands for the column and the number 1 for the row. It is important that the &amp;#039;&amp;#039;&amp;#039;name&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;position&amp;#039;&amp;#039;&amp;#039; of a cell are not confused because row counting for names begins with 1 but the counting for position begins with 0.&lt;br /&gt;
&lt;br /&gt;
In {{OOo}}, a table cell can be empty or contain text, numbers, or formulas. The cell type is not determined by the content that is saved in the cell, but rather the object property which was used for its entry. Numbers can be inserted and called up with the &amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; property, text with the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; property, and formulas with the &amp;lt;tt&amp;gt;Formula&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object   &lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.Value = 100&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 1)&lt;br /&gt;
Cell.String = &amp;quot;Test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 2)&lt;br /&gt;
Cell.Formula = &amp;quot;=A1&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example inserts one number, one text, and one formula in the fields A1 to A3.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The &amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Formula&amp;lt;/tt&amp;gt; properties supersede the &amp;lt;tt&amp;gt;PutCell&amp;lt;/tt&amp;gt; method for setting the values of a table cell.}}&lt;br /&gt;
&lt;br /&gt;
{{OOo}} treats cell content that is entered using the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; property as text, even if the content is a number. Numbers are left-aligned in the cell instead of right-aligned. You should also note the difference between text and numbers when you use formulas:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 0)&lt;br /&gt;
Cell.Value = 100&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 1)&lt;br /&gt;
Cell.String = 1000&lt;br /&gt;
&lt;br /&gt;
Cell = Sheet.getCellByPosition(0, 2)&lt;br /&gt;
Cell.Formula = &amp;quot;=A1+A2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
MsgBox Cell.Value &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although cell A1 contains the value 100 and cell A2 contains the value 1000, the A1+A2 formula returns the value 100. This is because the contents of cell A2 were entered as a string and not as a number.&lt;br /&gt;
&lt;br /&gt;
To check if the contents of a cell contains a number or a string, use the &amp;lt;tt&amp;gt;Type&amp;lt;/tt&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Cell As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
Cell = Sheet.getCellByPosition(1,1)&lt;br /&gt;
&lt;br /&gt;
Cell.Value = 1000&lt;br /&gt;
&lt;br /&gt;
Select Case Cell.Type &lt;br /&gt;
Case com.sun.star.table.CellContentType.EMPTY &lt;br /&gt;
   MsgBox &amp;quot;Content: Empty&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.VALUE&lt;br /&gt;
   MsgBox &amp;quot;Content: Value&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.TEXT&lt;br /&gt;
   MsgBox &amp;quot;Content: Text&amp;quot;&lt;br /&gt;
Case com.sun.star.table.CellContentType.FORMULA&lt;br /&gt;
   MsgBox &amp;quot;Content: Formula&amp;quot;&lt;br /&gt;
End Select&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Cell.Type&amp;lt;/tt&amp;gt; property returns a value for the &amp;lt;idl&amp;gt;com.sun.star.table.CellContentType&amp;lt;/idl&amp;gt; enumeration which identifies the contents type of a cell. The possible values are:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;EMPTY&amp;lt;/tt&amp;gt;:no value&lt;br /&gt;
;&amp;lt;tt&amp;gt;VALUE&amp;lt;/tt&amp;gt;:number&lt;br /&gt;
;&amp;lt;tt&amp;gt;TEXT&amp;lt;/tt&amp;gt;:strings&lt;br /&gt;
;&amp;lt;tt&amp;gt;FORMULA&amp;lt;/tt&amp;gt;:formula&lt;br /&gt;
&lt;br /&gt;
== Inserting, Deleting, Copying and Moving Cells ==&lt;br /&gt;
&lt;br /&gt;
In addition to directly modifying cell content, {{OOo}} Calc also provides an interface that allows you to insert, delete, copy, or merge cells. The interface (&amp;lt;idl&amp;gt;com.sun.star.sheet.XRangeMovement&amp;lt;/idl&amp;gt;) is available through the spreadsheet object and provides four methods for modifying cell content.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;insertCell&amp;lt;/tt&amp;gt; method is used to insert cells into a sheet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
Sheet.insertCells(CellRangeAddress, com.sun.star.sheet.CellInsertMode.DOWN)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example inserts a cells range that is two rows by two columns in size into the second column and row (each bear the number 1) of the first sheet (number 0) in the spreadsheet. Any existing values in the specified cell range are moved below the range.&lt;br /&gt;
&lt;br /&gt;
To define the cell range that you want to insert, use the &amp;lt;idl&amp;gt;com.sun.star.table.CellRangeAddress&amp;lt;/idl&amp;gt; structure. The following values are included in this structure:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Sheet (short)&amp;lt;/tt&amp;gt;:number of the sheet (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;StartColumn (long)&amp;lt;/tt&amp;gt;:first column in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;StartRow (long)&amp;lt;/tt&amp;gt;:first row in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;EndColumn (long)&amp;lt;/tt&amp;gt;:final column in the cell range (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;EndRow (long)&amp;lt;/tt&amp;gt;:final row in the cell range (numbering begins with 0).&lt;br /&gt;
&lt;br /&gt;
The completed &amp;lt;tt&amp;gt;CellRangeAddress&amp;lt;/tt&amp;gt; structure must be passed as the first parameter to the &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; method. The second parameter of &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; contains a value of the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellInsertMode&amp;lt;/idl&amp;gt; enumeration and defines what is to be done with the values that are located in front of the insert position. The &amp;lt;tt&amp;gt;CellInsertMode&amp;lt;/tt&amp;gt; enumeration recognizes the following values: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;NONE&amp;lt;/tt&amp;gt;:the current values remain in their present position.&lt;br /&gt;
;&amp;lt;tt&amp;gt;DOWN&amp;lt;/tt&amp;gt;:the cells at and under the insert position are moved downwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;RIGHT&amp;lt;/tt&amp;gt;:the cells at and to the right of the insert position are moved to the right. &lt;br /&gt;
;&amp;lt;tt&amp;gt;ROWS&amp;lt;/tt&amp;gt;:the rows after the insert position are moved downwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;COLUMNS&amp;lt;/tt&amp;gt;:the columns after the insert position are moved to the right.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt; method is the counterpart to the &amp;lt;tt&amp;gt;insertCells&amp;lt;/tt&amp;gt; method. This method deletes the range that is defined in the &amp;lt;tt&amp;gt;CellRangeAddress&amp;lt;/tt&amp;gt; structure from the sheet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
Sheet.removeRange(CellRangeAddress, com.sun.star.sheet.CellDeleteMode.UP)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example removes the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; cell range from the sheet and then shifts the underlying cells up by two rows. The type of removal is defined by one of the following values from the &amp;lt;idl&amp;gt;com.sun.star.sheet.CellDeleteMode&amp;lt;/idl&amp;gt; enumeration:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;NONE&amp;lt;/tt&amp;gt;:the current values remain in their current position.&lt;br /&gt;
;&amp;lt;tt&amp;gt;UP&amp;lt;/tt&amp;gt;:the cells at and below the insert position are moved upwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;LEFT&amp;lt;/tt&amp;gt;:the cells at and to the right of the insert position are moved to the left.&lt;br /&gt;
;&amp;lt;tt&amp;gt;ROWS&amp;lt;/tt&amp;gt;:the rows after the insert position are moved upwards.&lt;br /&gt;
;&amp;lt;tt&amp;gt;COLUMNS&amp;lt;/tt&amp;gt;:the columns after the insert position are moved to the left.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;XRangeMovement&amp;lt;/tt&amp;gt; interface provides two additional methods for moving (&amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt;) or copying (&amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt;) cell ranges. The following example moves the &amp;lt;tt&amp;gt;B2:C3&amp;lt;/tt&amp;gt; range so that the range starts at position &amp;lt;tt&amp;gt;A6&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress&lt;br /&gt;
Dim CellAddress As New com.sun.star.table.CellAddress&lt;br /&gt;
&lt;br /&gt;
Doc = StarDesktop.CurrentComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
CellRangeAddress.Sheet = 0&lt;br /&gt;
CellRangeAddress.StartColumn = 1&lt;br /&gt;
CellRangeAddress.StartRow = 1&lt;br /&gt;
CellRangeAddress.EndColumn = 2&lt;br /&gt;
CellRangeAddress.EndRow = 2&lt;br /&gt;
&lt;br /&gt;
CellAddress.Sheet = 0&lt;br /&gt;
CellAddress.Column = 0&lt;br /&gt;
CellAddress.Row = 5&lt;br /&gt;
&lt;br /&gt;
Sheet.moveRange(CellAddress, CellRangeAddress)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the &amp;lt;tt&amp;gt;CellRangeAdress&amp;lt;/tt&amp;gt; structure, the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method expects a &amp;lt;idl&amp;gt;com.sun.star.table.CellAddress&amp;lt;/idl&amp;gt; structure to define the origin of the move&amp;#039;s target region. The &amp;lt;tt&amp;gt;CellAddress&amp;lt;/tt&amp;gt; method provides the following values:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Sheet (short)&amp;lt;/tt&amp;gt;:number of the spreadsheet (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;Column (long)&amp;lt;/tt&amp;gt;:number of the addressed column (numbering begins with 0).&lt;br /&gt;
;&amp;lt;tt&amp;gt;Row (long)&amp;lt;/tt&amp;gt;:number of the addressed row (numbering begins with 0).&lt;br /&gt;
&lt;br /&gt;
The cell contents in the target range are always overwritten by the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method. Unlike in the &amp;lt;tt&amp;gt;InsertCells&amp;lt;/tt&amp;gt; method , a parameter for performing automatic moves is not provided in the &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; method functions in the same way as the &amp;lt;tt&amp;gt;moveRange&amp;lt;/tt&amp;gt; method, except that &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; inserts a copy of the cell range instead of moving it.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|In terms of their function, the {{OOo}} Basic &amp;lt;tt&amp;gt;insertCell&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;removeRange&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;copyRange&amp;lt;/tt&amp;gt; methods are comparable with the VBA &amp;lt;tt&amp;gt;Range.Insert&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Range.Delete&amp;lt;/tt&amp;gt; ,and &amp;lt;tt&amp;gt;Range.Copy&amp;lt;/tt&amp;gt; methods. Whereas in VBA, the methods are applied to the corresponding &amp;lt;tt&amp;gt;Range&amp;lt;/tt&amp;gt; object, in {{OOo}} Basic they are applied to the associated &amp;lt;tt&amp;gt;Sheet&amp;lt;/tt&amp;gt; object.}}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Cells and Ranges}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Norrin</name></author>
	</entry>
</feed>