Forum Stats

  • 3,825,247 Users
  • 2,260,486 Discussions


Java Excel automation cell background color repeating setFillForeground?

Akash Rajgure
Akash Rajgure Member Posts: 3

Hey all I have the code below that changes the background of a cell to either RED or GREEN. It seems that when I comment out the GREEN else code that my excel sheet has all red for each cell box in row 1. JAVA Likewise, if I do the opposite and comment out RED and un-comment GREEN then all the cells in row 1 are green.

I'm not understanding what in the code below is making it color all the cells the same color even though the first 2 cells should be RED while all the others should be GREEN. I already checked my logic and its going to the first IF 2 times and then the rest is going to the else so that's correct.