Custom spreadsheet functions must be defined in an XML document conforming to (XMLmind proprietary) W3C XML Schema having http://www.xmlmind.com/xmleditor/schema/spreadsheet/functions
as its target namespace.
Example, myspreadsheetfunctions.xml
(found in
)XXE_install_dir
/doc/spreadsheet/custom_functions/
<?xml version="1.0" encoding="ISO-8859-1"?> <f:functions xmlns="http://www.w3.org/1999/xhtml" xmlns:ns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.xmlmind.com/xmleditor/schema/spreadsheet/functions"> <f:function> <f:name>factorial</f:name> <f:parameters>n</f:parameters> <f:category>Mathematical</f:category> <f:description> <body> <p>Returns the factorial of <i>n</i>.</p> </body> </f:description> <f:macro><![CDATA[= if(n = 1, 1, n*factorial(n-1))]]></f:macro> </f:function> </f:functions>
This XML document must be referenced in an XXE configuration file using configuration element spreadsheetFunctions
. See Section 24, “spreadsheetFunctions” in
If you add this to
(after copying XXE_user_preferences_dir
/addon/customize.xxemyspreadsheetfunctions.xml
to
):XXE_user_preferences_dir
/addon/
<spreadsheetFunctions location="myspreadsheetfunctions.xml" />
you'll be able to use custom function factorial()
whatever is the type of the document that you open in XXE. That is, function factorial()
and its documentation will always show up in the Formula Editor, just like sin()
or cos()
.
If you add this to an XXE configuration file which is specific to an XML application, for example
(after copying XXE_install_dir
/addon/config/docbook/docbook.xxemyspreadsheetfunctions.xml
to
):XXE_install_dir
/addon/config/docbook/
<spreadsheetFunctions location="myspreadsheetfunctions.xml" />
you'll be able to use custom function factorial()
only when you open a DocBook document.