Skip to content
Snippets Groups Projects
Commit 33d34bda authored by srosse's avatar srosse
Browse files

OO-690: add docx4j library and update hibernate, spring...

parent b35e985a
No related branches found
No related tags found
No related merge requests found
......@@ -64,13 +64,13 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<targetJdk>1.6</targetJdk>
<org.springframework.version>3.2.3.RELEASE</org.springframework.version>
<org.hibernate.version>4.2.3.Final</org.hibernate.version>
<org.springframework.version>3.2.4.RELEASE</org.springframework.version>
<org.hibernate.version>4.2.5.Final</org.hibernate.version>
<com.sun.jersey.version>1.17.1</com.sun.jersey.version>
<jackson.version>1.9.2</jackson.version>
<org.mysql.version>5.1.24</org.mysql.version>
<org.mysql.version>5.1.26</org.mysql.version>
<org.postgresql.version>9.1-901.jdbc4</org.postgresql.version>
<org.infinispan.version>5.2.5.Final</org.infinispan.version>
<org.infinispan.version>5.2.7.Final</org.infinispan.version>
<!-- properties for testing and Q&A -->
<!-- by default no tests are executed so far (April 2011). Use appropriate profiles and properties on the command line -->
......@@ -380,17 +380,30 @@
</exclusion>
</exclusions>
</dependency>
<!-- webservice stack -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.6</version>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
<version>1.2.8</version>
</dependency>
<!-- for docx4j -->
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
</dependencies>
<build>
......@@ -522,6 +535,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
</dependencies>
<build>
......@@ -1628,15 +1647,16 @@
<artifactId>viterows</artifactId>
<version>4.4</version>
</dependency>
<!-- docx4j need poi scratchpad version 3.8 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.7</version>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
......@@ -1773,6 +1793,21 @@
<artifactId>batik-util</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>2.8.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
</exclusion>
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.java2html</groupId>
<artifactId>java2html</artifactId>
......
......@@ -5,6 +5,7 @@
<module name="org.infinispan" />
<module name="org.joda.time" />
<module name="org.hibernate" />
<module name="org.apache.xalan" />
<module name="org.apache.httpcomponents" />
<module name="org.codehaus.jackson.jackson-core-asl" />
<module name="org.codehaus.jackson.jackson-mapper-asl" />
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.ims.qti;
import org.docx4j.XmlUtils;
import org.docx4j.convert.in.xhtml.XHTMLImporter;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.NumberingDefinitionsPart;
import org.junit.Test;
/**
*
* Initial date: 02.09.2013<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class ExportDocxTest {
@Test
public void testConvertToDocx() throws Exception {
String html = "<html><head><title>Import me</title></head><body><p>Hello World!</p><table><tr><td>some text</td><td>a</td><td>kjhs kjdfhj kjdfhk kjsdk hjdfhk khjsdfh kjdfkj jhdfh khjdfhk kjhdf kh après il vient quelque-chose d'important et surtout de compréhensible</td></tr><tr><td>some text</td><td>a</td><td>kjhs kjdfhj kjdfhk kjsdk hjdfhk khjsdfh kjdfkj jhdfh khjdfhk kjhdf kh</td></tr></table></body></html>";
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
ndp.unmarshalDefaultNumbering();
wordMLPackage.getMainDocumentPart().getContent().addAll(XHTMLImporter.convert(html, null, wordMLPackage));
System.out.println(XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true));
wordMLPackage.save(new java.io.File("/HotCoffee/html_output.docx"));
System.out.println("done");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment