Font Problems when displaying excel file using SfSpreadSheet

Hi,
     I'm using SfSpreadSheet to display excel files in my WPF application and it worked fine most times, while a few excel files are making troubles.  When I try to open them, the control crushed and it seems a font problem there. Here is the exception info:

    System.Collections.Generic.KeyNotFoundException:
   In MS.Internal.FontCache.FontFaceLayoutInfo.IntMap.System.Collections.Generic.IDictionary<System.Int32,System.UInt16>.get_Item(Int32 i)
   In  Syncfusion.UI.Xaml.Spreadsheet.Helpers.SpreadsheetTextBoxPaint.MeasureTextUsingGlyphs(SpreadsheetGrid grid, String text, IStyle excelStyle, Boolean& isCalculated, Object& textElement)
   In  Syncfusion.UI.Xaml.Spreadsheet.Helpers.SpreadsheetTextBoxPaint.MeasureText(SpreadsheetGrid grid, String text, SpreadsheetColumn column, Double cellWidth, Boolean wraptext, Int32 lineCount, Object& textElement)
   In  Syncfusion.UI.Xaml.Spreadsheet.SpreadsheetColumn.GetDisplayTextSize(String text, Size cellSize, Boolean wrapText)
   In  Syncfusion.UI.Xaml.CellGrid.Helpers.GridFloatingCellHelper.SetDisplayTextSize(GridColumn column, Boolean wrapText)
   In  Syncfusion.UI.Xaml.Spreadsheet.SpreadsheetColumn.OnUpdateColumn(FrameworkElement& oldElement)

     Well, the control seems unable to find the correct font size when using the SpreadsheetTextBoxPaint.MeasureTextUsingGlyphs method, I've no idea how to solve this.
Could you help me?
     Thank you!

Yi Zhou

1 Reply

AR Arulpriya Ramalingam Syncfusion Team April 5, 2020 06:37 PM UTC

Hi zhou, 
 
Greetings from Syncfusion. 
 
We have created a simple sample with font customization for cell values to reproduce the reported scenario at our end. However, we could not replicate the issue at our end the excel files are imported properly. We suspect that the scenario might be occurred due to some other customization on the text with cell formatting. So, we request you to refer the below sample and let us know the code part that we are missing to reproduce the issue. Also, provide a demo excel file which reproduces the issue which will be helpful for us to assist you further. 
 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon