using the tutorial on:
I have this code:
Workbook workbook; IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsm.XlsmFormatProvider(); using (Stream input = new FileStream(FileName, FileMode.Open)) { workbook = formatProvider.Import(input); }
when trying to open the file I get the following error:
Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
I have not done anything to the file other than attempt to open the file. Some files can be opened, but many throw this error. I cannot determine what the problem is and can't figure out what the 'index' is that's being referred to.
Hi Steven,
If you want to debug the code, you could build the SpreadProcessing locally and use the binaries. You could download the source code from your account. You could also open a support ticket and send me the document you are trying to open so that I can investigate the issue.
The SpreadProcessing support for XLSM is limited. It reads the VB project file and preserves it, and the structures of the document are responsible for linking it to the document. Sometimes, features such as ActiveX controls require more than just preserving the VB project. But there might be more cases that are not supported.
is there a known issue list anywhere? That would be useful in order to know what to avoid in the future
the spreadsheet in question has many data connections to our local server and an added button attached to the VB code. Almost no data is input from the users. The file would not open when I saved it as an XLSX file either.
Currently, the logged items for the XLSM format provider are the following:
SpreadProcessing: Add support for ActiveX controls
SpredProcessing: Add API that allows one to manipulate the macros inside a Workbook
SpreadProcessing: Allow executing macros inside a spreadsheet document
The baseline is that the features supported by the XlsmFormatProvider are the same as the XlsxFormatProviders supports + VBA Macros. The macros are just preserved for export after being imported from a document. You could log the support for data connections as a Feature Request in the public Feedback portal.