We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Assigning formula to range in not working anymore in

I've just upgraded to the latest version of XlsIO and now my previously working code is failing.

                // Update formulas:
                var columnsWithFormula = new[] { "H", "I", "K", "M", "R", "S", "T", "U", "V", "W" };
                foreach (var columnWithFormula in columnsWithFormula)
                    if (!worksheet.Range[$"{columnWithFormula}{startRow}"].HasFormula) continue;

                    worksheet.Range[$"{columnWithFormula}{startRow}:{columnWithFormula}{row}"].Formula = worksheet.Range[$"{columnWithFormula}{startRow}"].Formula;

I open an existing Workbook which has formulas in startRow. After filling records I want to copy the formula in the startRow to the new rows.
row is in this case 432.
This used to work, but now I get this exception:

Parameternaam: index
    bij Syncfusion.XlsIO.Parser.Biff_Records.Formula.RefNPtg.CodeToIndex(FormulaToken token)
   bij Syncfusion.XlsIO.Parser.Biff_Records.Formula.RefNPtg.ConvertSharedToken(IWorkbook parent, Int32 iRow, Int32 iColumn)
   bij Syncfusion.XlsIO.Implementation.FormulaUtil.ConvertSharedFormulaTokens(SharedFormulaRecord shared, IWorkbook book, Int32 iRow, Int32 iColumn)
   bij Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.SetSharedFormula(WorksheetImpl sheet, String strFormulaString, String strCellsRange, UInt32 uiSharedGroupIndex, Int32 iRow, Int32 iCol, Int32 iXFIndex, Boolean bCalculateOnOpen)
   bij Syncfusion.XlsIO.Implementation.RangeImpl.set_Value(String value)
   bij Syncfusion.XlsIO.Implementation.RangeImpl.set_Formula(String value)

Did something change in the new version?
How to update my code to get it working again?

2 Replies

AV Abirami Varadharajan Syncfusion Team April 16, 2019 05:36 PM UTC

Hi Paul, 
We are able to reproduce the issue with "Exception is raised while setting formulas to the range" and logged a defect report for the same. The patch for this issue is estimated to be available on 22nd April 2019. 

AV Abirami Varadharajan Syncfusion Team April 23, 2019 10:00 AM UTC

Hi Paul, 

We have fixed an issue with “Exception is raised while setting formulas to the range The patch can be downloaded from the following locations.     

Recommended approach - exe will perform automatic configuration         

Please find the patch setup from below location:                     
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment         
Please find the patch assem blies alone from below location:                
Assembly Version:
Installation Directions : 
This patch should replace Syncfusion.XlsIO.Base.dll  under the following folder.          
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.6
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\\precompiledassemblies\\4.6

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies. 

You can change how you receive bug fixes by navigating to the following link and updating your preferences.               

Disclaimer : 
Please note that we have created this patch for version specifically to resolve the issues reported in this Forum 144022.               

If you have received other patches for the same version for other products, please apply all patches in the order received.               

This fix will be included in our future release 2019 Volume 1 service pack 1 which will be rolled out at the mid of May 2019. 

Live Chat Icon For mobile
Up arrow icon