Confused by Placeholders and Textholders


#1

Found this in the wiki to set a slide to hello world.

Placeholders pholders = pres.getSlideByPosition(1).getPlaceholders();
TextHolder th = (TextHolder) pholders.get(0);
if (th.getText() == "PH1")
{
th.getParagraphs().get(0).getPortions().get(0).setText("Hello World ");
}

1. Can someone explain the relationship between text holders and placeholders and portions?

2. Reference the object model: http://www.aspose.com/wiki/default.aspx/Aspose.Slides/ObjectModel.html

I don't get the Paragraph-Paragraph-Portion-Portion relationship. Can someone please explain?

How does that relate to the text frames and bullets that I am familiar having used powerpoint every day for 5 years now?..


#2

Add to this.

How do you construct a TextHolder?


#3

If slide has TextHolder you can change it but you can’t create new one.
To add new text to a slide you should create Rectangle and add TextFrame to it.

1. Placeholder is a rectangular shape on a slide where some objects can be placed. They are read-only.
2. TextHolder is special type of Placeholder which contains text.
3. Shape - any shape on a slide. Each shape can contain TextFrame (sure, it can be null if shape doesn’t have any text).
4. TextFrame is text in a shape.
5. TextHolders and TextFrames have one or more Paragraph object.
6. Paragraph is part of text between carriage return characters.
7. Paragraph has one or more Portion objects.
8. Portion is set of characters with the same formatting.


#4

How do I construct and fill a text holder?

Please post an example.


#5

Did you read the first line of my answer carefully?
"If slide has TextHolder you can change it but you can’t create new one."

To create new TextFrame you should create Rectangle and add TextFrame to it.
For examples please check Northwind demo.