Using SCFunctionAccess::callFunction from Python
Sebastian Henschel
sebastian.henschel at passiv.de
Fri Mar 7 07:37:15 UTC 2025
Hey Noel et al!
Am 06.03.25 um 15:17 schrieb Noel Grandin:
> On 3/6/2025 11:45 AM, Sebastian Henschel wrote:
>>
>> Using the UNO bridge via Python seems to work, but loading the Excel
>> file takes about 25s which is unacceptable to be run on each web request.
>
> My first though, would be o load the Excel file once, via LibreOffice,
> when your Django server starts up.
> And then have each web-request-call talk to that shared instance of
> LibreOffice via the Python UNO API.
>
> Then it would also be able to modify the contents of the Excel file.
Thanks for your reply. Alas, each of dozens of users would need to have
their own instance of the document (possibly multiple) to modify
contents and have them recalculated by LibreOffice.
I will check the documentation if the once loaded document can be
duplicated and measure how long it will take in a single-user situation.
>> The hope is that SCFunctionAccess::callFunction (from core/sc/source/
>> ui/unoobj/funcuno.cxx) can do that for me.
>> To be able to use that from Python, i could wrap it using
>> boost::python or swig. Does anyone have experience with wrapping
>> LibreOffice functions?
>
> That would be pretty difficult, all of the LibreOffice code assumes that
> you loaded a document via the normal load process.
> Calling them without having first established that context is going to
> be rough.
Indeed. Maybe somebody did this with another part of LibreOffice, not
necessarily SCFunctionAccess::callFunction, so i can learn from there?
Cheers,
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20250307/80432862/attachment.sig>
More information about the LibreOffice
mailing list