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

Free Support Forum - aspose.com

Worksheets.Count property not returning on certain xlsx files

I have a sample spreadsheet that does not seem to return the WorkSheets.count property.


Log(string.Format(“GetPageCount, file={0}”, this.SourcePath ));
if (!File.Exists(this.SourcePath)) throw new FileNotFoundException(“Cannot find source file”);

Workbook xlsDoc = new Workbook(this.SourcePath);
_Renderers = new List();
int pageCount = 0;
Log(string.Format(“GetPageCount, worksheets={0}”, xlsDoc.Worksheets.Count));
for (int i = 0; i < xlsDoc.Worksheets.Count; i++)

In the above, the path gets logged but the Worksheets.count never returns a value.

Aspose.Cells version 7.7.1.0

I believe it is related the sheet having an embedded image. If I remove the image, it returns a count of 3.

Hi,


Thanks for the template file and details.

Please download and try our latest version/fix: Aspose.Cells for .NET v8.0.2.3
I have tested using it with your template file and sample code, it works fine and gives me 3 as Worksheets’ count.
e.g
Sample code:

Workbook xlsDoc = new Workbook(“e:\test2\est080514.xlsx”);
var _Renderers = new List();
int pageCount = 0;
Console.WriteLine(string.Format(“GetPageCount, worksheets={0}”, xlsDoc.Worksheets.Count));// GetPageCount, worksheets=3

Thank you.


Yes, that has fixed it perfectly. Thank you.

Hi,


Good to know that it figures out your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.