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

Free Support Forum - aspose.com

Get total number of worksheets using Worksheet.Count property not working in .NET


I have some good that recently started failing. It has been working for a few years before this. Here is the scenario:

I create a workbook from a stream.
I check that the workbook worksheet count is not 0. This fails.

However, if I skip the check and just use the workbook, the data is there.

Please help.

MemoryStream ms = new MemoryStream(System.Text.ASCIIEncoding.Default.GetBytes(result));
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(ms, new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.CSV));

            if (null == wb)

throw new Exception();

            if (0 == wb.Worksheets.Count)

throw new Exception(); <- this fails

Interesting thing is that if you look at the count in the debugger, it says 1. You can even reset the next statement after looking at the value in the debugger and it still fails.

Please help.


Scott Butler

Hi Scott,

Thank you for contacting Aspose support.

I believe you forgot to attach your input file. Please note, we need it for the detailed investigation on our end. Before you move forward to provide us the input file, please give a try to the latest version of Aspose.Cells for .NET to see if it makes any difference.