I’ve been looking all over for this and asking here is pretty much my last resort.
I want to make a macro that can modify (specifically the cell background color, or changing the text) of all selected cells, but in a Writer table, not a Calc spreadsheet. That’s it, really, but I can only find information about the later, so I am at a total loss of what to do to modify table cells, or rather, get some way to iterate through the selection. The few approaches I’ve seen only work for Calc spreadsheet cells, or don’t work at all (OpenOffice?).
I’m at a total loss about this, I’m not even sure if it can be done or not.
I don’t really care about the specifics to accomplish this task (using LO Basic or Python or anything, can handle everything except altering LO directly).
I’ve tried snippets such as
Sub ColorizeTable Dim oCurrentSelection As Variant Dim oRows As Variant Const nCellBackColor = 15132415 REM # "Blue gray" Dim i As Long
oCurrentSelection = ThisComponent.getCurrentSelection()
If oCurrentSelection.supportsService("com.sun.star.table.CellRange") Then
oRows = oCurrentSelection.getRows()
For i = 0 To oRows.getCount()-1 Step 2
oRows.getByIndex(i).setPropertyValue("BackColor", nCellBackColor)
Next i
EndIf
End Sub
but while it’s the only one that doesn’t throw an error, it doesn’t seem to do anything.