Character and Paragraph Format
From Apache OpenOffice Wiki
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). |