From ce079ee2ec1dcdb38eebdefd1323c4e0d4a8591f Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 7 Nov 2019 10:25:33 -0300 Subject: [PATCH] Housekeeping page on Calc custom functions + Proper code formatting + proper menu path with MAC option + refactor some tags Change-Id: Ib54ade5fd1db56e27e67e4bcc1f7808cddb07341 Reviewed-on: https://gerrit.libreoffice.org/82215 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- .../text/scalc/guide/userdefined_function.xhp | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/source/text/scalc/guide/userdefined_function.xhp b/source/text/scalc/guide/userdefined_function.xhp index 6edae964a5..c842a08095 100644 --- a/source/text/scalc/guide/userdefined_function.xhp +++ b/source/text/scalc/guide/userdefined_function.xhp @@ -1,6 +1,4 @@ - - - @@ -36,8 +33,8 @@ IDE; Basic IDE programming;functions -User-Defined Functions - +

User-Defined Functions +

You can apply user-defined functions in $[officename] Calc in the following ways: @@ -47,29 +44,35 @@ You can program functions as add-ins. This method requires an advanced knowledge of programming. -Defining A Function Using %PRODUCTNAME Basic +

Defining A Function Using %PRODUCTNAME Basic

-Choose Tools - Macros - Organize Macros - %PRODUCTNAME Basic. + Choose %PRODUCTNAME - PreferencesTools - Options - %PRODUCTNAME Basic. Click the Edit button. You will now see the Basic IDE. -Enter the function code. In this example, we define a VOL(a; b; c) function that calculates the volume of a rectangular solid with side lengths a, b and c: -Function VOL(a, b, c)
VOL = a*b*c
End Function
+Enter the function code. In this example, we define a VOL(a; b; c) function that calculates the volume of a rectangular solid with side lengths a, b and c:
+
+ + Function VOL(a, b, c) + VOL = a*b*c + End Function + + Close the Basic-IDE window. 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. -Copying a Function To a Document +

Copying a Function To a Document

In stage 2 of "Defining A Function Using %PRODUCTNAME Basic", in the Macro dialog you clicked on Edit . As the default, in the Macro from field the My Macros - Standard - Module1 module is selected. The Standard library resides locally in your user directory. If you want to copy the user-defined function to a Calc document: -Choose Tools - Macros - Organize Macros - %PRODUCTNAME Basic . + Choose %PRODUCTNAME - PreferencesTools - Options - %PRODUCTNAME Basic. In the Macro from field select My Macros - Standard - Module1 and click Edit. @@ -90,15 +93,15 @@ Paste the clipboard contents in the Basic-IDE of the document. -Applying a User-defined Function in $[officename] Calc -Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it the same way as the built-in functions of $[officename] Calc. +

Applying a User-defined Function in $[officename] Calc

+Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it the same way as the built-in functions of $[officename] Calc. -Open a Calc document and enter numbers for the function parameters a, b, and c in cells A1, B1, and C1. +Open a Calc document and enter numbers for the function parameters a, b and c in cells A1, B1, and C1. Set the cursor in another cell and enter the following: -=VOL(A1;B1;C1) +=VOL(A1;B1;C1) The function is evaluated and you will see the result in the selected cell.