Difference between revisions of "Documentation/DevGuide/Spreadsheets/Character and Paragraph Format"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (talk | contribs) m (FINAL VERSION FOR L10N) |
|||
| Line 18: | Line 18: | ||
This example formats a given cell range <code>xCellRange</code>: | This example formats a given cell range <code>xCellRange</code>: | ||
<!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | <!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | ||
| − | + | <syntaxhighlight lang="java"> | |
// --- Change cell range properties. --- | // --- Change cell range properties. --- | ||
com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet) | com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet) | ||
| Line 33: | Line 33: | ||
xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); | xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); | ||
xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF)); | xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF)); | ||
| − | + | </syntaxhighlight> | |
The code below changes the character and paragraph formatting of a cell. Assume that <code>xCell</code> is a <idl>com.sun.star.table.XCell</idl> interface of a spreadsheet cell. | The code below changes the character and paragraph formatting of a cell. Assume that <code>xCell</code> is a <idl>com.sun.star.table.XCell</idl> interface of a spreadsheet cell. | ||
<!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | <!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | ||
| − | + | <syntaxhighlight lang="java"> | |
// --- Change cell properties. --- | // --- Change cell properties. --- | ||
com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet) | com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet) | ||
| Line 51: | Line 51: | ||
xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); | xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); | ||
xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF)); | xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF)); | ||
| − | + | </syntaxhighlight> | |
{{PDL1}} | {{PDL1}} | ||
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]] | [[Category:Documentation/Developer's Guide/Spreadsheet Documents]] | ||
Latest revision as of 15:37, 3 January 2021
The following services of a cell range contain properties for the character style and paragraph format:
- Service com.sun.star.style.ParagraphProperties
- Service com.sun.star.style.CharacterProperties
- Service com.sun.star.style.CharacterPropertiesAsian
- Service com.sun.star.style.CharacterPropertiesComplex
The chapter Formatting contains a description of these properties.
This example formats a given cell range xCellRange:
// --- Change cell range properties. ---
com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xCellRange);
// from com.sun.star.styles.CharacterProperties
xPropSet.setPropertyValue("CharColor", new Integer(0x003399));
xPropSet.setPropertyValue("CharHeight", new Float(20.0));
// from com.sun.star.styles.ParagraphProperties
xPropSet.setPropertyValue("ParaLeftMargin", new Integer(500));
// from com.sun.star.table.CellProperties
xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false));
xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF));
The code below changes the character and paragraph formatting of a cell. Assume that xCell is a com.sun.star.table.XCell interface of a spreadsheet cell.
// --- Change cell properties. ---
com.sun.star.beans.XPropertySet xPropSet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xCell);
// from styles.CharacterProperties
xPropSet.setPropertyValue("CharColor", new Integer(0x003399));
xPropSet.setPropertyValue("CharHeight", new Float(20.0));
// from styles.ParagraphProperties
xPropSet.setPropertyValue("ParaLeftMargin", new Integer(500));
// from table.CellProperties
xPropSet.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false));
xPropSet.setPropertyValue("CellBackColor", new Integer(0x99CCFF));
| Content on this page is licensed under the Public Documentation License (PDL). |