4

I am writing custom functions in LibreOffice Calc. Such functions must be called in Calc as if they were native functions,

e.g. as EDATE(), DAYS() etc.

Upto now what I am doing for each custom function is:

  1. Define a Python function
  2. Define a StarBasic function which invokes its Python correspondant
  3. Call StarBasic function from Calc.

It works, but it is quite impractical to write each function in two languages.

My question is: is it possible to write such kind of functions directly in Python ? Do you have any reference to share ?

1 Answer 1

4

A Calc add-in is a complete solution, with features such as tooltip popups that Basic user-defined functions cannot provide.

This requires more effort than writing a Basic-Python bridge call. However, since you are writing many functions, it might not be too much extra work, because all of them can be put into a single .oxt file.

An example of the required files is in my answer at https://ask.libreoffice.org/en/question/133794/how-to-use-develop-addins-in-calc/?answer=133870#post-id-133870.

Other examples and documentation:

If you try it and need help, edit the question. Or post something on ask.libreoffice.org, which allows attachments as long as you have at least a small amount of reputation.

Sign up to request clarification or add additional context in comments.

2 Comments

It's absolutely ridiculous how complicated that is to just add custom Python formula to Calc. Nothing changed this this reply
The initial steps are complex, but once you get it working, it's powerful and relatively easy to add advanced features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.