I am trying to set cell background color with Excel library, but found a problem.
Here is my situation :
1) I have a text in cell A1 with value : This is Test
2) Cell width in A1 is smaller than its value, this won't be a problem if cell B1 is empty, value still display correctly
3) I want to set background color in cell B1 to color Grey. As far as I know the only thing to do this is with this code
B4X:
Private WS As WritableSheet
Private CF As WritableCellFormat
Private CL As WritableCell
CF.Initialize2(CF.FONT_ARIAL,11,True,False,False,CF.COLOR_WHITE)
CF.BackgroundColor = CF.COLOR_GREY_25_PERCENT
CL.InitializeText(1,1,"")
CL.SetCellFormat(CF)
WS.AddCell(CL)
The problem is, value in cell A1 is truncated.
Is there another way to set background color in a cell without needed to supply cell's value?
Sub CreateEmptyCell(Col As Int, Row As Int) As WritableCell
Dim jo As JavaObject
Return jo.InitializeNewInstance("jxl.biff.EmptyCell", Array (Col, Row))
End Sub
However it doesn't seem to do anything useful.
You can change the formatting in the template file.