0

I am developing a Java Application.

In my Application, I used Excel which is created by manually (WPS spread sheet tool in Ubuntu Machine) and gave style like Color, Bold and Italic.

Using POI, I can find all the styles but could not find the Color.

Sample Code:-

XSSFCell cell = row.getCell(j);  // j is loop iterate value
XSSFColor color = cell.getCellStyle().getFillBackgroundColorColor();

From the above code, I got only Null values from the all Cell and I was check with this link enter link description here but no useful.

Please help me to solve this issues.

Venkat Raj
  • 219
  • 3
  • 18
  • check this. https://stackoverflow.com/a/17247773/6497884 – jonggu Mar 23 '18 at 03:21
  • @jonggu: I tried, but i am getting the value of 64 from all the Excel Cell. – Venkat Raj Mar 23 '18 at 03:25
  • 1
    I think you have to convert color id to color. https://stackoverflow.com/a/20835582/6497884 – jonggu Mar 23 '18 at 03:32
  • Here, the "palette" (palette.getColor(colorIdx)) means what from the link. – Venkat Raj Mar 23 '18 at 03:51
  • Have you tried `XSSFColor color = cell.getCellStyle().getFillForegroundColorColor();`? `Excel`s cell interior fills are pattern fills where fill background color is the color **behind** the pattern and fill foreground color is the color of the pattern and default pattern is solid fill. So fill foreground color will be visible in cells interior. – Axel Richter Mar 23 '18 at 07:11
  • @Axel Richter: Yeah, I tried but i got null values from all the Cell. – Venkat Raj Mar 23 '18 at 10:00
  • What `apache poi` version are you using? Because there were bugs fixed related to cell fill up to current last stable version 3.17. – Axel Richter Mar 23 '18 at 10:31
  • @AxelRichter: Oh okay, let me try with latest version bcoz now I am using POI version 3.9 only. – Venkat Raj Mar 23 '18 at 10:37

0 Answers0