How to convert office documents into html in android


Staff member
could we convert microsoft office documents(doc, docx, ppt, pptx, xls, xlsx, etc.) in to html string in Android.
i need to show office documents in my app. i have searched and found docx4j, apache poi and <a href="" rel="nofollow"></a> to convert files in html. this approach is working fine in desktop version. but when using in android i am getting "Unable to convert in Dalvik format error 1". which is may be due to using too much jars in my android project.
i want to know is there a single way from which i convert office document to html in android.
sorry for english.


i am now able to convert doc to html using apache poi.
here is method

public void showsimpleWord() {
    File file = new File("/sdcard/test.doc");

    HWPFDocumentCore wordDocument = null;
    try {
        wordDocument = WordToHtmlUtils.loadDoc(new FileInputStream(file));
    } catch (Exception e1) {
        // TODO Auto-generated catch block

    WordToHtmlConverter wordToHtmlConverter = null;
    try {
        wordToHtmlConverter = new WordToHtmlConverter(
        org.w3c.dom.Document htmlDocument = wordToHtmlConverter
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DOMSource domSource = new DOMSource(htmlDocument);
        StreamResult streamResult = new StreamResult(out);
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer serializer = tf.newTransformer();
        serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        serializer.setOutputProperty(OutputKeys.INDENT, "yes");
        serializer.setOutputProperty(OutputKeys.METHOD, "html");
        serializer.transform(domSource, streamResult);
        String result = new String(out.toByteArray());
        ((WebView) findViewById(,
                "text/html", "utf-8");

    } catch (Exception e) {

now searching for others.