This project has moved. For the latest updates, please go here.

Multiple Fill Options

Feb 16, 2016 at 12:07 AM
I'm trying to set a cell's background to solid, light gray, and the pattern to light up, black.
The following code gives a black background, with light gray stripes.

ws1.Cells["A7:E9"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
ws1.Cells["A7:E9"].Style.Fill.PatternColor.SetColor(Color.LightGray);
ws1.Cells["A7:E9"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.LightUp;
ws1.Cells["A7:E9"].Style.Fill.PatternColor.SetColor(Color.Black);

I can't seem to find the combination that gives me the correct output.
Can anyone help?
Feb 16, 2016 at 4:00 PM
I've got it to work, but I'm pretty sure there is a bug somewhere.
This is the code that works:
        ws1.Cells["A7:E9"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.LightUp;
        ws1.Cells["A7:E9"].Style.Fill.PatternColor.SetColor(Color.LightGray);
        ws1.Cells["A7:E9"].Style.Fill.BackgroundColor.SetColor(Color.Black);
The pattern (the diagonal lines) are black, and the cell background is light gray.
This is what I want, but the code sure seems backwards.