Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
System.FormatException thrown by Winforms Excel 2018.1 WorksheetCell.GetText when cell has specific Conditional Formatting
posted

First, thanks for the new support of Excel Conditional Formatting in the Excel Import Winforms 2018.1 library! This is something our users have been asking for.

We recently migrated from the 2016.2 version to the 2018.1 of the Excel import library and  I now notice a minor regression in reading a client's spreadsheet. I am now seeing a System.FormatException when attempting to read the text of an Excel cell that has some very specfic conditional formatting:

System.FormatException was caught
  HResult=-2146233033
  Message=One of the identified items was in an invalid format.
  Source=Infragistics4.Documents.Excel.v18.1
  StackTrace:
       at Infragistics.Documents.Excel.CalcEngine.ExcelCalcValue.ToBoolean(IFormatProvider provider)
       at Infragistics.Documents.Excel.ConditionalFormatting.FormulaConditionalFormat.MeetsCriteria(Object cellValue, Int32 rowIndex, Int32 columnIndex, RefBase cellRef)
       at Infragistics.Documents.Excel.Worksheet.GetCellConditionalFormat(Int32 rowIndex, Int16 columnIndex, Boolean formatStringOnly)
       at Infragistics.Documents.Excel.WorksheetCellBlock.GetCellTextInternal(Worksheet worksheet, WorksheetRow row, Int32 rowIndex, GetCellTextParameters paramters, Object value)
       at Infragistics.Documents.Excel.WorksheetCellBlock.GetCellTextInternal(WorksheetRow row, Int32 rowIndex, GetCellTextParameters paramters)
       at Infragistics.Documents.Excel.WorksheetRow.GetCellTextInternal(WorksheetCellBlock cellBlock, GetCellTextParameters parameters)
       at Infragistics.Documents.Excel.WorksheetCell.GetText(TextFormatMode textFormatMode)
       at Ideate.Sticky.Model.Excel.WorksheetCellAdapter.ReadText() in c:\dev\repos\isb\source\Sticky\Model\Excel\WorksheetCellAdapter.cs:line 177
       at Ideate.Sticky.Model.Excel.WorksheetCellAdapter.Initialize(WorksheetAdapter worksheet, WorksheetCell worksheetCell) in c:\dev\repos\isb\source\Sticky\Model\Excel\WorksheetCellAdapter.cs:line 149


Here are the minimum conditions I have found to recreate the issue:

  • Cell $A$1
    • Value: Any string. leaving blank avoids the issue
    • Conditional Format:
      • Select a Rule Type: "Use a formula to determine which cells to format"
      • Format values where this formula is true: IF($A$2="A",TRUE(), "X")
      • Format - Number: Custom > "C0"
  • Cell $A$2
    • Value: Any string except "A" (triggers conditional format)

This file contains these minimal conditions to trigger the exception when reading cell $A$1 with Winforms Excel 2018.1 WorksheetCell.GetText:
ISB-920 minimal repro of issue.xlsx

Let me know if there is anything else I can provide to help you find and fix this issue.

Thanks for all the great work you do to continually fix and upgrade the Excel & WinForms components!

Cheers,
Ben

Parents
No Data
Reply
  • 29105
    Offline posted

    Hello Ben, 

    Thank you for contacting Infragistics. I've reproduced and isolated the regression. In addition I logged a development item for our team to review: 256030. See sample attached below for more details. 

    I also created a private support case to follow up with you CAS-197286-C4L1M6. You can access this case here after signing into your Infragistics account and clicking the support activity.

    Let me know if you have any questions.

    6835.WindowsFormsApp1.zip

Children