Hello,
Thanks for sharing more information!
I did notice that the "CharacterFormat.Font" has been removed in our dlls of .NET 5.0 and .NET6.0. Actually, we are planing to gradually deprecate and remove this method in the future release products since each time it is called, this method consumes too much memory and affects performance.
We have changed the article on our website, and please refer to the following code to achieve the same effect with another way.
- Code: Select all
ExcelFont excelFont = workbook.CreateFont();
excelFont.FontName = (item as Spire.Doc.Fields.TextRange).CharacterFormat.FontName;
excelFont.Size = (item as Spire.Doc.Fields.TextRange).CharacterFormat.FontSize;
excelFont.IsBold = (item as Spire.Doc.Fields.TextRange).CharacterFormat.Bold;
excelFont.IsItalic = (item as Spire.Doc.Fields.TextRange).CharacterFormat.Italic;
excelFont.Underline = (FontUnderlineType)(item as Spire.Doc.Fields.TextRange).CharacterFormat.UnderlineStyle; excelFont.Color = (item as Spire.Doc.Fields.TextRange).CharacterFormat.TextColor;
workbook.Worksheets[0].Range["A4"].RichText.SetFont(i, i, excelFont);
Thanks for your understanding.
Sincerely,
Marcia
E-iceblue support team