Macros 如何在LibreOffice中使用宏和visual basic突出显示文本
我必须编写一个突出显示特定数字的宏(将背景色设置为黄色) 我已经写了一个宏,使用对象光标查找这些数字,但我不知道如何更改背景颜色Macros 如何在LibreOffice中使用宏和visual basic突出显示文本,macros,libreoffice,Macros,Libreoffice,我必须编写一个突出显示特定数字的宏(将背景色设置为黄色) 我已经写了一个宏,使用对象光标查找这些数字,但我不知道如何更改背景颜色 Dim Cursor As Object Dim Proceed As Boolean Cursor = ThisComponent.Text.createTextCursor() Cursor.gotoStart(False) Do Cursor.gotoEndOfWord(True) 'some If statements that chec
Dim Cursor As Object
Dim Proceed As Boolean
Cursor = ThisComponent.Text.createTextCursor()
Cursor.gotoStart(False)
Do
Cursor.gotoEndOfWord(True)
'some If statements that check if the number is correct
'Cursor.CharEmphasis = com.sun.star.text.FontEmphasis.DOT_BELOW
Proceed = Cursor.gotoNextWord(False)
Loop While Proceed
我发现了一个函数,它在文本下方用点强调文本。突出显示文本是否有类似的功能?以下代码将在从col1到col2以及从row1到row2的单元格范围内,在条目小于MY_MIN或大于MY_MAX的任何单元格中放置黄色背景
For I = col1 To col2
For J = row1 to row2
Cell = Sheet.getCellByPosition(I,J)
If Cell.Type <> com.sun.star.table.CellContentType.EMPTY Then
If Cell.Value < MY_MIN Or Cell.Value > MY_MAX Then
Cell.CellBackColor = RGB(200,200,0)
End If
End If
Next J
Next I
I=col1到col2的
对于J=第1行到第2行
单元格=表。getCellByPosition(I,J)
如果Cell.Type com.sun.star.table.CellContentType.EMPTY,则
如果Cell.ValueMY_MAX,则
Cell.CellBackColor=RGB(200200,0)
如果结束
如果结束
下一个J
接下来我
希望,这可以解决您的问题。您正在寻找:
oCursor.CharBackColor = RGB(255,255,0)