How to display ppt file in Android views using Docx4j
- by Ganesh
I am working on Android and using docx4j to view the docx,pptx and xlsx files into my application.
I am unable to view the ppt files .
I am getting compile time error at SvgExporter class. which is not there in docx4j library.
Can any one help me out to get the SvgExporter class library and build my application and get the Svghtml to load on webview for ppt files.
my code is as follows.
String inputfilepath = System.getProperty("user.dir") + "/sample-docs/pptx/pptx-basic.xml";
// Where to save images
SvgExporter.setImageDirPath(System.getProperty("user.dir") + "/sample-docs/pptx/");
PresentationMLPackage presentationMLPackage =
(PresentationMLPackage)PresentationMLPackage.load(new java.io.File(inputfilepath));
// TODO - render slides in document order!
Iterator partIterator = presentationMLPackage.getParts().getParts().entrySet().iterator();
while (partIterator.hasNext()) {
Map.Entry pairs = (Map.Entry)partIterator.next();
Part p = (Part)pairs.getValue();
if (p instanceof SlidePart) {
System.out.println(
SvgExporter.svg(presentationMLPackage, (SlidePart)p)
);
}
}
// NB: file suffix must end with .xhtml in order to see the SVG in a browser
}