Spreadsheet Add-Ins

From Apache OpenOffice Wiki
Jump to: navigation, search
  • Spreadsheet Add-Ins



An add-in component is used to add new functions to the spreadsheet application that can be used in cell formulas, such as the built-in functions. A spreadsheet add-in is a UNO component. The chapter Writing UNO Components describes how to write and deploy a UNO component.

AddIn

The functions that the add-in component exports to the spreadsheet application have to be defined in a new interface. The function names in the interface, together with the component's service name, are used internally to identify an add-in function. For a list of the supported types for function arguments and return values, see the com.sun.star.sheet.AddIn service description. An example interface that defines two functions is similar to the following code:

  #include <com/sun/star/uno/XInterface.idl>
  #include <com/sun/star/sheet/XVolatileResult.idl>
 
  module com { module sun { module star { module sheet { module addin {
 
      interface XExampleAddIn : com::sun::star::uno::XInterface
      {
          /// Sample function that just increments a value.
          long getIncremented( [in] long nValue );
 
          /// Sample function that returns a volatile result.
          com::sun::star::sheet::XVolatileResult getCounter( [in] string aName );
      };
 
  }; }; }; }; };

In addition to this interface, the add-in has to implement the interfaces from the com.sun.star.sheet.AddIn service and the usual interfaces every component has to support.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages