Case com.sun.star.table.CellContentType.EMPTY
Which I got from:
https://wiki.openoffice.org/wiki/Docume ... and_Ranges
I've tried a bunch of different stuff but now think my approach may just be fundamentally inefficient. The specific error is:
BASIC runtime error.
Property or method not found: getCellByPosition.
I am trying to define the edges of a box of characters surrounded by empty cells. Then I want to record the xy coords of the characters that contain a string value in a separate section of the spread sheet and ignore the ones that contain an integer. The box is made of X's and 0's with 0's bordering the outside edges of the box.
Here is the full code:
Code: Select all
REM ***** BASIC *****
Sub Main
End Sub
sub MRecordTest1
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim xmaxx as INTEGER
dim xinit as INTEGER
dim x as INTEGER
dim y as INTEGER
dim ymaxx as INTEGER
dim yinit as INTEGER
dim Cell as Object
xinit = 3
yinit = 8
y=yinit
xmaxx=100
ymaxx=100
For x = xinit to xmaxx
Cell = document.getCellByPosition(x,y)
Select Case Cell.Type
Case com.sun.star.table.CellContentType.EMPTY
xmaxx = x-1
x = xmaxx
End Select
Next x
For y = yinit to ymaxx
Cell = document.getCellByPosition(x,y)
Select Case Cell.Type
Case com.sun.star.table.CellContentType.EMPTY
ymaxx = y-1
y = ymaxx
End Select
Next y
y=yinit
dim xr as INTEGER
dim yr as INTEGER
xr=28
yr=35
for y = yinit to ymaxx
For x = xinit to xmaxx
rem //Select Case Cell.Type
rem //Case com.sun.star.table.CellContentType.VALUE
rem //End Select
Select Case Cell.Type
Case com.sun.star.table.CellContentType.TEXT
xCell = xRange.getCellByPosition(xr, yr)
xCell.setValue(x)
xCell = xRange.getCellByPosition(xr+1, yr)
xCell.setValue(y)
yr=yr+1
End Select
Next x
Next y
end sub