I have been trying to convert html content to docx using their library and I do get a docx file created after running my app but it has blank content whereas the html does have some content in it. Please check the code below and I have included all necessary libraries from AndroidDocxtoHTML example on git.
Code:
// HTML Code
String html = "<html><head><title>Import me</title></head><body><p>Hello World!</p></body></html>";
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(new PartName("/hw.html"));
afiPart.setBinaryData(html.getBytes());
afiPart.setContentType(new ContentType("text/html"));
Relationship altChunkRel = wordMLPackage.getMainDocumentPart().addTargetPart(afiPart);
// .. the bit in document body
CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk();
ac.setId(altChunkRel.getId() );
wordMLPackage.getMainDocumentPart().addObject(ac);
// .. content type
wordMLPackage.getContentTypeManager().addDefaultContentType("html", "text/html");
I do not understand what's missing in the code that I get blank document. I found this code for java which i modified for android. Some people suggested using nightly build jar for xhtml conversions. Do I need to use that?