B4J Question jPOI issue setting individual cell color

shhammer5634

Member
Licensed User
Longtime User
Using jPOI to create a simple 4 column spreadsheet. The fourth column needs to have it's color set based on some information pulled from a database. I am able to pull the data and create the spreadsheet. But when I go to set the color of the cell in column 4, it ends up setting the color the same on the whole row.

Sample of the code I'm using to set the cell color below:

DataRow is defined as PoiRow
Cells are created with DataRow.CreateCellString

B4X:
            DataRow.GetCell(3).CellStyle.ForegroundColor = fx.Colors.Red

Additional experimentation shows that whatever the last color set for any cell in the row is, the whole row becomes that color.

I just want to set the color in that one cell in each row. Can anyone point me in the right direction?

Thanks,
Steve
 

shhammer5634

Member
Licensed User
Longtime User
I was able to answer my own question. Each cell was set with the same predefined style. Changing the color of one cell changed the color of all cells with the same predefined style. I created a new duplicate style under a different name for the single cell. Now changing the color for that cell only changes the color for that cell and not the whole row.
 
Upvote 0
Top