Spire.XLS for .NET 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.

Tue Jan 08, 2019 7:17 am

Hi Support,

I am trying to change all text to italic but it is not working.
Please help :)

Here is my code:
Code: Select all
excel.LoadFromStream(stream, Spire.Xls.ExcelVersion.Version2007);

                            foreach (Worksheet ws in excel.Worksheets)
                            {
                                foreach (CellRange cr in ws.Cells)
                                {
                                    cr.Style.Font.IsItalic = true;
                                }
                            }
Attachments
excel.zip
(7.41 KiB) Downloaded 80 times

nkeung
 
Posts: 19
Joined: Fri Sep 07, 2018 8:36 am

Tue Jan 08, 2019 7:55 am

Hi,

Thank you for your inquiry.
After an initial test with the latest hotfix Spire.Office (DLL Only) Version:3.12.4, I could get the correct result.
Below is my testing code and attache is the result file.
Code: Select all
 string input = @"D:\test\excel.xls";
 MemoryStream inputMs = new MemoryStream(File.ReadAllBytes(input));
 Workbook excel = new Workbook();
 excel.LoadFromStream(inputMs, Spire.Xls.ExcelVersion.Version97to2003);

 foreach (Worksheet ws in excel.Worksheets)
 {
     foreach (CellRange cr in ws.Cells)
     {
         cr.Style.Font.IsItalic = true;
     }
 }
 excel.SaveToFile("italic.xls",ExcelVersion.Version97to2003);

If the issue still exists after using the latest hotfix, please write back and share the result file on your end.
Sincerely,
Jane
E-iceblue support team
Attachments
italic.zip
(3.05 KiB) Downloaded 75 times
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Jan 09, 2019 6:17 am

Jane.

Thanks. It works now.

Regards,
Kevin

nkeung
 
Posts: 19
Joined: Fri Sep 07, 2018 8:36 am

Wed Jan 09, 2019 6:56 am

Hi Kevin,

Glad to hear that!
Feel free to contact us if you need any assistance in the future! :)

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS