Android Question Excel Library, How to set cell background color?

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

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?
 

incendio

Well-Known Member
Licensed User
Longtime User
The cell that has background color is a dynamic cell, it could occurs at any row, depend on data to display. So I couldn't use template file.
 
Upvote 0
Top