Difference between revisions of "Documentation/DevGuide/Spreadsheets/Custom Functions"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Added Java syntax highlight)
m
 
Line 11: Line 11:
 
The <code>getIncremented()</code> function from the example interface above can be implemented like this:  
 
The <code>getIncremented()</code> function from the example interface above can be implemented like this:  
 
<!--[SOURCE:Spreadsheet/ExampleAddIn.java]-->
 
<!--[SOURCE:Spreadsheet/ExampleAddIn.java]-->
<source lang="java">
+
<syntaxhighlight lang="java">
 
   public int getIncremented( int nValue ) {
 
   public int getIncremented( int nValue ) {
 
       return nValue + 1;
 
       return nValue + 1;
   }</source>
+
   }</syntaxhighlight>
  
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]]
 
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]]

Latest revision as of 13:53, 20 December 2020



The user-visible functions have to be implemented as defined in the interface. The spreadsheet application does the necessary conversions to pass the arguments. For example, floating point numbers are rounded if a function has integer arguments. To enable the application to find the functions, it is important that the component implements the com.sun.star.lang.XTypeProvider interface.

The getIncremented() function from the example interface above can be implemented like this:

  public int getIncremented( int nValue ) {
      return nValue + 1;
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages