プログラム
フォルダーの作成
cd .config/libreoffice/4/user
mkdir -p Scripts/python
.config/libreoffice/4/user/Scripts/python/hello_world.py
import uno
def hello_world():
doc = XSCRIPTCONTEXT.getDocument()
cell = doc.Sheets[0]['A1']
cell.setString('12')
cell = doc.Sheets[0]['B2']
cell.setString('34')
cell = doc.Sheets[0]['C3']
cell.setString('56')
cell = doc.Sheets[0]['C4']
cell.setString('78')
cell = doc.Sheets[0]['C5']
cell.setString('910')
#
cell = doc.Sheets[0]['E1']
cell.setString('PythonからCalcでHello World Aug/2/2024')
return
実行
ツール -> マクロ -> マクロの管理 -> Python(A)
実行結果