FAQ Database Discussion Community


Create table in word doc using docx4j in specific bookmark:

java,docx4j
I’m creating a table in specific bookmark location (means it's adisplay table in word doc), but after converting word to PDF it can't show table in PDF because of bookmark is inside a w:p!! <w:p w:rsidR="00800BD9" w:rsidRDefault="00800BD9"> <w:bookmarkStart w:id="0" w:name="abc"/> <w:bookmarkEnd w:id="0"/> </w:p> Now I want to find the paragraph...

Java program that uses pptx4j throws org/apache/commons/lang/NotImplementedException

java,docx4j
I'm using sample code from www.docx4java.org to run the program that will create a powerpoint slide so that i can learn the use of the docx4j library. But it gives me an exception even tough i have already added both commons-logging-1.2.jar and commons-logging-1.2-javadoc.jar to my classpaths library as (in which...

set case of content bound via content controls in docx

ms-word,docx,docx4j
I have a docx file that contains a custom part and a web page that collects input from the user to populate that custom part. One of my "variables" is used multiple times in the document. In some cases, I need it to appear in ALL CAPS. In most cases,...

ClassNotFoundException: org.docx4j.openpackaging.exceptions.Docx4JException

java,intellij-idea,docx4j
So here we go again. My head is banging on my PC about few hours, I can't figured out what to do. On my local PC I run the java code from Intellij Idea. It works. Now I have to create jar file to make it able to use on...

How to replace text in Powerpoint file with Java

java,powerpoint,docx4j
I have a requirement where I need to replace some text in a Powerpoint File at runtime. (Powerpoint file is being used as a template with some placeholders/tokes e.g. {{USER_NAME}}) I have tried using POI but with no luck. I referred to the other links on the forum and started...

Java report generation

java,docx4j
I am using docx4j for report generation in my java program. I can add text to the report but i cannot add images to the report. I'm trying to add an image for the report using the following code WordprocessingMLPackage wordprocessingMLPackage = WordprocessingMLPackage.createPackage(); InputStream frontImageInputStream = new FileInputStream(new File(fileNameAndPath)); byte[]...

Converting a docx containing a chart to PDF

java,pdf,charts,docx,docx4j
I've got a docx4j generated file which contains several tables, titles and, finally, an excel-generated curve chart. I have tried many approaches in order to convert this file to PDF, but did not get to any successful result. Docx4j with xsl-fo did not work, most of the things included in...

How can i create a list of docx4j objects in java?

java,arrays,arraylist,docx4j
I am trying to create a list of objects of pptx4j slides from the docx4j library of Java. I downloaded a sample code from http://www.docx4java.org/ and i have tried modifying it so instead of printing one slide it can print as many as i want by adding a little for...

Unable to load an xlxs spreadsheet into eclipse

java,eclipse,jaxb,docx4j
I want to implement a java desktop-application using eclipse that takes the information from the user and saves it into excel spreadsheet (using docx4j), but I faced a problem at the very beginning. I'm trying to load the spreadsheet using this code: private static void load(String filepath) { SpreadsheetMLPackage exc;...

Word, docx4j and content control text formatting

java,ms-word,docx4j
I'm using docx4j to create Word documents using a Word template. The template contents control which in the document are filled with text by my Java code. The problem is that the formatting I have added to some of the controls has no effect. I have tried formatting with both...

Printing contents of xlsx sheet

java,eclipse,docx4j,import-from-excel
I'm using docx4j in eclipse to get the contents of an excel sheet but all what I'm getting is numbers. For simplicity, assume this is my sheet: | asd | sd | | hgn | The code I'm using to load the contents is: public static void load(String outputfilepath) throws...

embed images as base64 instead of outputing to folder

c#,docx4j,docx4j.net
When converting from docx to html you may specify the output path for any images org.docx4j.Docx4J.toHTML(wordMLPackage, imageDirPath, imageTargetUri, fos2); and the resulting html document references images via files: <img height="22" id="rId7" src="..cc6bcedf-2770-45ad-8e81-610bbd8746ceimage1.png" width="42"> Instead I would like the converter to embed the files as base64. Is this possible?...

Need suggestions regarding the .doc file reading in android

android,apache-poi,document,docx4j
I'll be working on a new app that reads the .doc and .docx files and get the number of words, no of lines, no of pages, no of images, no of formula's so so from the particular word document. So, i used the Java Scanner class to get the word...

Cannot count number of characters in a docx file generated from a not empty XHTML

java,jaxb,xhtml,docx,docx4j
I implemented a XHTML converter to DocX using DocX4J. It creates the DocX file without problems. To finish my task I decided to implement a simple test. The test consists in counting the number os chars in the DocX created and then comparing it with the already known number of...

docx4j adding style to paragraph destroys document

java,docx4j
I'm trying to add a paragraph containing a headline (with style) and some plain unformatted text. The following code destroys the document. Edit: After executing the following code and trying to open the document in word I get an error message "Unspecified Error" Location: Part /word/document.xml Line 1 Column 0...

How to preserve the HTML when creating a .docx with docx4j?

java,escaping,docx4j,html-escape-characters,html-escape
I've started today using docx4j; I've succesfully created a document with a table, fed with content coming from an external source. This content has simple HTML inside, for example a column may contain a String like: String content = "Hello&nbsp;<strong>Word</strong><br>"; If if put this String in the column with the...