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

Free Support Forum - aspose.com

Wrong paragraphs after cloning

Hello,
I’m having an IAutoShape and I’m resetting the paragraphs. As a result I have 0 paragraphs in TextFrame.Paragraphs. Then I’m trying to clone this object and I have 1 paragraph in the cloned object.

Please find a demo of this issue in the following solution ConsoleApp4.zip (40.2 KB)

Kind regards,
F

@fireball4,

I have been able to observe the issue. An issue with ID SLIDESNET-41323 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

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

Hello,
I ran the previews attached application with Aspose 20.5 and it seems that the result is the same. Could you please double check it on your side?
Kind regards,
F

@fireball4,

We have investigated the issue on our end and there is not a bug in this case. This is a specific behavior for creating and cloning shapes having TextFrame property. Any new TextFrame has one empty paragraph after creating. You can clear a paragraph collection of the TextFrame, but its clone will have one empty paragraph also because it is a new TextFrame object.

using (IPresentation presentation = new Presentation())
{
    IAutoShape newShape = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 20, 20, 200, 30);
    int paragraphCount = newShape.TextFrame.Paragraphs.Count;  // 1 

    newShape.TextFrame.Paragraphs.Clear();
    int paragraphCountAfterClearing = newShape.TextFrame.Paragraphs.Count; // 0

    IAutoShape clonedShape = (IAutoShape)presentation.Slides[0].Shapes.AddClone(newShape, 20, 70);
    int paragraphCountAfterCloning = clonedShape.TextFrame.Paragraphs.Count; // 1
}

Thank you for quick reply.
In my mind, when I clone something, I create an identical object.
Of course it is not a problem to Clear paragraphs, but now I start wondering what else you are not cloning… Is there a list of those properties/values documented somewhere?

@fireball4,

Thank you for your understanding. I doubt that it is mentioned in documentation any where. But, we will consider adding this in our documentation. If there is any thing else, please feel free to share with us.