GLIBREPYLOT is an LibreOffice/OpenOffice extension project which aims to allow one to easily script Spreadsheets with Python, by embedding Python scripts into the spreadsheets themselves
The contents of tha package should be zipped in a file with the "oxt" extension - that file is then installed as a LibreOffice Extension using the "tools->extension manager" option.
NB: one can't format line breaks inside formula cells, so it is not possible to create a multi-line script inside the "pyexec" formula - it should instead refer to another text cell containing the script.
For the script, one can use all normal UNO Api's, but there is a SpreadSheet object wrapped in an "S" global variable, which points to the current spreadsheet in a more pythonic way than the UNO Apis - for example, using
S[0]["B2"] = "some text"
will set "some text" as the text in the B2 cell on the first Sheet of the current document. Sheets can be indexed with a pair of numbers - so S[0]["a1"] and S[0][0,0] both refer to the same cell.
Python snippets in a cell can import and use any module available for the Python3 install in use by LibreOffice - on Linux systems, that is usually all system-wide packages. Under Windows one should make intended packages available to the Python install that comes along LibreOffice/OpenOffice
Download the OXT file available at https://github.com/jsbueno/librepylot/releases/latest , inside LibreOffice Calc, use tools->Manage Extensions->Add, select the file, and restart L.O. . The two new formulas will be available.
It is also important to disable smart-quote substitution while trying to tyoe _any_ Python code (Tools->AutoCorrect->Localized Options, uncheck "Single Quotes" and "Double Quotes".
If you want to fiddle with the code, or install a development version, to create the OXT file, just zip all contents in a file with an "oxt" extension and add it as a libreOffice extension as described above.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。