Hello,
I'm receiving a "Value cannot be null. Parameter name: key" error when saving an Excel workbook. I've pretty much stripped everything out of the workbook and I've narrowed it down to the attached example file.
To duplicate this, just run the following code on the attached file:
Workbook workbook = Workbook.Load(@"C:\buggedspreadsheet.xlsx");
workbook.Worksheets[1].Rows.Remove(2);
workbook.Save(@"C:\Users\Paul\Downloads\new.xlsx");
This is a critical issue for us as we've built a process around the Infragistics Excel functionality that needs to run everyday. We have multiple worksheets that this started happening in, and I'm unable to track down the underlying problem. Please provide more information on this error.
Thanks,
Paul
Hello Paul,
Thank you for contacting us.
I will need more information in order to reproduce the issue and to investigate it further for you. Could you please share a small sample or a code snippet, along with details like: exact product version and when this issue started to appear.
Looking forward to hearing from you.
Thanks for the quick response.
The version I am using is 2015.1.2112.
I provided a code snippet and example file in my initial post. Did you not get those? Just run the code using the attached xlsx file and the issue should reproduce on the "workbook.Save(@"C:\Users\Paul\Downloads\new.xlsx");" call.
In the initial post there was one xlsx file with empty rows and just one value in cell A10 (number 1) and 3 rows of code. In order to create a sample I will need more code and information. The thread is under "ASP.NET MVC Helpers" section and I am wondering if it is related to them.
Is it possible for you to provide a small sample that is showing the issue, this would be highly appreciated.
Yes, that is the file where the bug occurs. Please use the code I provided (Remove that exact line only) with that exact file (don't make any changes to the file). The error should occur even though there is not much in the file. This was one of the points I made in my original post. I removed most information from the file to try to determine what the issue was. The file I've provided is a bare-bones example where the issue duplicates. The error is very non-descriptive and I wish I could provide you more information, but I cannot.
Please let me know if you are able to re-create the error with the code and the file I provided.
I recommend downloading 18.1 and testing with the same excel file to see if this has already been addressed. If it hasn't, we need an excel file that we can use to reproduce the issue so that we can look into what is happening.
Note that you should post in the Ultimate UI for Windows Forms forum rather than the Ignite UI for JavaScript forum for questions on the Windows Forms toolset.
We have similar issue with following code which we use to convert .xls to .xlsx. It fails to convert some of the files. Is this the known issue in Vol 13.1 for WinForms?
public static void ConvertXLStoXLSX(string oldFile, string newFile) { var formatt = Infragistics.Documents.Excel.Workbook.GetWorkbookFormat(oldFile); Workbook wb = Infragistics.Documents.Excel.Workbook.Load(oldFile); wb.SetCurrentFormat(WorkbookFormat.Excel2007); wb.Save(newFile); }
Here is the stack trace.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key) at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) at Infragistics.Documents.Excel.Serialization.WorkbookReferenceBase.GetScopeDictionary(String name) at Infragistics.Documents.Excel.Serialization.WorkbookReferenceBase.GetNamedReference(String name, Object scope, Boolean createIfNotPresent) at Infragistics.Documents.Excel.Formula.InitializeSerializationManagerVisitor.RetainNamedReference(NamedReferenceBase& namedReferenceBase) at Infragistics.Documents.Excel.Formula.InitializeSerializationManagerVisitor.VisitNameToken(NameToken token) at Infragistics.Documents.Excel.FormulaUtilities.Tokens.NameToken.Accept(FormulaTokenVisitor visitor) at Infragistics.Documents.Excel.FormulaUtilities.Tokens.FormulaTokenVisitor.VisitAll() at Infragistics.Documents.Excel.Formula.InitializeSerializationManager(WorkbookSerializationManager manager, Worksheet owningWorksheet) at Infragistics.Documents.Excel.Serialization.WorkbookSerializationManager.InitializeReferencesHelper.FormulaCallback(Worksheet owningWorksheet, Formula formula) at Infragistics.Documents.Excel.Workbook.IterateFormulas(IEnumerable`1 namedReferences, IterateFormulasCallback callback) at Infragistics.Documents.Excel.Serialization.WorkbookSerializationManager.InitializeReferences() at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.InitializeReferences() at Infragistics.Documents.Excel.Serialization.WorkbookSerializationManager.Save() at Infragistics.Documents.Excel.Workbook.SaveXLSXFile(Stream stream, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.SaveHelper(Stream stream, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.Save(String fileName, IPackageFactory packageFactory) at Infragistics.Documents.Excel.Workbook.Save(String fileName)
Any Suggestions?
I've already mentioned in the second post that I am using version 2015.1.2112.
The link you provided does not use the code snippet I provided, so it is useless for duplicating the problem. Please use the following (the paths can be changed, but the middle line must be run to duplicate this):
I loaded the file with our online sample Save/Load Excel files, and everything was okay. You can try it yourself from the hyperlink below:
https://es.infragistics.com/samples/aspnet/infragistics-excel/save-load-excel-files
Could you please let me know what is the version of our product that you are using.