Problems after upgrade to 14.10

Hello,


After upgrade to 14.10 we faced the following problems.
1. The code we used for extracting text doesn’t work anymore:

Dim Buffer As New StringBuilder
Dim Slides As New Aspose.Slides.Presentation(fileName)

For Each Slide As Aspose.Slides.Slide In Slides.Slides
For Each Shape As Aspose.Slides.Shape In Slide.Shapes
If Shape.Placeholder IsNot Nothing Then
If TypeOf Shape.Placeholder Is Aspose.Slides.TextHolder Then
Dim TextHolder As Aspose.Slides.TextHolder = DirectCast(Shape.Placeholder, Aspose.Slides.TextHolder)
If TextHolder IsNot Nothing Then Buffer.Append(TextHolder.Text & DELIMITER)
End If
Else
Dim TextFrame As Aspose.Slides.TextFrame = Shape.TextFrame
If TextFrame IsNot Nothing Then Buffer.Append(TextFrame.Text & DELIMITER)
End If
Next
Next
The reasons are the following:
TextFrame is not a member of Shape anymore.
TextHolder is not a member of Aspose.Slides anymore. How can we rewrite the code to make sure it does the job?

2. Creator is not a member of Slides.DocumentProperties anymore, Description is not a member of Slides.DocumentProperties anymore.
How do we get the values now?

Thanks in advance.

Hi Bent,

Thanks for inquiring Aspose.Slides.

I have observed the sample code by you and request you to please share the sample presentation that is failing to retrieve the text. Please also share the details as well that which portion of text is missing from extraction on your end. I will investigate the issue on my end to help you further in this regard.

Many Thanks,

Hi Mudassir,


I think you missed the main point. After the upgrade the code cannot even be compiled as there are no mentioned properties in Aspose.Slides object model anymore! I tried Object Browser to see if the properties were moved, but I could not find anything similar.

So most likely some new properties\methods have been introduced and i am curious to know how should I rewrite the code now.


Hi Bent,


I have observed your requirement and have created the sample code to serve your need as per new API. Please try using the following sample code on your end to serve the purpose. Please share, if I may help you further in this regard.

Dim Buffer As New StringBuilder
Dim Slides As New Aspose.Slides.Presentation()

For Each Slide As Aspose.Slides.Slide In Slides.Slides
For Each Shape As Aspose.Slides.IShape In Slide.Shapes
If Shape.Placeholder IsNot Nothing Then

Dim Holder As Aspose.Slides.ITextFrame = (DirectCast(Shape, Aspose.Slides.IAutoShape)).TextFrame

If Holder IsNot Nothing Then Buffer.Append(Holder.Text & DELIMITER)

ElseIf TypeOf Shape Is Aspose.Slides.IAutoShape Then
Dim TxtFrame As Aspose.Slides.ITextFrame = (DirectCast(Shape, Aspose.Slides.IAutoShape)).TextFrame

If Holder IsNot Nothing Then Buffer.Append(Holder.Text & DELIMITER)

End If

Next
Next

Many Thanks,

Thank you for the code. I have some concerns about this line:

Dim Holder As Aspose.Slides.ITextFrame = (DirectCast(Shape, Aspose.Slides.IAutoShape)).TextFrame

In this code we do not use Shape.Placeholder at all, although we check it for Nothing in the line above. Shouldn’t we use Shape.Placeholder here, so it would be something like this:
Dim Holder As Aspose.Slides.ITextFrame = (DirectCast(Shape.PlaceHolder, Aspose.Slides.IAutoShape)).TextFrame


Hi Bent,

I have observed comments shared by you and like to share that you cannot cast IPlaceholder to IAutoShape. What I have suggested you is right approach. Actually, I have ported the sample code shared by you w.r.t new API. In old API we used to have text in TextHolders and TextFrames. However in new API we have text only maintained in TextFrames. I have only ported your code to check Placeholder as sometimes getting placeholder type is used in customer codes. Otherwise, in order to extract the text only accessing ITextFrame is sufficient. Please share, if I may help you further in this regard.

Many Thanks,