Hi Experts,
I have a requirement to generate excel in which background color is required.
I have tried following code:
cell = null;
cell = cells.get_Item(currentRow, 1);
style = cell.style;
var fill = style.Fill;
var patternType = fill.PatternType;
patternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
var backgroundColor = fill.BackgroundColor;
backgroundColor.SetColor(System.Drawing.Color::FromArgb(190, 0, 0));
I am using OfficeOpenXml;
But am getting bellow error:
Can't set color when patterntype is not set.
I have also tried using patternType = ExcelFillStyle::Solid but received same error.