Hi,
I’m using aspose.slide(the latest version aspose-slides-2.7.0-java) with jre 1.6 and when i want to create a new presentation using this code “Presentation ppt = new Presentation();” i got the following exception : com.aspose.slides.PptReadException: Internal library error. Template is broken.
Any suggestions pleaz?
Hi Chouaib,
Hi Mudassir,
I’m using aspose 2.8, but i still have the same problem.
I got the following exception when i try to export a ppt file from my application :
Exception in 682 Dispatch Macro Invoking Export to PowerPoint.Implementation.OnWizTerminate
java Exception invoking com.aspose.slides.Presentation. line 537
from ma.mega.modeling.ppt.export.ExportToPowerPoint.createAndSavePresentation line 350
from ma.mega.modeling.ppt.export.ExecuteMetaWizard.OnWizTerminate line 71
from com.mega.mod : com.aspose.slides.PptReadException: Internal library error. Template is broken.
My source code is :
void createAndSavePresentation(final MegaObject myMegaObject, final String fileName) throws IOException {
//Create a ppt file
Licenses.setAsposeSlidesLicense(myMegaObject.getRoot());
Presentation pptFile = new Presentation();
// pptFile.setSlideSize(new Point(ExportToPowerPoint._WIDTH_PPT_DIAGRAM + 2500, 4500));
//Get the meta association end between diagramm and my Mega Object
this.getMetaAssociationEnd(myMegaObject);
//Get the object diagram from the mega object
this.getDiagramFromMegaObject(myMegaObject, pptFile, null);
//Create hyperlinks between slides
this.createHyperlinks(myMegaObject, pptFile);
//Add summary to the first silde
Rectangle rec = pptFile.getSlideByPosition(1).getShapes().addRectangle(150, 750, 5400, 3500);
rec.getLineFormat().setShowLines(false);
rec.addTextFrame(this.getTitles(this.titles.get(0), “1”));
//Get all summary titles from the rectangle
TextFrame tfSummary = rec.getTextFrame();
tfSummary.setWrapText(true);
tfSummary.getLinks().clear();
//Get Summary titles
int index = 0;
int i = 0;
for (String slideTitle : this.getTitles(this.titles.get(0), “1”).split("\n")) {
//Link each summary title to its slide diagram
Link lnk = tfSummary.getLinks().addLink();
lnk.setBegin(index);
index += slideTitle.length() + 1;
lnk.setEnd(lnk.getBegin() + slideTitle.length());
lnk.setInternalHyperlink(this.hmTitleSlide.get(this.sammury.get(i)));
i++;
}
//Adding Title with textframe
Rectangle rect = pptFile.getSlideByPosition(1).getShapes().addRectangle(632, 184, 4296, 520);
rect.getLineFormat().setShowLines(false);
TextFrame tf = rect.addTextFrame(myMegaObject.getProp(GenericObject.MA_ShortName));
//Center align it
tf.getParagraphs().get(0).setAlignment(TextAlignment.CENTER);
//Set formatting
Portion port = tf.getParagraphs().get(0).getPortions().get(0);
//To set font height
port.setFontHeight((short) 30);
//To set font
FontEntity newFont = new FontEntity(pptFile, pptFile.getFonts().get(0));
newFont.setFontName(“Comic Sans MS”);
int newFontIdx = pptFile.getFonts().add(newFont);
port.setFontIndex(newFontIdx);
//To set color
port.setFontColor(Color.BLUE);
//Save the ppt file
pptFile.write(fileName);
}
Thanks for help.
Best Regards .
Chouaib.
Hi Chouaib,
Hi Mudassir,
Yes I know that aspose work correctly out of our application, but when i debug, i find that the
exception is occured when i instantiate the class Presentation, in this line :
Presentation pptFile = new Presentation();
Anyway I will still seek the source of problem
Thanks mudassir for your help and suggestion