Hi,
can you help me about this:
Why text
"Click to edit Master title style
Click to edit Master subtitle style" from mainMaster is printed when execute the following code, code print just the text that is not textHolder?
public class MainMasterTest {
private void iterateMainShapes(Shapes sld) {
for (int shpIdx = 0; shpIdx < sld.size(); shpIdx++) {
Shape shp = sld.get(shpIdx);
Paragraphs paras = null;
// Check if shape holds a textholder
if (shp.getPlaceholder() != null && shp.isTextHolder() == true) {
// Get the place holder as an Object instance
Object obj = shp.getPlaceholder();
// First type of place holder. It is TextHolder
if (obj instanceof TextHolder) {
// Cast object into TextHolder object
TextHolder txtHolder = (TextHolder) obj;
paras = txtHolder.getParagraphs();
// iterateParagraphs(paras, portionList);
} else if (obj instanceof Placeholder) // Second type of place
// holder(Shape)
{
// Cast the object into Placeholder object
Placeholder placeHolder = (Placeholder) obj;
// getShapeRef() returns the Shape object which contains
// real properties of a Placeholder.
paras = placeHolder.getShapeRef().getTextFrame()
.getParagraphs();
// iterateParagraphs(paras, portionList);
}
} else {
if (!shp.isTextHolder()) {
if (shp.getTextFrame() != null) {
paras = shp.getTextFrame().getParagraphs();
}// if
}// else
// Print the text on Console
if (paras != null) {
int parasCount = paras.size();
for (int paraIdx = 0; paraIdx < parasCount; paraIdx++) {
Paragraph para = paras.get(paraIdx);
// print the text on console
System.out.println(para.getText());
}
}// end if
}
}
}
@Test
public void mainMasterTest() {
try {
Presentation presentation = new Presentation(new FileInputStream(
new File("D:/Bojan/20101227_PPT/_102_FINAL EEM Complete Deck - For Translation.ppt")));
Slide mainMaster = presentation.getMainMaster();
Shapes shapes = mainMaster.getShapes();
iterateMainShapes(shapes);
} catch (Exception e) {
System.out.println(e.toString());
}
}
}