We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Exception when converting Excel with hidden worksheets to HTML in .NET

Converting the attached file to HTML results in the following exception:

'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'

The problem happens with GroupDocs.Viewer 21.8 and only when option “RenderHiddenPages” is false, so it seems to be related to hidden worksheets.

Hidden sheet problem.zip (41.2 KB)

using (var viewer = new Viewer(documentPath))
{                
   var options = HtmlViewOptions.ForEmbeddedResources("output_viewer{0}.html");
   options.SpreadsheetOptions = GroupDocs.Viewer.Options.SpreadsheetOptions.ForOnePagePerSheet();
   options.SpreadsheetOptions.RenderGridLines = true;
   options.SpreadsheetOptions.RenderHeadings = true;
   //options.RenderHiddenPages = true;
    viewer.View(options);
}

Hi @Clemens_Pestuka

I will investigate this issue and reply here.

1 Like

Hi @Clemens_Pestuka

Excel reports your file as corrupted. Is it the right file?

Hi @mikhail.evgrafov.aspose

For me it opens just fine in Excel 2016
image.png (44.9 KB)

Excel Leave Tracker 2021 Hidden sheet.zip (41.2 KB)
I added the file once more. If it still does not work, I’ll try if can get the same problem with a different file.

Edit:
I re-saved it as XLSX instead of XLSM now too:
Excel Leave Tracker 2021 Hidden sheet XLSX.zip (34.3 KB)
Error still occurs for me.

@Clemens_Pestuka

We’ve reproduced the issue on our end. We’ll let you know in case of any updates.

1 Like

@Clemens_Pestuka

You were right when saying that the issue is related to hidden worksheets. We have found the issue in our code and fixed it. The fix will be included in the next public release that is planned for the middle of September. We’ll notify you here when the new version will be available.

1 Like

@vladimir.litvinchik

I’m happy to hear that :slight_smile:
Thank you for the fix :+1:

2 Likes

@Clemens_Pestuka

You’re welcome!

@Clemens_Pestuka

GroupDocs.Viewer for .NET v21.9 that includes fix for this issue has been published. You can find the new version at

Have a nice day!

1 Like