libreoffice-basic

Changing cell background color in LibreOffice

核能气质少年 提交于 2019-12-01 22:23:22
问题 I am using LibreOffice 3.5.4.2. I would like to change the background color of cells based on various conditions. As a minimal example, I have the following macro/function defined: function bgcolor() Dim Doc As Object Dim Sheet As Object Dim Cell As Object Doc = ThisComponent Sheet = Doc.Sheets(1) Cell = Sheet.getCellByPosition(0, 0) REM Cell.CellBackColor = RGB(50,60,70) bgcolor=Cell.CellBackColor end function I execute the function by entering =BGCOLOR() into a cell. The cell in which that

How to use LibreOffice functions into Basic?

夙愿已清 提交于 2019-12-01 21:38:17
I've asked here about the good way to do so. Now I'm trying the following code found here , and get some unexpected errors. I suppose I'm not using it the correct way. Any idea ? Sub Main Dim aResult Dim aFunc Dim oRange aFunc = GetProcessServiceManager().createInstance("com.sun.star.sheet.FunctionAccess") aResult = aFunc.callFunction("SUM", Array(1, 2, 3)) ' ---- Works OK Print aResult aResult = aFunc.callFunction("MDETERM", Array(2, 5, 8)) ' ---- IllegalArgumentException Print aResult oRange = ThisComponent.sheets(0).getcellrangebyname("B4:B6") aResult = aFunc.callFunction("ZTEST", Array