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
15
Exception when loading Excel file with Conditional Formatting Rule, that contains formula.
posted

When trying to load Excel file with Workbook.Load, I get exception if the excel file have Conditional Formatting rule that has formula. The exception is Infragistics.Documents.Excel.FormulaParseException.

Here is the StackTrace:

   at Infragistics.Documents.Excel.ConditionalFormatting.ConditionBase.ParseSingleTargetFormula(String formula, Workbook workbook, Nullable`1 cellReferenceMode, FormulaType formulaType, Int32 sourceRowIndex, Int16 sourceColumnIndex)
   at Infragistics.Documents.Excel.ConditionalFormatting.ConditionBase.ParseSingleTargetFormula(String formula, Nullable`1 cellReferenceMode)
   at Infragistics.Documents.Excel.ConditionalFormatting.OperatorConditionalFormat.SetOperand1Formula(String formula, Nullable`1 cellReferenceMode)
   at Infragistics.Documents.Excel.Serialization.Excel2007.ConditionFactory_XLSX.CreateOperatorConditionalFormat(ConditionalFormatInfo cfi, CfRuleInfo rule)
   at Infragistics.Documents.Excel.Serialization.Excel2007.ConditionFactory_XLSX.Create(ConditionalFormatInfo cfi, CfRuleInfo rule)
   at Infragistics.Documents.Excel.Serialization.Excel2007.ConditionalFormatInfo.Commit()
   at Infragistics.Documents.Excel.Serialization.Excel2007.XLSX.PartManagers.ObjectModelWorksheetPartManager.LoadWorksheetEndElement(XmlPartManagerBase partManager)
   at Infragistics.Documents.OfficeOpenXml.Core.XmlReadManager.LoadChildElementsHelper(Int32 startStackDepth, Int32 currentChildIndex, AlternateContentStatus alternateContentStatus, Boolean isContinuation, Boolean justPopped)
   at Infragistics.Documents.OfficeOpenXml.Core.XmlReadManager.<>c__DisplayClass19_0.<LoadChildElementsHelper>b__6()
   at Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at TryThrowExceptionDispatchInfo(Object )
   at Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
   at Infragistics.Documents.Core.WorkItem.RethrowIfExceptional()
   at Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
   at Infragistics.Documents.Core.Async.<>c__DisplayClass10_0`1.<Try>b__0(WorkItem`1 t)
   at Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass5_0`1.<Then>b__0()
   at Infragistics.Documents.Core.WorkItem.WorkItemSync.ExecuteCore(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at TryThrowExceptionDispatchInfo(Object )
   at Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
   at Infragistics.Documents.Core.WorkItem.RethrowIfExceptional()
   at Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
   at Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass66_0.<LoadPart>b__4(WorkItem`1 t2)
   at Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass5_0`1.<Then>b__0()
   at Infragistics.Documents.Core.WorkItem.WorkItemSync.ExecuteCore(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at TryThrowExceptionDispatchInfo(Object )
   at Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
   at Infragistics.Documents.Core.WorkItem.RethrowIfExceptional()
   at Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
   at Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<LoadCore>b__51_0(WorkItem`1 t)
   at Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass8_0`1.<Then>b__0()
   at Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at TryThrowExceptionDispatchInfo(Object )
   at Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
   at Infragistics.Documents.Core.WorkItem.RethrowIfExceptional()
   at Infragistics.Documents.Core.WorkItem.RunNextWorkItem(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
   at Infragistics.Documents.Core.WorkItemScheduler.SynchronousImpl.Execute(WorkItem workItem)
   at Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
   at Infragistics.Documents.Excel.Workbook.Load(Stream stream, WorkbookLoadOptions loadOptions)

The rule is something like this:

This is happening with the latest version 2018.1.

The file that I am trying to open has other rules, which seem to work fine, but the one that contains formula throws.

It would be nice addition the framework if there are option (static or per file load) to control whether some features of the workbook should be included and parsed when loading files. With some of the older version I had a problem, which was resolved with updating to the latest version, but then a new problem is introduced.