How to identify the content type of an empty cell in a grid on the Dialog?

selectedValue of an empty cell in a grid on the Dialog doesn’t equal "" or blank but it looks like NULL. When I placed it in an occupied cell in Calc, the previous string in such cell in Calc didn’t disappear.
How can I check if it is "", blank or NULL ?

@lonk - Hello,
.
Tested with a previous grid to sheet question sample we dealt with.
.
All grid items are strings. Then I check the selected item in the Grid control and compare to " it is True. Also when Placing in a cell in the Calc sheet, it does replace the data previously there.

1 Like

Thank you. Those cells were locked. I wrote a function to unlock cells in order to place the data and lock after finish.

LockOffActiveSheet
selectedValue 	= gGrid(oEvt.Source.CurrentRow + 1, tr + 1)
oSelectedCell 	= oSheet.getCellByPosition(nColumn, nRow + tr)
oSelectedCell.setString(selectedValue)
LockOnActiveSheet

It works now.

But I wondered why locked cells can be placed data into them at the first time before I added this code.

LockOffActiveSheet
.
.
.
LockOnActiveSheet

Check the .Type property for any given cell object:
TheType = oCell.Type
Where TheType is a com.sun.star.table.ContentType.XXX value, with XXX being of any of the following:

  • EMPTY : this is an empty cell (blank)
  • TEXT : this is a string (incl. “”)
  • VALUE : this a numerical value
  • FORMULA : the contents is the result of a formula calculation
1 Like