Master Slides text extraction

Hi,


I need to extract text from master slides, but only from shapes generated by user.
I use this code:
public void asposeTest() throws XliffNotificationException {

Presentation pptxPresentation = new Presentation(
“/master-slide-test.pptx”);
IMasterSlideCollection masterSlides = pptxPresentation.getMasters();
int masterSlidesCollectionSize = masterSlides.size();

for (int slideIndex = 0; slideIndex < masterSlidesCollectionSize; slideIndex++) {
iterateTextFrames(masterSlides.get_Item(slideIndex));
}
}

private void iterateTextFrames(IBaseSlide slide)
throws XliffNotificationException {
ITextFrame[] textFramesSlideOne = SlideUtil.getAllTextBoxes(slide);

// Loop through the Array of TextFrames
for (int i = 0; i < textFramesSlideOne.length; i++)

// Loop through paragraphs in current TextFrame
for (IParagraph para : textFramesSlideOne[i].getParagraphs())

// Loop through portions in the current Paragraph
for (IPortion port : para.getPortions()) {
System.out.println("Portion text: " + port.getText());
}
}

but I get and text from shapes generated by office. This is output:

Portion text: Click to edit Master title style
Portion text:
Portion text: Click to edit Master text styles
Portion text: Second level
Portion text: Third level
Portion text: Fourth level
Portion text: Fifth level
Portion text:
Portion text: 11/24/2011
Portion text:
Portion text:
Portion text: ‹#›
Portion text:
Portion text: Textbox2
Portion text:
Portion text: table2
Portion text:

so I don’t want text Click to edit Master text styles, Second level and so on. How can I do this?
Here is attached presentation.

Thanks
Best regards

Hi Djordje,

I have observed your requirement and suggest you to please try using Alternative Text property with user defined shapes. You can check Alternative Text property for desired shapes and extract the text. This way you will be able to recognize between shapes already added in master or the ones added by you. Please visit this documentation article for your kind reference in this regard.

Many Thanks,

Hi,


I need other way to know which shape text is added from user because I don’t make presentations, I get presentation from users of my application and I need to extract text from them.

Can You help me?

Thanks

Hi Djordje,

I have observed your requirement and like to share that the shapes inside master or normal slides if are added by user can possibly have a property
IsTexHolder that may be false. If the shape is added by default master then IsTexHolder will return true. This is one possible implementation that you can test on your end. However, I am not sure if this will apply on all slides crated by customer because if the customer add the shapes in the form of placeholders inside the master slide then IsTexHolder will return true. As suggested earlier, the best approach is to use Alternative Text property. You can try using the suggest approach on your end to serve the purpose. I also like to share that this is neither an issue or a shortcoming in Aspose.Slides. I have shared the approach that may be helpful on your end.

bool ifTextHolder= presentation.getMasters().get_Item(0).getShapes().get_Item(5).isTextHolder();

Many Thanks,