Template error trying to embed Excel Document into PPTX
Posted: Thu Jun 26, 2014 2:30 am
Getting the following error when trying to embed an excel document into a PPTX. Any thoughts?
- Code: Select all
2014-06-25 11:23:38,854 ERROR [h] Missing OLE template: NIL
java.io.IOException: com/plutext/ole/templates/NIL not found via classloader.
at com.plutext.ole.d.c.a(c.java:3)
at com.plutext.ole.h.a(h.java:14)
at com.plutext.ole.OleHelperPptx.a(OleHelperPptx.java:40)
at com.plutext.ole.OleHelperPptx.embed(OleHelperPptx.java:17)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.generatePowerPoint(PowerPointGenerator.java:105)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.main(PowerPointGenerator.java:46)
com.plutext.ole.OLEException: Missing OLE template: NIL2014-06-25 11:23:38,857 ERROR [OleHelperPptx] Missing OLE template: NIL
com.plutext.ole.OLEException: Missing OLE template: NIL
at com.plutext.ole.h.a(h.java:78)
at com.plutext.ole.OleHelperPptx.a(OleHelperPptx.java:40)
at com.plutext.ole.OleHelperPptx.embed(OleHelperPptx.java:17)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.generatePowerPoint(PowerPointGenerator.java:105)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.main(PowerPointGenerator.java:46)
at com.plutext.ole.h.a(h.java:78)
at com.plutext.ole.OleHelperPptx.a(OleHelperPptx.java:40)
at com.plutext.ole.OleHelperPptx.embed(OleHelperPptx.java:17)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.generatePowerPoint(PowerPointGenerator.java:105)
at com.jnj.eesus.optimizer.service.analysisv2.product.totalSpend.PowerPointGenerator.main(PowerPointGenerator.java:46)
[code]
public void generatePowerPoint(Object obj) throws Pptx4jException,
Docx4JException, JAXBException, IOException, OLEException {
String outputfilepath = System.getProperty("user.dir")
+ "/OUT_Table.pptx";
PresentationMLPackage presentationMLPackage = PresentationMLPackage
.createPackage();
EmbeddingType xlsx = EmbeddingType.XLSX;
MainPresentationPart pp = (MainPresentationPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/presentation.xml"));
SlideLayoutPart slideLayoutPart = (SlideLayoutPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/slideLayouts/slideLayout1.xml"));
SlidePart slidePart = new SlidePart(new PartName(
"/ppt/slides/slide1.xml"));
slidePart.setContents(SlidePart.createSld());
pp.addSlide(slidePart);
slidePart.addTargetPart(slideLayoutPart);
// CTGraphicalObjectFrame frame = getTable1();
//
//
// slidePart.getContents().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(frame);
//
String table1 = System.getProperty("user.dir") + "/sheet1.xlsx";
String temp = System.getProperty("user.dir") + "/temp.xlsx";
FileInputStream fis = new FileInputStream(table1);
byte[] content = IOUtils.toByteArray(fis);
OleHelperPptx helper = new OleHelperPptx(presentationMLPackage);
helper.embed(slidePart, 100, 200, content, null, null,
EmbeddingType.XLSX, "Test", table1, temp);
presentationMLPackage.save(new File(outputfilepath));[/code]
}