Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Created Unassigned: Rgb values are wrong [13965]

$
0
0
With XSSF, if I try to copy the CellStyle of a cell of a second sheet of a .xlxs file, the copied values are not correct: FillForegroundColor, FillForegroundColorColor and FillForegroundXSSFColor have the wrong rgb values (become 255 instead of 192), it is wrong the value of the color that is 0 instead of 22 also.
If I convert the files in xls and I read with HSSF the same cells by the same method, the values are correct.
I enclose two pictures with the values that come back to me and I copy part of the code.
I tried with 2.2.1 and 2.1.3.1 versions.

```
XSSFWorkbook wb;
XSSFSheet sh;
XSSFSheet shStyle;

using (var fs = new FileStream("style.xlsx", FileMode.Open, FileAccess.Read))
{
wb = new XSSFWorkbook(fs);
}

sh = (XSSFSheet)wb.GetSheet(wb.GetSheetAt(0).SheetName);
shStyle = (XSSFSheet)wb.GetSheet(wb.GetSheetAt(1).SheetName);

HSSFWorkbook wbo;
HSSFSheet sho;
HSSFSheet shStyleo;

using (var fso = new FileStream("style.xls", FileMode.Open, FileAccess.Read))
{
wbo = new HSSFWorkbook(fso);
}

sho = (HSSFSheet)wbo.GetSheet(wbo.GetSheetAt(0).SheetName);
shStyleo = (HSSFSheet)wbo.GetSheet(wbo.GetSheetAt(1).SheetName);

ICellStyle StyleXlsx = shStyle.GetRow(2).GetCell(0).CellStyle;
ICellStyle StyleXls = shStyleo.GetRow(2).GetCell(0).CellStyle;

```

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>