Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Mon Jul 19, 2021 3:55 am

Hi support team. I have a problem to solve with your lib. When we upload this sample file and save it under a folder with the file name XXX. It keeps the original file. This is ok. But when I need to read the XXX file again under folder. I don't know a way to read properties like the color of the text and the corresponding backgound of each cell and col. I need those colors to properly display this original excel file as HTML. Tks
Attachments
filesampleAndOutput.rar
(19.23 KiB) Downloaded 197 times

Thanhdev98
 
Posts: 5
Joined: Tue Jul 06, 2021 8:25 am

Mon Jul 19, 2021 7:22 am

Hello,

Thanks for your inquiry.
You can refer to the following code to get text color and background color of cells. If you have any other questions about our products, just feel free to contact us.

Code: Select all
                   
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("DataSample.xlsx");
            Worksheet sheet = workbook.Worksheets[0];
            //Traverse all used cells
            foreach (CellRange range in sheet.Cells)
            {
                //Get background color of this cell
                Color backgroundColor = range.Style.Color;
                //Get text color of this cell
                Color textColor = range.Style.Font.Color;
            }
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 128
Joined: Mon Mar 29, 2021 3:03 am

Tue Aug 03, 2021 10:04 am

Hello,

Hope you are doing well.
Has your issue been resolved now? Could you please give us some feedback at your convenience. Thanks in advance.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 128
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.XLS