diff options
Diffstat (limited to 'helpcontent2/source/text/scalc/guide/userdefined_function.xhp')
-rwxr-xr-x | helpcontent2/source/text/scalc/guide/userdefined_function.xhp | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/helpcontent2/source/text/scalc/guide/userdefined_function.xhp b/helpcontent2/source/text/scalc/guide/userdefined_function.xhp new file mode 100755 index 0000000000..14c26ea7a5 --- /dev/null +++ b/helpcontent2/source/text/scalc/guide/userdefined_function.xhp @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--*********************************************************************** + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************-->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="textscalcguideuserdefined_functionxml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">User-Defined Functions</title>
+<filename>/text/scalc/guide/userdefined_function.xhp</filename>
+</topic>
+<history>
+<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
+<lastedited date="2004-06-22T13:45:58">FPE: Deleted Screenshot and cleaned up
+yj - checked</lastedited>
+</history>
+</meta>
+<body> +<bookmark xml-lang="en-US" branch="index" id="bm_id3155411"><bookmark_value>functions; user-defined</bookmark_value>
+<bookmark_value>user-defined functions</bookmark_value>
+<bookmark_value>Basic IDE; applying</bookmark_value>
+<bookmark_value>IDE; Basic IDE</bookmark_value> +</bookmark>
+<paragraph role="heading" id="hd_id3155411" xml-lang="en-US" level="1" l10n="U" oldref="1"><variable id="userdefined_function"><link href="text/scalc/guide/userdefined_function.xhp" name="Defining Functions Yourself">User-Defined Functions</link> +</variable></paragraph>
+<paragraph role="paragraph" id="par_id3153969" xml-lang="en-US" l10n="U" oldref="2">You can apply user-defined functions in $[officename] Calc in the following ways:</paragraph>
+<list type="unordered">
+<listitem>
+<paragraph role="listitem" id="par_id3153768" xml-lang="en-US" l10n="CHG" oldref="3">You can program functions as <link href="text/scalc/01/04060111.xhp" name="add-ins">add-ins</link>. This method requires an advanced knowledge of programming.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3145366" xml-lang="en-US" l10n="CHG" oldref="4">You can define your own functions using the Basic-IDE. This method only requires a basic knowledge of programming.</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id3149260" xml-lang="en-US" level="2" l10n="CHG" oldref="6">Defining A Function Using %PRODUCTNAME Basic</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="listitem" id="par_id3148456" xml-lang="en-US" l10n="U" oldref="7">Choose <item type="menuitem">Tools - Macros - Macro</item>. </paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3154510" xml-lang="en-US" l10n="U" oldref="8">Click the <emph>Edit</emph> button. You will now see the Basic IDE.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3150327" xml-lang="en-US" l10n="CHG" oldref="9">Enter the function code. In this example, we define a <item type="literal">VOL(a; b; c)</item> function that calculates the volume of a rectangular solid with side lengths <item type="literal">a</item>, <item type="literal">b</item> and <item type="literal">c</item>:</paragraph>
+<paragraph role="code" id="par_id9797426" xml-lang="en-US" l10n="NEW" localize="false">Function VOL(a, b, c)<br/>VOL = a*b*c<br/>End Function</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3155443" xml-lang="en-US" l10n="U" oldref="10">Close the Basic-IDE window.</paragraph>
+<paragraph role="listitem" id="par_id3150043" xml-lang="en-US" l10n="CHG" oldref="11">Your function is automatically saved in the default module and is now available. If you apply the function in a Calc document that is to be used on another computer, you can copy the function to the Calc document as described in the next section.</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id3147340" xml-lang="en-US" level="2" l10n="U" oldref="18">Copying a Function To a Document</paragraph>
+<paragraph role="paragraph" id="par_id3145232" xml-lang="en-US" l10n="U" oldref="19">In stage 2 of "Defining a user-defined function in Basic-IDE", in the <emph>Macro</emph> dialog you clicked on <emph>Edit </emph>. As the default, in the <emph>Macro from</emph> field the <emph>soffice - Default - Module1</emph> module is selected. The default module resides locally in your user directory.</paragraph>
+<paragraph role="paragraph" id="par_id3154022" xml-lang="en-US" l10n="U" oldref="20">If you want to copy the user-defined function to a Calc document:</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="listitem" id="par_id3150304" xml-lang="en-US" l10n="U" oldref="21">Choose <item type="menuitem">Tools - Macros - Macro</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3150086" xml-lang="en-US" l10n="U" oldref="22">In the <emph>Macro from</emph> field select <emph>soffice - Default - Module1</emph> and click <emph>Edit</emph>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3166430" xml-lang="en-US" l10n="CHG" oldref="23">In the Basic-IDE, select the source of your user-defined function and copy it to the clipboard.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_idN1081D" xml-lang="en-US" l10n="NEW">Close the Basic-IDE.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3150517" xml-lang="en-US" l10n="U" oldref="24">Choose <item type="menuitem">Tools - Macros - Macro</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3145384" xml-lang="en-US" l10n="U" oldref="25">In the <emph>Macro from</emph> field select <emph>(Name of the Calc document)- Default - Module1</emph>. Click <emph>Edit</emph>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3148699" xml-lang="en-US" l10n="U" oldref="26">Paste the clipboard contents in the Basic-IDE of the document.</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id3153305" xml-lang="en-US" level="2" l10n="U" oldref="12">Applying a User-defined Function in $[officename] Calc</paragraph>
+<paragraph role="paragraph" id="par_id3148869" xml-lang="en-US" l10n="CHG" oldref="13">Once you have defined the function <item type="literal">VOL(a; b; c)</item> in the Basic-IDE, you can apply it in exactly the same way as the built-in functions of $[officename] Calc.</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="listitem" id="par_id3148606" xml-lang="en-US" l10n="CHG" oldref="14">Open a $[officename] Calc document and enter numbers for the function parameters <item type="literal">a</item>, <item type="literal">b</item>, and <item type="literal">c</item> in cells.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3156019" xml-lang="en-US" l10n="CHG" oldref="15">Set the cursor in another cell and enter the following:</paragraph>
+<paragraph role="code" id="par_id3155264" xml-lang="en-US" l10n="U" oldref="16">=VOL(A1;B1;C1)</paragraph>
+<paragraph role="listitem" id="par_idN10890" xml-lang="en-US" l10n="NEW">where <item type="literal">A1</item>, <item type="literal">B1</item>, and <item type="literal">C1</item> correspond to the cells with the values for <item type="literal">a</item>, <item type="literal">b</item>, and <item type="literal">c</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="listitem" id="par_id3146776" xml-lang="en-US" l10n="CHG" oldref="17">The function is evaluated and you will see the result in the selected cell.</paragraph>
+</listitem>
+</list>
+</body>
+</helpdocument>
|