How to get shapes from Excel template

Hi all,

I want to enumerate through all shape object of a Excel template. Aspose.cells uses an index in get(). But this index seems to be not the same as index in Excel.

I am programming in Coldfusion using java component. My code snippet looks like

How can I guarentee that yAchse is the same object as in Excel template?

Is there a method in Aspose.cells like AlternativeText

Thanks in advance

Thomas

Hi,

Well, I have tested and Aspose.Cells for Java uses the indexes for the shapes same to MS Excel (as the indexes are implemented and maintained by the insertion of the shapes in the sheet).

Following is my test code in Java that works fine:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Open the template file
workbook.open("e:\\files\\shapestest.xls");

Worksheets ws = workbook.getWorksheets();
Worksheet sheet1 = ws.getSheet(0);

Shapes shapes = sheet1.getShapes();

for(int i = 0;i<shapes.size();i++)
{

System.out.println(sheet1.getShapes().get(i));

System.out.println(sheet1.getShapes().get(i).getType());

}

Do you have different results, kindly post your template excel file, we will check it soon.

Thank you.

Hi,

thanks for answering. I have tested it the same way you did. What I have found is, that two object types from my template were not shown correctly ("Legende_Offers", "Legende_Projects"). I have done a Excel macro in the attached xls file, where i have outputed the object types and ZOrderPostion in sheet "Temp". So you can compare it easily.

Bye

Thomas

Hi Thomas,

Thank you for sharing the template file.

We will look into it and get back to you soon.

Thank You & Best Regards,

Hi Thomas,

Thank you for considering Aspose.

After checking and comparing the result of Excel(result of Macro) and Aspose.Cells, we think in Excel the ZOrderPosition only takes count of those shapes that are not in group. For ("Legende_Offers", "Legende_Projects") you mentioned, these two shapes are GroupShape. Excel only prints out the index of GroupShape itself and ignore all indices of its children. However, Aspose.Cells will print out all indices of GroupShape and its children.

If you want to get the same result as Excel, we think you can just ignore the children of ChartGroup(shape.getGroup() != null) when loop the shapes collection to calculate the index of shape. OR we can provide a new API to do this for you if it can fit your requirement.

Thank You & Best Regards,

Hi Thomas,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. Now we have provided a new API: Shape.getZOrderPosition() to get the ZOrderPosition property just as in Excel.

Thank You & Best Regards,

The issues you have found earlier (filed as 9768) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hello,

sorry for being absent some days. Now I have red your comments to my issue. Your effort to this theme is very quick. Great !!!

I have seen, you made an API update for ZOrderPosition. Tomorrow I will download and test the new function with my Excel template.

Thanks.

Thomas