docx4j

ava.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

纵然是瞬间 提交于 2020-01-14 13:55:15
问题 I am Using docx4j to read Docx file from sd card. I have problem with org.apache.log4j.Logger library. I have even tried to add it externally. but it is still giving me same problem. build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.shvet.pdfreaders" minSdkVersion 11 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles

Docx4j with grails. Convert HTML to word document

假装没事ソ 提交于 2020-01-14 06:23:09
问题 I'm using Docx4j 3.1.0 with Xalan 2.7.1 in grails 2.3.7. Here I've done the integration of docx4j with grails and I'm able to generate word document. But I want pass a gsp or html template to the Docx4j and generate word document. Is it possible ? And if yes, how to do it? As well as how to pass image which can be displayed in document. 回答1: You can use docx4j-ImportXHTML; see the examples. 来源: https://stackoverflow.com/questions/23467369/docx4j-with-grails-convert-html-to-word-document

Count pages/lines in a word file that was edited with docx4j

喜欢而已 提交于 2020-01-06 04:45:05
问题 I found some posts here how to count pages/lines with the apache-poi library. But my code already uses docx4j right now, it would be too much work to completely replace that. Therefore my question is, how can I get from an object of type WordprocessingMLPackage to an object of type XWPFDocument in order to count the lines and pages of my current document. private XWPFDocument convertDocx4J(WordprocessingMLPackage wp) { XWPFDocument oiDoc = null; //TODO... return oiDoc; } 回答1: Easiest way to

docx4j : “No suitable JAXB implementation available” runtime error Java 1.5

浪子不回头ぞ 提交于 2020-01-05 07:14:34
问题 I am using docx4j to parse docx file. I downloaded all JARs from docx4j site docx4j downloads. When I used it in code, it gives runtime error at very first line of code: - WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("Global_OPO_Profile_EN.docx"))); Exception is: INFO org.docx4j.utils.Log4jConfigurator .configure line 45 - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically. ERROR org.docx4j.jaxb

docx4j : “No suitable JAXB implementation available” runtime error Java 1.5

安稳与你 提交于 2020-01-05 07:14:17
问题 I am using docx4j to parse docx file. I downloaded all JARs from docx4j site docx4j downloads. When I used it in code, it gives runtime error at very first line of code: - WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("Global_OPO_Profile_EN.docx"))); Exception is: INFO org.docx4j.utils.Log4jConfigurator .configure line 45 - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically. ERROR org.docx4j.jaxb

MOXy XMLCompositeCollectionMapping descriptor is missing

柔情痞子 提交于 2020-01-05 07:01:12
问题 docx4j (which I host) is typically used with the Sun/Oracle JAXB implementation; the classes of interest below were generated using XJC. I thought I'd try EclipseLink MOXy, to see how it went. On context init, I get the following error: ERROR org.docx4j.jaxb.Context .<clinit> line 107 - Cannot initialize context javax.xml.bind.JAXBException: Descriptor Exceptions: --------------------------------------------------------- Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2

docx4j replace variable with html

﹥>﹥吖頭↗ 提交于 2020-01-04 14:08:37
问题 i got this sample code to replace variables with text and it works perfect. WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File("c:/template.docx")); VariablePrepare.prepare(wordMLPackage); MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart(); HashMap<String, String> mappings = new HashMap<String, String>(); mappings.put("firstname", "Name"); //${firstname} mappings.put("lastname", "Name"); //${lastname} documentPart.variableReplace(mappings);

Docx4j export style from one .docx and use it in another .docx

纵饮孤独 提交于 2020-01-04 05:38:06
问题 I am creating new Word document with the code below: Tidy tidy = new Tidy(); tidy.setShowWarnings(true); tidy.setInputEncoding("UTF-8"); tidy.setOutputEncoding("UTF-8"); tidy.setXHTML(true); tidy.setMakeClean(true); tidy.setQuoteNbsp(false); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage); for (Value v : res.getRules()) { System.out.println(v.toString()); ByteArrayOutputStream ou = new

How can I detect org.docx4j.wml.instrText when parsing DOCX with docx4j?

余生长醉 提交于 2020-01-02 15:26:59
问题 I want to pars a docx file with docx4j library. I need to detect org.docx4j.wml.instrText objects but actually it returns org.docx4j.wml.Text instead of org.docx4j.wml.instrText. I found a solution that was working with older version of this library here: http://www.docx4java.org/forums/docx-java-f6/can-i-just-don-t-load-contents-of-w-instrtext-into-text-t193.html Actually this solution: ((javax.xml.bind.JAXBElement)((org.docx4j.wml.Text) o).getParent()).getName().getLocalPart() But with the

How can I detect org.docx4j.wml.instrText when parsing DOCX with docx4j?

a 夏天 提交于 2020-01-02 15:26:38
问题 I want to pars a docx file with docx4j library. I need to detect org.docx4j.wml.instrText objects but actually it returns org.docx4j.wml.Text instead of org.docx4j.wml.instrText. I found a solution that was working with older version of this library here: http://www.docx4java.org/forums/docx-java-f6/can-i-just-don-t-load-contents-of-w-instrtext-into-text-t193.html Actually this solution: ((javax.xml.bind.JAXBElement)((org.docx4j.wml.Text) o).getParent()).getName().getLocalPart() But with the