Bug 156916 - User-defined functions in kspread 2.x
Summary: User-defined functions in kspread 2.x
Status: RESOLVED UNMAINTAINED
Alias: None
Product: calligrasheets
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Calligra Sheets (KSpread) Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-29 14:59 UTC by Dan
Modified: 2024-08-19 08:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan 2008-01-29 14:59:18 UTC
Version:            (using KDE 3.5.5)
Installed from:    Gentoo Packages

Hi all.

I just realized (solving real problem with data manipulation in kspread and oocalc2) that it would be extremely usefull (and really unique feature!) to give users a possibility to design and implement their own functions, in a similar way as it is allowed for macros (scripts). However, whereas scripts must have the cells affected by processing hardcoded like "do something on those cells in this list" (at least MS Excel and oocalc macros have to, if I understand it well, and also kspread asks to fill such data before script executing), the user-defined function(s) would be applicable to individual cells, exactly like functions predefined (with all the nice manipulation possibilities), although "programmed" in python.

The idea is to have a "function designed" which would prepare function prototype - import the neccessary modules, prepare function header for given number of parameters, predefine some comments, and so on. After user fill the body of the function, it would be saved into (user-defined) script-holding directory and listen in function-chooser dialog. The KSpread would then call the function on each cell where it appears, filling it with parameters as set for the cell - i.e. user-defined parameters like MYFUNC(A1:A10;B2;$C$3) will be converted to objects representing given cells (or arrays/matrixes of cells) and passed to the function MYFUNC.

Other usefull properties:
- having cell objects goint in/out functions (not only the content of cells) would allow to access all the properties of the cells, which may use the functions really powerfull - can change not only content but colour, font and other properties as well.
- Comments (prefixed by special tags, e.g. oxygen-like) in functions could be used to generate help in function-chooser dialog
- if a user-defined function is used in a sheet, the function code should be included in the data file saved. What I don't know is if OpenDocument format allows it, or if it can he "hacked" into it without breaking the document when read by oocalc, for example.

I wish you as little problems during hacking as possible, keep going the gread work you are doing now!
Best regards,
Dan