Reputation: 65
I need to mark error cells in my output excel file in red. If in the original document those cells have no fill, all is fine, the color is red. But if the cell was already filled with Blue (or some kind of), in the output it become filled with pink, but not with red! Here is my code:
var cell = worksheet.Cells[row, column];
cell.Reset();
cell.Value = string.Format("{0} Error:{1}", cell.Value, errortext);
cell.Style.Fill.BackgroundColor.SetColor(Color.Empty);
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Style.Fill.BackgroundColor.SetColor(Color.Red);
cell.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 0, 0));
This is how it should look:
This is how it is if the original fill was blue:
Will be very appreciated for any help.
Upvotes: 1
Views: 1413