This project has moved and is read-only. For the latest updates, please go here.

Exporting worksheet data to Datatable along with the style attributes

Aug 18, 2013 at 5:04 PM
Edited Aug 18, 2013 at 5:05 PM
Hi,

I am trying to use EPPLUS to create datatable from excel sheet & display on the webpage.
But I want to display the style attributes as well For e.g border, background color etc.

For the background color I am using something like the below:
                        var backgroundcolor = currentCell.Style.Fill.BackgroundColor.Rgb;
                        string style = "";
                        if (!string.IsNullOrEmpty(backgroundcolor))
                        {
                            style = "bgcolor=#" +
                                    backgroundcolor.Substring(2, backgroundcolor.Length - 2);
                        }
It works for the standard colors but not the custom colors.
For borders again there I will have to try getting the style for left, right, bottom & top.

Is there any easy way to copy the styles from OpenRowXml styles to css styles that I can apply to the table column