使用者定義的函式
您可以經由下述的方式來使用 Collabora Office Calc 中自訂的函式:
-
您可以使用 Basic-IDE 定義自己的函式。這種方法需要您具備基本的程式設計知識。
-
您可將此函式程式設計為 Add-In。這種方法需要您具備豐富的程式設計知識。
使用 Collabora Office Basic 定義函式
-
Choose .
-
You will now see the Basic IDE.
-
In the Object Catalog window, double-click on the module where you want to store your macro.
-
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
-
關閉 Basic-IDE 視窗。
Your function is automatically saved in the selected 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.
將函式複製到文件
在「使用 Collabora Office Basic 定義函式」的第二步中,按一下 [巨集] 對話方塊中的 [編輯]。依預設,在 [巨集的來源] 欄位中已選取 [我的巨集] - [標準] - [模組1] 模組。[標準] 程式庫常駐於您的本機使用者目錄。
如果要將使用者自訂的函式複製到 Calc 文件中,請:
-
Choose .
-
在 [巨集的來源] 欄位選擇 [我的巨集] - [標準] - [模組1] 並按一下 [編輯]。
-
在 Basic-IDE 中,選取使用者自訂函式的來源,並將其複製到剪貼簿中。
-
關閉 Basic-IDE。
-
Choose .
-
在 [巨集的來源] 欄位選擇 (Calc 文件的名稱) - [標準] - [模組1]。按一下 [編輯]。
-
請您在文件的 Basic-IDE 插入剪貼簿的內容。
套用 Collabora Office 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 Collabora Office Calc.
-
Open a Calc document and enter numbers for the function parameters a, b and c in cells A1, B1, and C1.
-
將游標放在其他儲存格中並輸入下列內容:
=VOL(A1;B1;C1)
-
即可估算出此函式且在選取的儲存格中看到結果。