java - Android HTML to docx Docx4j issues -


i trying convert html string docx using below code per github code recommended on previous stackoverflow questions.

i added following libraries other ones used android docx html docx4j: 1. docx4j-importxhtml-3.2.2.jar 2. itext-2.1.7.jar 3. xml-renderer-3.0.0.jar 4. xalan-2.7.0.jar

the following android version of code in xhtmltodocxandback.java :

       try {                 string html = "<html><head><title>import me</title></head><body><p>hello world!</p></body></html>";                  wordprocessingmlpackage wordmlpackage = wordprocessingmlpackage.createpackage();                  xhtmlimporterimpl xhtmlimporter = new xhtmlimporterimpl(wordmlpackage);                 xhtmlimporter.setdivhandler(new divtosdt());                  wordmlpackage.getmaindocumentpart().getcontent().addall(xhtmlimporter.convert(html, null));                  system.out.println(xmlutils.marshaltostring(wordmlpackage                         .getmaindocumentpart().getjaxbelement(), true, true));                  wordmlpackage.save(new file("/sdcard/out_from_xhtml.docx"));               } catch (docx4jexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } 

error receive:

error:(166, 34) error: cannot access xhtmlimporter class file org.docx4j.convert.in.xhtml.xhtmlimporter not found 

error receive if comment out xhtmlimporter.setdivhandler(new divtosdt()):

error:(168, 34) error: cannot access xhtmlimporter class file org.docx4j.convert.in.xhtml.xhtmlimporter not found 

error receive if comment out wordmlpackage.getmaindocumentpart().getcontent().addall(xhtmlimporter.convert(html, null)); well:

error:execution failed task ':app:packagealldebugclassesformultidex'. > java.util.zip.zipexception: duplicate entry: org/docx4j/convert/in/xhtml/listhelper.class 

i should mention docx html working fine in android studio above error buggy. please tell me how fix it. in advance.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -