პროგრამირებისთვის დამატება LibreOffice Calc-ში

გავრთხილების ხატულა

The method of extending Calc by Add-Ins that is described in the following is outdated. The interfaces are still valid and supported, to ensure compatibility with existing Add-Ins, but for programming new Add-Ins you should use the new API functions.


LibreOffice Calc can be expanded by Add-Ins, which are external programming modules providing additional functions for working with spreadsheets. These are listed in the Function Wizard in the Add-In category. If you would like to program an Add-In yourself, you can learn here which functions must be exported by the so that the Add-In can be successfully attached.

LibreOffice searches the Add-in folder defined in the configuration for a suitable . To be recognized by LibreOffice, the must have certain properties, as explained in the following. This information allows you to program your own Add-In for Function Wizard of LibreOffice Calc.

დამატება

Each Add-In library provides several functions. Some functions are used for administrative purposes. You can choose almost any name for your own functions. However, they must also follow certain rules regarding parameter passing. The exact naming and calling conventions vary for different platforms.

ფუნქციები

At a minimum, the administrative functions GetFunctionCount and GetFunctionData must exist. Using these, the functions as well as parameter types and return values can be determined. As return values, the Double and String types are supported. As parameters, additionally the cell areas Double Array, String Array, and Cell Array are supported.

Parameters are passed using references. Therefore, a change of these values is basically possible. However, this is not supported in LibreOffice Calc because it does not make sense within spreadsheets.

Libraries can be reloaded during runtime and their contents can be analyzed by the administrative functions. For each function, information is available about count and type of parameters, internal and external function names and an administrative number.

The functions are called synchronously and return their results immediately. Real time functions (asynchronous functions) are also possible; however, they are not explained in detail because of their complexity.

საერთო ინფორმაცია ინტერფეისის შესახებ

The maximum number of parameters in an Add-In function attached to LibreOffice Calc is 16: one return value and a maximum of 15 function input parameters.

მონაცემთა ტიპები განსაზღვრულია შემდეგით:

მონაცემების ტიპები

განსაზღვრა

CALLTYPE

Windows-ში: FAR PASCAL (_far _pascal)

სხვა: ნაგულისხმევი (ოპერაციული სისტემის ნაგულისხმევი)

USHORT

2 ბაიტი მიუნიჭებელი მთელი რიცხვი

DOUBLE

8 ბაიტიან პლათფორმაზე დამოკიდებული ფორმატი

პარამეტრის ტიპი

int-ის მსგავსი პლათფორმაზე დამოკიდებული

PTR_DOUBLE =0 pointer to a double

PTR_STRING =1 pointer to a zero-terminated string

PTR_DOUBLE_ARR =2 pointer to a double array

PTR_STRING_ARR =3 pointer to a string array

PTR_CELL_ARR =4 pointer to a cell array

NONE =5


ფუნქციები

Following you will find a description of those functions, which are called at the .

ფუნქციები

void CALLTYPE fn(out, in1, in2, ...)

გამონატანი: შედეგის მნიშვნელობა

Input: Any number of types (double&, char*, double*, char**, Cell area), where the Cell area is an array of types double array, string array, or cell array.

GetFunctionCount()

Returns the number of functions without the management functions of the reference parameter. Each function has a unique number between 0 and nCount-1. This number will be needed for the GetFunctionData and GetParameterDescription functions later.

სინტაქსი

void CALLTYPE GetFunctionCount(USHORT& nCount)

პარამეტრი

USHORT &nCount:

გამონატანი მითითება -სკენ a ტოლია -სკენ შეიცავს რიცხვი - დამატება -თვის მაგალითი დამატება შეიცავს -თვის გამოთვლა.

GetFunctionData()

ყველა მნიშვნელოვანი ინფორმაცია დამატება.

სინტაქსი

CALLTYPE USHORT char USHORT პარამეტრის ტიპი char

პარამეტრი

USHORT& nNo:

შეყვანა ფუნქცია რიცხვი არის შორის და.

char* pFuncName:

Output: Function name as seen by the programmer, as it is named in the . This name does not determine the name used in the Function Wizard.

USHORT& nParamCount:

Output: Number of parameters in AddIn function. This number must be greater than 0, because there is always a result value; the maximum value is 16.

პარამეტრის ტიპი* peType:

Output: Pointer to an array of exactly 16 variables of type Paramtype. The first nParamCount entries are filled with the suitable type of parameter.

char* pInternalName:

გამონატანი: ფუნქციის სახელი როგორც ამას მომხნმარებელი ხედავს, როგორც ეს ფუნქციათა ოსტატში ჩანს. შეიძლება შეიცავდეს უმლაუტებს.

The pFuncName and pInternalName parameters are char arrays, which are implemented with size 256 in LibreOffice Calc.

GetParameterDescription()

Provides a brief description of the Add-In function and its parameters. As an option, this function can be used to show a function and parameter description in the Function Wizard.

სინტაქსი

void CALLTYPE GetParameterDescription(USHORT& nNo, USHORT& nParam, char* pName, char* pDesc)

პარამეტრი

USHORT& nNo:

შეყვანა ნომერი - დუ არის შორის და.

USHORT& nParam:

Input: Indicates, for which parameter the description is provided; parameters start at 1. If nParam is 0, the description itself is supposed to be provided in pDesc; in this case, pName does not have any meaning.

char* pName:

გამონატანი მაღლა სახელი ან ტიპი -თვის მაგალითი ნომერი ან სტრიქონი ან თარიღი და ჩართულია დუ გამოთვლა char.

char* pDesc:

Output: Takes up the description of the parameter, for example, "Value, at which the universe is to be calculated." Implemented in LibreOffice Calc as char[256].

pName and pDesc are char arrays; implemented in LibreOffice Calc with size 256. Please note that the space available in the Function Wizard is limited and that the 256 characters cannot be fully used.

უჯრების არეები

The following tables contain information about which data structures must be provided by an external program module in order to pass cell areas. LibreOffice Calc distinguishes between three different arrays, depending on the data type.

ორმაგი მასივი

a a არე - ნომერი ორმაგი ტიპი A double დუ გამოთვლა ტოლია:

შერევა

სახელი

აღწერა

0

სვეტი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

2

რიგი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

4

ჩანართი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

6

სვეტი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

8

რიგი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

10

ჩანართი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

12

თვლა

Number of the following elements. Empty cells are not counted or passed.

14

სვეტი

ელემენტის სვეტის ნომერი. ნუმერაცია იწყება 0-ით.

16

რიგი

ელემენტის რიგის ნომერი. ნუმერაცია იწყება 0-ით.

18

ჩანართი

ელემენტის ცხრილის ნომერი. ნუმერაცია იწყება 0-ით.

20

შეცდომა

Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.

22

მნიშვნელობა

8 byte IEEE variable of type double/floating point

30

...

შემდეგი ელემენტი


სტრიქონის მასივი

A არე შეიცავს - ტიპი ტექსტი და ტოლია a სტრიქონი A სტრიქონი დუ გამოთვლა ტოლია:

შერევა

სახელი

აღწერა

0

სვეტი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

2

რიგი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

4

ჩანართი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

6

სვეტი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

8

რიგი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

10

ჩანართი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

12

თვლა

Number of the following elements. Empty cells are not counted or passed.

14

სვეტი

ელემენტის სვეტის ნომერი. ნუმერაცია იწყება 0-ით.

16

რიგი

ელემენტის რიგის ნომერი. ნუმერაცია იწყება 0-ით.

18

ჩანართი

ელემენტის ცხრილის ნომერი. ნუმერაცია იწყება 0-ით.

20

შეცდომა

Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.

22

Len

Length of the following string, including closing zero byte. If the length including closing zero byte equals an odd value a second zero byte is added to the string so that an even value is achieved. Therefore, Len is calculated using ((StrLen+2)&~1).

24

სტრიქონი

სტრიქონი დამხურავი ნულოვანი ბაიტით

24+Len

...

შემდეგი ელემენტი


უჯრების მასივი

Cell arrays are used to call cell areas containing text as well as numbers. A cell array in LibreOffice Calc is defined as follows:

შერევა

სახელი

აღწერა

0

სვეტი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

2

რიგი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

4

ჩანართი1

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

6

სვეტი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

8

რიგი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

10

ჩანართი2

ტექსტი რიცხვი დუ მარცხნივ - არე ეთ.

12

თვლა

Number of the following elements. Empty cells are not counted or passed.

14

სვეტი

ელემენტის სვეტის ნომერი. ნუმერაცია იწყება 0-ით.

16

რიგი

ელემენტის რიგის ნომერი. ნუმერაცია იწყება 0-ით.

18

ჩანართი

ელემენტის ცხრილის ნომერი. ნუმერაცია იწყება 0-ით.

20

შეცდომა

Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.

22

ტიპი

უჯრის შიგთავსის ტიპი - ორმაგი სტრიქონი

24

მნიშვნელობა ან Len

If type == 0: 8 byte IEEE variable of type double/floating point

If type == 1: Length of the following string, including closing zero byte. If the length including closing zero byte equals an odd value a second zero byte is added to the string so that an even value is achieved. Therefore, Len is calculated using ((StrLen+2)&~1).

26 თუ ტიპი==1

სტრიქონი

თუ ტიპი == 1. სტრიქონი დამხურავი ნულოვანი ბაიტით

32 ან26+Len

...

შემდეგი ელემენტი