OpenOffice Basic 根据第 0 列中的文本更改范围的背景颜色

OpenOffice Basic 根据第 0 列中的文本更改范围的背景颜色

我正在尝试测试第 0 列“A”中的每个单元格,看它是否有特定的文本“预算”“生活”“储蓄”,如果有,则将行背景颜色更改为每个单元格的特定颜色。

我可以确定最后一行的文本,但无法测试列“A”。我已将我所能获得的代码附加到下面。

sub FindLastRow
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
dim oSheet
Dim oCell 
Dim x

rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$D$65536"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())

dim args7(1) as new com.sun.star.beans.PropertyValue
args7(0).Name = "By"
args7(0).Value = 1
args7(1).Name = "Sel"
args7(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoUpToStartOfData", "", 0, args7())
dim oActiveCell 
dim oConv
oActiveCell = ThisComponent.CurrentSelection
x = oActiveCell.getCellAddress().Row

print x

Cell.String = "a" & oActiveCell.getCellAddress().Row
Cell.string = "budget"

print Cell.string

if cell.string="Budget" then
print x
end if

相关内容