How can I delete a textframe from a slide?

I have the following code that loops through all textboxes and i am trying to figure out a way to delete a textbox from the slide.


var textboxes = SlideUtil.GetAllTextboxes(slide)

for (int i =0; i < textboxes.Length; i++)
{
var textbox = textboxes[i];
if (someCondition)
{
//Remove textbox from slide
}
}

I see how I can delete a shape from a slide using:

slide.Shapes.Remove();

but i can’t figure out how i either:
1. Convert my textbox (which is ITextFrame) to get the shape to remove.
2. See anyway to remove a textbox from a slide directly

What is the recommendation for this situation? I am using the latest version of aspose.slides on .net

Hi Adam,


I have observed your requirement and sample code used on your end. I regret to share that in present data structure of TextFrame class the link to parent shape is not available. Therefore, you cannot directly jump from a TextFrame to its respective Shape that you may use to remove it. I have created an issue with ID SLIDESNET-37199 in our issue tracking system to investigate the possibility of adding the parent shape reference inside TextFrame class to support the back tracking.

In order to fulfill your requirements, I suggest you to please traverse through every slide and its respective shape collection. Then for every shape inside slide, you check its text frame for your condition matching and removing the desired shape if the condition matches. I hope this approach will be helpful in your approach and is not a big transition as well.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.