I was programming this LibreOffice project: GitHub - Kazhuu/movelister: LibreOffice Calc based program with Python macros for generating tables and sheets for detailed video game character mechanics notes and I’m wondering how to create new cell style in Python using pyuno. So far I’ve followed this example: Overall Document Features - Apache OpenOffice Wiki. From that example cell style is made with call:
Object aCellStyle = xServiceManager.createInstance(“com.sun.star.style.CellStyle”);
Which is then inserted with name to the style family. Now because of Python I’ve followed this guide to write macros in python: Transfer from Basic to Python - Apache OpenOffice Wiki. It says I should write following:
smgr.createInstanceWithContext(“com.sun.star.style.CellStyle”, ctx) or smgr.createInstance(“com.sun.star.style.CellStyle”)
But the problem is that both calls return None for me. I also have tried using:
uno.createUnoStruct(‘com.sun.star.sheet.CellStyle’) but this one raises exception:
uno.com.sun.star.uno.RuntimeException: pyuno.getClass: uno exception com.sun.star.sheet.TableCellStyle is unknown
Is creating styles supported by Python macros and pyuno or am I missing something?