xHTMLImporter.setSequenceCounters(sequenceCounters); xHTMLImporter.setMaxWidth(-1, null); // re-init if (bindingTraverserState.tcStack.peek() != null) { log.debug("inserting in a tc" ); xHTMLImporter.setHyperlinkStyle(BindingHandler.getHyperlinkResolver().getHyperlinkStyleId()); List<Object> results = null; try { results = xHTMLImporter.convert(r, baseUrl );
try { results = xHTMLImporter.convert(toString(afip.getBuffer()), null);
XHTMLImporter xi = new XHTMLImporter(); xi.setHyperlinkStyle("Hyperlink");
/** * Get table cell width from tc and table style from tbl and set it to xHTMLImporter. * @param tbl * @param tc * @param xHTMLImporter */ public static void setupMaxWidthAndStyleForTc(Tbl tbl, Tc tc, XHTMLImporter xHTMLImporter) { if(tc.getTcPr() != null && tc.getTcPr().getTcW() != null) { TblWidth tcW = tc.getTcPr().getTcW(); if (tcW.getW()!= null && tcW.getType().equals(TblWidth.TYPE_DXA)) { int maxWidth = tcW.getW().intValue(); String styleVal = null; if(tbl != null && tbl.getTblPr() != null && tbl.getTblPr().getTblStyle() != null) { styleVal = tbl.getTblPr().getTblStyle().getVal(); } log.debug("inserting in a tc, with maxwidth: " + maxWidth + ", and table style: " + styleVal); xHTMLImporter.setMaxWidth(maxWidth, styleVal); } else { log.debug("w:tcPr/w:tcW present, but width not in dxa units "); } } else { log.debug("w:tcPr/w:tcW not present"); } } }
public WordprocessingMLPackage export(String xhtml) { WordprocessingMLPackage wordMLPackage = null; try { RFonts arialRFonts = Context.getWmlObjectFactory().createRFonts(); arialRFonts.setAscii("Arial"); arialRFonts.setHAnsi("Arial"); XHTMLImporterImpl.addFontMapping("Arial", arialRFonts); wordMLPackage = WordprocessingMLPackage.createPackage(); XHTMLImporter importer = new XHTMLImporterImpl(wordMLPackage); List<Object> content = importer.convert(xhtml,null); wordMLPackage.getMainDocumentPart().getContent().addAll(content); } catch (Docx4JException e) { // ... } return wordMLPackage; }
/** * Get table cell width from tc and table style from tbl and set it to xHTMLImporter. * @param tbl * @param tc * @param xHTMLImporter */ public static void setupMaxWidthAndStyleForTc(Tbl tbl, Tc tc, XHTMLImporter xHTMLImporter) { if(tc.getTcPr() != null && tc.getTcPr().getTcW() != null) { TblWidth tcW = tc.getTcPr().getTcW(); if (tcW.getW()!= null && tcW.getType().equals(TblWidth.TYPE_DXA)) { int maxWidth = tcW.getW().intValue(); String styleVal = null; if(tbl != null && tbl.getTblPr() != null && tbl.getTblPr().getTblStyle() != null) { styleVal = tbl.getTblPr().getTblStyle().getVal(); } log.debug("inserting in a tc, with maxwidth: " + maxWidth + ", and table style: " + styleVal); xHTMLImporter.setMaxWidth(maxWidth, styleVal); } else { log.debug("w:tcPr/w:tcW present, but width not in dxa units "); } } else { log.debug("w:tcPr/w:tcW not present"); } } }
xHTMLImporter.setSequenceCounters(sequenceCounters); xHTMLImporter.setMaxWidth(-1, null); // re-init if (bindingTraverserState.tcStack.peek() != null) { log.debug("inserting in a tc" ); xHTMLImporter.setHyperlinkStyle(BindingHandler.getHyperlinkResolver().getHyperlinkStyleId()); List<Object> results = null; try { results = xHTMLImporter.convert(r, baseUrl );
try { results = xHTMLImporter.convert(toString(afip.getBuffer()), null);
try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null); locatedChunk.getContentList().remove(locatedChunk.getIndex());
try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null); locatedChunk.getContentList().remove(locatedChunk.getIndex());