Cell Background Color
New DiscussionI’m creating an Excel workbook from scratch in a web application. I’m using the Workbook and Worksheet classes. My goal is to make every other row with an alternating background color so that the spreadsheet can be read.
I’ve tried using the following code:
…
Worksheet pipelineWorksheet = workbook.Worksheets[0];
if (rowIndex % 2 == 0)
{
pipelineWorksheet.GetCell(“A” + rowIndex).CellFormat.FillPatternBackgroundColor = System.Drawing.Color.Cornsilk;
}
This gives me alternating rows, but all of the background colors are black! I want to accomplish the same effect as if I opened Excel, selected a cell, and used the fill command on the background color. How should I be doing this?
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
3 Created On
Jun 16, 2011 Last Post
14 years, 8 months ago