I write LibreOffice Basic function to search a cell satisfying specific conditions. As a result of the search I get an object cell
of type cell.ImplementationName = ScCellObj
. How do I convert that to a human readable string (e.g. "$mysheet.AX927"
) which can be used in formulas?
Surely, I can write my own function
Sub GetCellAddressString(cell as object) as string
dim cell_address
dim sheet_str
dim column_str
dim row_str
cell_address = cell.getCellAddress()
sheet_str = MaybeQuoteSheetName(cell.getSpreadsheet().getName())
column_str = ComputeColumnName(cell_address.Column)
row_str = Format(cell_address.Row + 1, "#")
GetCellAddressString = "$" & sheet_str & "." & column_str & row_str
End Sub
And write MaybeQuoteSheetName
and ComputeColumnName
, but there should be a simpler (build-in) way to get cell and column names, right?