Difference between revisions of "Documentation/DevGuide/Spreadsheets/Character and Paragraph Format"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Spreadsheet Documents)
m (Robot: Changing Category:Documentation/Developers Guide/Spreadsheet Documents)
Line 53: Line 53:
 
{{PDL1}}
 
{{PDL1}}
  
[[Category:Documentation/Developers Guide/Spreadsheet Documents]]
+
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]]

Revision as of 10:22, 5 June 2008



The following services of a cell range contain properties for the character style and paragraph format:

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).
Personal tools