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

Free Support Forum - aspose.com

How to Find Stable Unique Identifier of Shape Object in Presentation?

Dear Aspose,

Please help us find stable unique identifier of shape object.

When using UniqueId property of shape object in Presentation this value changes based on shape order and due to that behavior, we can not rely on such identifier.

Unfortunately, Name stays the same even after Copy-Paste and brings us ambiguity problem.

Please see the attached image and code in zip file showing unstable Shape.UniqueId.
Bug-56121-DuplicateObjectRendered.zip (151.6 KB)
BUG-56121-DuplicateObjectRendered.png (70.0 KB)

Kind Regards
Pavel

@ottap,
Thank you for contacting support.

Please do not share license files in forum threads in the future. I’ve deleted your license data from the zip file. We will reply to you as soon as possible.

@ottap,
To help me better understand the issue, could you please describe in more detail some cases and expected behavior for the UniqueId property?

Hi Andrey,
we were looking for unique persistent identifier of shape object in presentation - so we can store “link” to such shape (and link to the file) to load it in future using that link / shortcut - even if the content is updated.

After some investigation it seems Shape.OfficeInteropShapeId is acting exactly what we need and we can use it in PPT.

Any idea what can provide us same behavior with respect to Aspose.Cells / Charts ?

Thanks for answer.

@ottap,
We are glad to know that you have found the solution. As for Aspose.Cells, you should describe the issue and requirements on Aspose.Cells forum.

Hi Andrey,
I would like to ask few questions about best Shape identifier.

What would you recommend as most stable, persistent, reliable Shape identifier (considering ppt file will be edited)?

Does Shape.OfficeInteropShapeId stay unchanged once set for object in PPT sheet and works both on Windows and Linux the same / are there any limitations (cases when it is being changed)?

Potentially is that best identifier of object in the slide?

For example, as mentioned above, we were not able to use Shape.UniqueId since after adding new object or deleting other and reshuffling them many old shapes obtained different UniqueIds.

Shape.Name had another issue / it could be duplicated and sometime is just by copy-pasting.

Is there any other / better way to identify object then OfficeInteropShapeId?

Best Regards
P.

@ottap,
I need some time to find out information for you. We will reply to you as soon as possible.

@ottap,
The UniqueId property specifies a unique identifier for a shape in presentation scope. Whereas the OfficeInteropShapeId property specifies a unique identifier for a shape in slide scope. Could you please clarify if your presentations will be edited in PowerPoint and other applications or only with Aspose.Slides?

Hi Andrey,
our PPT presentation will be edited in PowerPoint for Desktop or PowerPoint Online only.

As mentioned above - we found out that UniqueId is not persistent.
For example : If you add new shapes and delete some in the middle of your presentation since new UniqueId will be assigned to each Shape starting 1 with step +1 (no gaps) through all the presentation - some UniqueIds tents to vary - so shape with UniqueId 17 could now have UniqueId 14 for example (so if you were targeting shape by UniqueId=17 now you are obtaining different shape).

On the other hand OfficeInteropShapeId behaves much better and adding / deleting shapes on the slides does not change OfficeInteropShapeIds already assigned (unfortunately there can be the very same OfficeInteropShapeId for more slides)

So we can not rely on just OfficeInteropShapeId to identify the shape in whole presentation.

Best what we found in the moment is combination of SliedeId and OfficeInteropShapeId (it breaks when you move Shape to another slide).

Is not there anything like createId property for PPT Shapes like it is for excel charts according to this answer:


?

Thanks for answer.

Best Regards
P.

@ottap,
I think there can’t be two shapes with the same UniqueId in a presentation and two shapes with the same OfficeInteropShapeId in a slide, but this is where their responsibility ends. Because they can change, they really can’t be relied upon. I’ve added a ticket with ID SLIDESNET-43249 to our issue tracking system. Our development team will consider implementing support for CreationId property. You will be notified when the issue is resolved.