Hi ,
I attempt to insert HTML data into Rich Text Content Control into a table cell in my template (.docx).
Extract code :
AlternativeFormatInputPart afiPart = null;
afiPart = new AlternativeFormatInputPart(new PartName("/hw.html")); //CAUTION: each html part needs a new name!!
afiPart.setBinaryData(html.getBytes("UTF-8"));
afiPart.setContentType(new ContentType("text/html"));
Relationship altChunkRel = null;
altChunkRel = template.getMainDocumentPart().addTargetPart(afiPart);
CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk();
ac.setId(altChunkRel.getId());
Tc parent = (Tc)toReplace.getParent();
int subIndex = parent.getContent().indexOf(p);
parent.getContent().set(subIndex,ac);
OutputStream os = new java.io.FileOutputStream(outputPdfPath + ".pdf");
Docx4J.toPDF(wordMLPackage, os); ...