1 Star 0 Fork 0

shunix/librepylot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
README 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
Joao S O Bueno 提交于 2020-07-09 23:23 +08:00 . Rname, improve install instructions
===============
librepylot
===============
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.
At this point, two new formulae will be available in libreoffice calc:
"pyeval" which can receive a string and evaluate a single Python expression
and "pyexec" - which evaluates a string as a python program -
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
INSTALL
========
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.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shunix/librepylot.git
git@gitee.com:shunix/librepylot.git
shunix
librepylot
librepylot
master

搜索帮助