Hi,
I have a question about Aspose Slides. I want to call ‘paragraph.setText(“test”)’ on a master slide and use this master slide as base for a new ppt. If I clone a slide from a second ppt into the new ppt, the original font hight and font colour are ignored, see attachment. I tried a workaround with
final short fontHeight = portion.getFontHeight();
paragraph.setText(“test”);
portion.setFontHeight(fontHeight);
but setting of the font height is ignored?!
I am using Slides 7.6.0 for Java.
Many thanks
Hi Borris,
I have worked over the requirement shared and suggest you to please try using following sample code on your end.
private static void setFooter(final MainMaster mainMaster) {
final Shape shapeL = SlideUtil.findShape(mainMaster, “FOOTER_LEFT”);
final ParagraphCollection paragraphsL = ((Rectangle) shapeL).getTextFrame().getParagraphs();
final Paragraph paragraphTopL = paragraphsL.get_Item(0);
final Portion portionTopL = paragraphTopL.getPortions().get_Item(0);
final short fontHeight = portionTopL.getFontHeight();
Portion por=new Portion();
por.setText(“left footer”);
paragraphTopL.getPortions().removeAt(0);
paragraphTopL.getPortions().add(por);
por.setText(“left footer”);
por.setFontHeight(fontHeight);
}
public static void testPPT() throws Exception {
String path=“D:\Aspose Data\TestJava\”;
final Presentation target = new Presentation(path+“nmaster.ppt”);
final MainMaster master = target.getMainMaster();
final Presentation source1 = new Presentation(path+“test_1.ppt”);
setFooter(master);
final SortedList sl = new SortedList();
for (int i = 2; i < 3; i++) {
final Slide s = source1.cloneSlide(source1.getSlideByPosition(i), i, target, sl);
s.changeMaster(master, false);
final HeaderFooter hf = s.getHeaderFooter();
hf.setFooterVisible(true);
hf.setPageNumberVisible(true);
}
target.deleteUnusedMasters();
target.write(path+“erg2.ppt”);
}
Please share if I may help you further in this regard.
Many Thanks,
Hi Mudassir,
it works fine - great!
Many thanks,
Borris