Re: Using SCFunctionAccess::callFunction from Python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello again!

Am 07.03.25 um 08:37 schrieb Sebastian Henschel:
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.

I have not found a method to conveniently duplicate or clone a document when skimming https://wiki.documentfoundation.org/Documentation/DevGuide/Office_Development#Handling_Documents or when inspecting the document object in Python.

So, i have implementeded a cloning mechanism around
`desktop.loadComponentFromURL('private:factory/scalc', '_blank', 0, ())`
which copies all sheets and from each sheet it copies the data arrays of used cell ranges (hope this description is not condensed too much). It still needs handling of named ranges and maybe other things.

This is much quicker than (re)loading the file, currently needing only 5s instead of 25s. Alas, it is still too slow to be run on a web request basis.

Does anybody know of a faster way how to duplicate a complete document in memory? I can post my testing code if you like (not the document, tho).

Cheers,
  Sebastian

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux