How to Create a Real TextBox in PowerPoint Presentation Using Aspose.Slides for .NET?

For a TextBox created in PowerPoint, the IsTextBox property returns True.

If I add a Rectangle shape and then add TextFrame, the IsTextBox property is always False.

How do I create a real msoTextBox in Aspose.Slides? (Other than cloning from an existing one.)

@bingxie,
Thank you for your question.

Unfortunately, I’ve reproduced the same issue with the same results. I’ve added a ticket with ID SLIDESNET-43530 to our issue tracking system. We apologize for any inconvenience. Our development team will investigate the case. We will let you know when we resolve this issue.

Thanks @Andrey_Potapov! Any update on this one?

@bingxie,
I’ve requested plans for the issue from our development team. We will let you know soon.

@bingxie,
The issue has been planned to be fixed in Aspose.Slides 23.1. This release will be published in the second half of January.

Thanks @Andrey_Potapov

Would you mind sharing how to create a real msoTextBox with the fix?

@bingxie,
Unfortunately, I have no information about this yet. When the issue is resolved, we will provide you with a sample code.

The issues you found earlier (filed as SLIDESNET-43530) have been fixed in Aspose.Slides for .NET 23.2 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

@bingxie,
With Aspose.Slides 23.2, please try using the following test code example:

string presPath = "newpresentation.pptx"; 
// create a new presentation from scratch 
using (Presentation pres = new Presentation()) 
{
    ISlide slide = pres.Slides[0]; 
    IAutoShape shape1 = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 50, 20);
    // Assert.False(shape1.IsTextBox); // here IsTextBox must be false
    shape1.TextFrame.Text = "Shape with text"; // just set Text value
    // Assert.True(shape1.IsTextBox); // here IsTextBox must be true
    pres.Save(presPath, SaveFormat.Pptx);
}

// reopen the presentation
using (Presentation pres = new Presentation(presPath))
{
    ISlide slide = pres.Slides[0];
    IAutoShape shape1 = (IAutoShape)slide.Shapes[0];
    // Assert.True(shape1.IsTextBox); // here IsTextBox must be true
} 

Thank you @andrey.potapov I will test the new release in the new few days.

@bingxie,
We will be waiting for your feedback.