Difference between revisions of "Documentation/DevGuide/Spreadsheets/Cell Annotations"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
m (FINAL VERSION FOR L10N)
(3 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
|NextPage=Documentation/DevGuide/Spreadsheets/Cell Ranges and Cells Container
 
|NextPage=Documentation/DevGuide/Spreadsheets/Cell Ranges and Cells Container
 
}}
 
}}
{{DISPLAYTITLE:Cell Annotations}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Spreadsheets/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Cell Annotations}}
 
<idltopic>com.sun.star.sheet.CellAnnotation;com.sun.star.sheet.XSheetAnnotation;com.sun.star.sheet.XSheetAnnotationAnchor</idltopic>
 
<idltopic>com.sun.star.sheet.CellAnnotation;com.sun.star.sheet.XSheetAnnotation;com.sun.star.sheet.XSheetAnnotationAnchor</idltopic>
 
A spreadsheet cell may contain one annotation that consists of simple unformatted Text.
 
A spreadsheet cell may contain one annotation that consists of simple unformatted Text.
Line 56: Line 57:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Spreadsheet Documents]]
+
 
 +
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]]

Revision as of 10:25, 14 May 2009



A spreadsheet cell may contain one annotation that consists of simple unformatted Text.

Cell annotations

This service com.sun.star.sheet.CellAnnotation represents an annotation. It implements interfaces to manipulate the contents and access the source cell.

It is possible to access the annotations through a container object from the spreadsheet or directly from a cell object.

The service com.sun.star.sheet.CellAnnotations represents the collection of annotations for the spreadsheet and implements two interfaces to access the annotations.

The following example inserts an annotation and makes it permanently visible.

 public void doAnnotationSample(
         com.sun.star.sheet.XSpreadsheet xSheet,
         int nColumn, int nRow ) throws RuntimeException, Exception {
     // create the CellAddress struct
     com.sun.star.table.XCell xCell = xSheet.getCellByPosition(nColumn, nRow);
     com.sun.star.sheet.XCellAddressable xCellAddr = (com.sun.star.sheet.XCellAddressable)
         UnoRuntime.queryInterface(com.sun.star.sheet.XCellAddressable.class, xCell);
     com.sun.star.table.CellAddress aAddress = xCellAddr.getCellAddress();
   
     // insert an annotation
     com.sun.star.sheet.XSheetAnnotationsSupplier xAnnotationsSupp =
         (com.sun.star.sheet.XSheetAnnotationsSupplier) UnoRuntime.queryInterface(
             com.sun.star.sheet.XSheetAnnotationsSupplier.class, xSheet);
     com.sun.star.sheet.XSheetAnnotations xAnnotations = xAnnotationsSupp.getAnnotations();
     xAnnotations.insertNew(aAddress, "This is an annotation");
 
     // make the annotation visible
     com.sun.star.sheet.XSheetAnnotationAnchor xAnnotAnchor =
         (com.sun.star.sheet.XSheetAnnotationAnchor) UnoRuntime.queryInterface(
             com.sun.star.sheet.XSheetAnnotationAnchor.class, xCell);
     com.sun.star.sheet.XSheetAnnotation xAnnotation = xAnnotAnchor.getAnnotation();
     xAnnotation.setIsVisible(true);
 }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages