opening XLSM throws error: Index was out of range

0 Answers 9 Views
SpreadProcessing
Steven
Top achievements
Rank 1
Iron
Steven asked on 06 May 2022, 01:25 PM

using the tutorial on:

SpreadProcessing - Import and Export to Xlsm File Format Using XlsmFormatProvider | Telerik Document Processing

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.  

 

Steven
Top achievements
Rank 1
Iron
commented on 06 May 2022, 01:46 PM

Maybe a better question -- how do I debug a spreadsheet that is apparently incompatible?  I am trying to create a process for our users and I can include modifying data / copying the data to another spreadsheet.  I just need some way to understand which files will be problematic.  
Nikolay Demirev
Telerik team
commented on 09 May 2022, 03:40 PM

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.

Steven
Top achievements
Rank 1
Iron
commented on 09 May 2022, 05:02 PM

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.  

Nikolay Demirev
Telerik team
commented on 10 May 2022, 08:11 AM

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.

No answers yet. Maybe you can help?

Tags
SpreadProcessing
Asked by
Steven
Top achievements
Rank 1
Iron
Share this question
or