The screenshot shows a scenario for a dataset exported by Epplus to a fresh Excel file (file type *.xlsx).
In this scenario, I'd like to apply the "Bad" Style in the Excel Style Gallery to Cell E1. How could I do this programatically in Epplus?
I have looked through the instructional documents I was able to find, here and here. I have not yet found an example showing how to apply an Excel style from the Style Gallery to an Excel Range.
Here is what I have so far.
private void FormatDataTable(ExcelWorksheet worksheet)
{
if(RowCount==0)
{
// How do I apply the "Bad" style to this range?
var range = worksheet.Cells["E1"];
}
}
As far as I know it's no way. But always exists way around
var cell = worksheet.Cells["E1"];
cell.Style.Font.Name = "Calibri";
cell.Style.Font.Size = 11;
cell.Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#ffc7ce"));
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Font.Color.SetColor(ColorTranslator.FromHtml("#be0006"));
This should make the trick.