I installed the Docx4jHelper this morning (Win7 with Word 2010) and have been working with it all day long. It works just great and has realy boosted my productivity. Thanks for this great tool! :D
Christoph
It is currently Tue Nov 26, 2024 7:35 am
HashMap<String, Object> hp = new HashMap<>();
hp.put("a_picture", resultSet.getBytes("ALUMNUS_PICTURE"));
byte[] bytes2 = serializeObject(data.get("a_picture"));
P paragraph = addImageToParagraph(createInlineImage(wordMLPackage,
wordMLPackage.getMainDocumentPart(), bytes2, "filename", "alttext", 1, 2));
Drawing drw = (Drawing) XmlUtils.unwrap(drawingObjList.get(0));
if(drw != null)
{
List<Object> grp = ((Drawing) XmlUtils.unwrap(drw)).getAnchorOrInline();
if( grp != null)
{
Graphic grpdata = ((Inline) XmlUtils.unwrap(grp.get(0))).getGraphic();
byte[] imgBytes = BinaryPartAbstractImage.getImage(wProcessorPackage, grpdata);
RenderedImage renderImage = ImageIO.read(new ByteArrayInputStream(imgBytes));
ImageIO.write(renderImage, "jpg", new File("/Users/gwuser164/Desktop/Images/image.jpg"));
}
}
Exception in thread "main" java.lang.NoSuchMethodError: com.lowagie.text.pdf.BaseFont.getCharBBox(I)[I
at org.docx4j.org.xhtmlrenderer.pdf.ITextFontResolver$FontDescription.setMetricDefaults(ITextFontResolver.java:730)
at org.docx4j.org.xhtmlrenderer.pdf.ITextFontResolver$FontDescription.<init>(ITextFontResolver.java:661)
at org.docx4j.org.xhtmlrenderer.pdf.ITextFontResolver.addCourier(ITextFontResolver.java:461)
at org.docx4j.org.xhtmlrenderer.pdf.ITextFontResolver.createInitialFontMap(ITextFontResolver.java:441)
at org.docx4j.org.xhtmlrenderer.pdf.ITextFontResolver.<init>(ITextFontResolver.java:41)
at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.<init>(DocxRenderer.java:160)
at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.<init>(DocxRenderer.java:85)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.getRenderer(XHTMLImporterImpl.java:218)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.convert(XHTMLImporterImpl.java:620)
at lib_protocollo.Docx4j_HtmlToWord.htmlToWord(Docx4j_HtmlToWord.java:64)
at lib_protocollo.Lib_protocollo.createWord(Lib_protocollo.java:210)
at lib_protocollo.Lib_protocollo.main(Lib_protocollo.java:66)
Total posts 10111 • Total topics 2842 • Total members 2074