How to display ppt file in Android views using Docx4j

Posted by Ganesh on Stack Overflow See other posts from Stack Overflow or by Ganesh
Published on 2013-06-24T12:46:08Z Indexed on 2013/06/27 10:21 UTC
Read the original article Hit count: 980

Filed under:
|
|
|

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
}   

© Stack Overflow or respective owner

Related posts about android

Related posts about webview