You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@KBA696, hi!
I've researched the issue and didn't find any issues with the fill pattern. It seems you didn't specify fill foreground color. Check this code:
using (var book = new XSSFWorkbook())
{
var sheet = book.CreateSheet("Sheet1");
var row = sheet.CreateRow(0);
var cell = row.CreateCell(0);
var style = book.CreateCellStyle();
style.FillPattern = FillPattern.AltBars;
style.FillForegroundColor = IndexedColors.Black.Index;
cell.CellStyle = style;
var cell2 = row.CreateCell(1);
var style2 = book.CreateCellStyle();
style2.FillPattern = FillPattern.LessDots;
style2.FillForegroundColor = IndexedColors.Black.Index;
cell2.CellStyle = style2;
using (var ms = new MemoryStream())
{
book.Write(ms);
File.WriteAllBytes("test.xlsx", ms.ToArray());
}
}
I double-checked on a clean project and everything works.
it was necessary to record a video((
The screenshots were with this code:
using (var book = new XSSFWorkbook())
{
var sheet = book.CreateSheet("Sheet1");
var row = sheet.CreateRow(0);
for (int i = 0; i <= 18; i++)
{
var cell = row.CreateCell(i);
var style = book.CreateCellStyle();
style.FillPattern = (FillPattern)i;
cell.CellStyle = style;
}
using (var ms = new MemoryStream())
{
book.Write(ms);
System.IO.File.WriteAllBytes("test.xlsx", ms.ToArray());
}
@Bykiev Спасибо большое да проблема была именно в style2.FillForegroundColor = IndexedColors.Black.Index;
с этой записью все заливки работают, а без AltBars и LessDots становятся одинаковыми
@Bykiev Thank you very much yes the problem was exactly in style2.FillForegroundColor = IndexedColors.Black.Index;
with this entry, all fills work, but without AltBars and LessDots become the same
NPOI 2.6.2
XL (.xlsx)
https://skrinshoter.ru/sLt6gZWNK5p?a
missing https://skrinshoter.ru/sLtQEXWgEjf?a
The text was updated successfully, but these errors were encountered: