excel -> table

27 views
Skip to first unread message

KvdW

unread,
Jun 16, 2009, 9:15:39 AM6/16/09
to excellibrary
Hi,
I'm trying to get an excel sheet into a table (ASP.NET 2.0, C#).
The value is no problem, but how do I do I get the cell formatting
(font, background collor, border etc).
I see the word comming back in the seperate CS-files, bu I cannot
figure out how to do it (My bad!).

Can anyone provide me with some sample-code.

for (int row = 1; row <= maxRowIndex; row++)
{
TR = new TableRow();

for (int col = 0; col <= maxColIndex; col++)
{
TD = new TableCell();

Cell WorkCell = new Cell(sheet.Cells[row, col]);
TD.Text = workcell.StringValue.Trim();

//This is where I could use some help
TD.Style.Add("Font-Family", ????);
TD.Style.Add("Font-Size", ???);
TD.BackColor = System.Drawing.Color.FromArgb(????);
Etc.

TR.Cells.Add(TD);
}
Table1.Rows.Add(TR);
}

Thanks,
KvdW

Reply all
Reply to author
Forward
0 new messages