Is there an equivalnet to Worksheets[0].Pictures.Count for WebWorksheets?

Hi,

I need to determine if the file I just imported and am about to display in my GridWeb contains any pictures. There does not seem to be a Count method for WebWorksheets[0].Pictures like there is for Worksheets.

I've tried the following, but the foreach throws an exception:

gridweb1.WebWorksheets.Clear();

gridweb1.WebWorksheets.ImportExcelFile(docUrl);

gridweb1.WebWorksheets.ActiveSheetIndex = 0;

Aspose.Cells.GridWeb.Data.WebWorksheet sheet = gridweb1.WebWorksheets[0];

Int32 ctr = 0;

foreach (Aspose.Cells.GridWeb.Data.Picture picture in sheet.Pictures)

{

ctr++;

}

The exception is:

ex = {"Unable to cast object of type 'System.Collections.SortedList' to type 'Aspose.Cells.GridWeb.Data.Picture'."}

Any suggestions?

Thanks

Jim

Hi,

Thanks for your posting and using Aspose.Cells for GridWeb.

I was able to replicate this issue using the latest version:
Aspose.Cells
for GridWeb v2.7.7.2004



Please see the sample code below. I have attached the source xlsx file and the screenshot showing the exception for your reference.

We have logged this issue in our database. We will look into it and once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-40817.

C#


string docUrl = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Aspose.Cells.GridWeb.GridWeb gridweb1 = this.GridWeb1;


gridweb1.WebWorksheets.ImportExcelFile(docUrl);


Aspose.Cells.GridWeb.Data.WebWorksheet sheet = gridweb1.WebWorksheets[0];


foreach (Aspose.Cells.GridWeb.Data.Picture picture in sheet.Pictures)

{

}


Screenshot:

Hi,


Thank you for your patience for the resolution of this issue.

We have fixed this issue. Please download and use the latest fix of Aspose.Cells.GridWeb as attached here and you can traverse through the pictures collection as follow:

gridweb1.WebWorksheets.ImportExcelFile(Source_Excel_File);

Aspose.Cells.GridWeb.Data.WebWorksheet sheet = gridweb1.WebWorksheets[0];

foreach (Aspose.Cells.GridWeb.Data.Picture picture in sheet.Pictures)
{
}

Hi,

Thanks for your patience.

We have also fixed the worksheet.Pictures.Count property, please download and use it: Aspose.Cells for GridWeb v2.7.7.2006.

Thank you

Hi,

Thanks for fixing this.
It works great.

Jim

Hi,



Thanks for your feedback.


We are glad to know that above release fixes the problem of Pictures collection and resolves your problem.

In case, you encounter any other issue, please let us know, we will be happy to assist you further.

Have a good day.