Giter VIP home page Giter VIP logo

opensagres / xdocreport Goto Github PK

View Code? Open in Web Editor NEW
1.2K 1.2K 363.0 26.43 MB

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).

Home Page: https://github.com/opensagres/xdocreport

Java 96.31% HTML 0.02% Shell 0.05% JavaScript 0.73% XSLT 2.68% Batchfile 0.07% FreeMarker 0.13%

xdocreport's People

Contributors

alediator avatar angelozerr avatar avl93 avatar brett-walker avatar codecracker2014 avatar dependabot[bot] avatar goekay avatar gsancewicz avatar hpham avatar marcus-nl avatar marspb avatar mgolebsk avatar mishadoff avatar muued avatar nekosunflower avatar nelsongraca avatar pascalleclercq avatar pensionarchitects-ben avatar pierco avatar prasad-metricstream avatar raphaelazzolini avatar ravenq avatar redalogobject avatar superpat45 avatar tiry avatar vpostrigan avatar wyfrel avatar xylo avatar yoseph-phillips avatar zzt93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xdocreport's Issues

static hyperlink insert issue

Hello!

I used the first example in the article https://code.google.com/p/xdocreport/wiki/DocxReportingJavaMain, so i opened DocxProjectWithVelocity.docx file, selected field «$project.Name» in template and inserted some hyperlink (ex: http://google.com),

hyperlink_exception

when the exception described below occured. What i did wrong?

Thanks

Exception in thread "main" java.lang.NullPointerException
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.RBufferedRegion.getTContent(RBufferedRegion.java:95)
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.hyperlinks.HyperlinkBufferedRegion.getAllTContent(HyperlinkBufferedRegion.java:189)
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.hyperlinks.HyperlinkBufferedRegion.process(HyperlinkBufferedRegion.java:100)
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.DocxBufferedDocument.onEndEndElement(DocxBufferedDocument.java:359)
at fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler.endElement(BufferedDocumentContentHandler.java:273)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1781)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2957)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at fr.opensagres.xdocreport.document.preprocessor.sax.SAXXDocPreprocessor.preprocess(SAXXDocPreprocessor.java:62)
at fr.opensagres.xdocreport.document.preprocessor.sax.SAXXDocPreprocessor.preprocess(SAXXDocPreprocessor.java:47)
at fr.opensagres.xdocreport.document.preprocessor.AbstractXDocPreprocessor.preprocess(AbstractXDocPreprocessor.java:88)
at fr.opensagres.xdocreport.document.AbstractXDocReport.doPreprocessorIfNeeded(AbstractXDocReport.java:366)
at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:512)
at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:487)
at xdocreporttest.XDocReportTest.main(XDocReportTest.java:47)

Extract Velocity / FreeMarker code from docx

Hi,
first of all thanks for xdocreport! Very useful and nice library!

Maybe it is possible to synchronize this repository with the one of google code? Otherwise this one here is a little bit out of date, isn't it?
Currently I try to clone the source from google code, but my (latest) git installation seems to get stuck at some time. I think with github it would be much easier to fork your repository and provide pull requests :)
(only a suggestion, it is your choice of technology stack, but I like GitHub more and I think google code gets deprecated more and more) :)

Maybe also a short question, why I am trying to get into your code: Is there any entry point in your code for extracting the freemarker / velocity code out of a docx file?
Sometimes I get a ParseErrorException, when only modifying one single character in the docx document, which should not affect any template meta-code. I think word restructures (optimizes) the document code whenever saving a document. Thus the previous template meta-code might get invalid at some point in time, but for the editor this is not easy to understand as obviously nothing has changed.

So what I need is the extraction of all meta-code of a docx format, so that I can see the syntax error and adapt or rewrite the docx document at this point.

I try to discuss this issue also here: https://groups.google.com/forum/#!topic/xdocreport/dlW_DjDK0fo but we did not resolve the problem at all.

NullPointerException in RBufferedRegion.java

HI:
I try to use XDocReport to merge data into the Word file (docx files), then exception happening

Exception in thread "main" java.lang.NullPointerException
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.RBufferedRegion.setTContent(RBufferedRegion.java:65)
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.PBufferedRegion.process(PBufferedRegion.java:216)
at fr.opensagres.xdocreport.document.docx.preprocessor.sax.DocxBufferedDocument.onEndEndElement(DocxBufferedDocument.java:320)
at fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler.endElement(BufferedDocumentContentHandler.java:273)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at fr.opensagres.xdocreport.document.preprocessor.sax.SAXXDocPreprocessor.preprocess(SAXXDocPreprocessor.java:62)
at fr.opensagres.xdocreport.document.preprocessor.sax.SAXXDocPreprocessor.preprocess(SAXXDocPreprocessor.java:47)
at fr.opensagres.xdocreport.document.preprocessor.AbstractXDocPreprocessor.preprocess(AbstractXDocPreprocessor.java:88)
at fr.opensagres.xdocreport.document.AbstractXDocReport.doPreprocessorIfNeeded(AbstractXDocReport.java:366)
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:694)
at word.DocxProjectWithVelocity2PDF.main(DocxProjectWithVelocity2PDF.java:208)

I cannot upload my DOCX and java file. I find the same issue in https://code.google.com/p/xdocreport/issues/detail?id=424. But I have no idea that what is 1.0.5-SNAPSHOT?

What version of the product are you using? On what operating system?
XDocReport 1.0.4, Windows 7 64Bit. Spring/Eclipse 3.2 with JDK6

Can't convert odt with tables to PDF

I'm trying to convert an ODT template into PDF using Freemarker. First i fill the template (in another ODT file) from DB then convert it into PDF but always receive the same error in the conversion (java.lang.NoSuchMethodError: org.odftoolkit.odfdom.converter.pdf.internal.stylable.StylableTableCell.setRowspan(I)V).
Need any config file for tables? Thanks for help

Code

try {
// 1) Load ODT file by filling Velocity template engine and cache
// it to the registry
InputStream in = Prueba1.class.getResourceAsStream("pruebaTabla.odt");
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Freemarker);

        // 2) Create context Java model
        IContext context = report.createContext();      
                //Add data into context
                context.put("numidentidad", numIdentidad);
        context.put("nombre", nombre);
        context.put("apellido1", apellido1);
        context.put("apellido2", apellido2);
        context.put("fechanacimiento", fechaNacimiento);
        context.put("telefonofijo", telefonoFijo);
        context.put("telefonomovil", telefonoMovil);
        context.put("correoelectronico", correoElectronico);

        File file = new File("Plantilla2.odt");
        FileOutputStream out = new FileOutputStream(file);

        // 3) Generate report by merging Java model with the ODT
        report.process(context, out);           
        FileInputStream inRead = new FileInputStream(file);

         //4) Load odt with ODFD
        OdfTextDocument document = OdfTextDocument.loadDocument(inRead);
        inRead.close();
        out.close();

        // 5) Convert ODFDOM OdfTextDocument 2 PDF with iText
        OutputStream salida = new FileOutputStream(outFile);
        PdfOptions options = PdfOptions.create();
        PdfConverter.getInstance().convert(document, salida, options);
        Desktop.getDesktop().open(outFile);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (XDocReportException e) {
        e.printStackTrace();
    }

fr.opensagres.xdocreport.converter.XDocConverterException: java.lang.IllegalAccessError

Hello,
I've implemented web application, REST service, where I convert either odt or docx documents to pdf. I don't use xdocreport REST sample implementation but mine based on resteasy. Then installed war archive on jboss 7.1 AS.

I encounter exception in both cases (odt and docx). ODT is the same as https://code.google.com/p/xdocreport/issues/detail?id=470
When testing report/convert as console application (no REST service there, just java main), everything runs fine.

xdocreport version: 1.0.5
iText version: 2.1.7

pom.xml:

    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.document.odt</artifactId>
        <version>1.0.5</version>
    </dependency>

    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
        <version>1.0.5</version>
    </dependency>

    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
        <version>1.0.5</version>
    </dependency>

    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.converter.odt.odfdom</artifactId>
        <version>1.0.5</version>
    </dependency>       

    <dependency>
        <groupId>fr.opensagres.xdocreport</groupId>
        <artifactId>fr.opensagres.xdocreport.converter.docx.xwpf</artifactId>
        <version>1.0.5</version>
    </dependency>

Java code fragment:

@GET
@Produces( "application/pdf" )
@Path( "/document" )
public Response convert()
{
  StreamingOutput output = new StreamingOutput()
  {
    public void write( OutputStream out )
    {
      // try omitted here
      InputStream in = ServiceImpl.class.getClassLoader().getResourceAsStream("template.odt"); // or docx
      IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in,TemplateEngineKind.Velocity);

      IContext context = report.createContext();
      context.put("salutation", "Bonjour le monde!");

      Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.ODFDOM); // or XWPF
      report.convert(context, options, out);
      // catch block omitted here
    }
  };
  ResponseBuilder responseBuilder = Response.ok( output);
  responseBuilder.header( HttpHeaderUtils.CONTENT_DISPOSITION_HEADER, HttpHeaderUtils.getAttachmentFileName( "document.pdf" ));

  return responseBuilder.build();
}

ODFDOM version log:

fr.opensagres.xdocreport.converter.XDocConverterException: java.lang.IllegalAccessError: tried to access class com.lowagie.text.pdf.PdfDocument from class fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:748) ~[fr.opensagres.xdocreport.document-1.0.5.jar:1.0.5]
    at my.webapp.impl.ServiceImpl$1.write(ServiceImpl.java:102) ~[classes:na]
    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:32) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:17) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:585) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:506) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar!/:1.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116) [portal-service.jar!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
    at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67) [portal-service.jar!/:na]
    at com.sun.proxy.$Proxy2286.doFilter(Unknown Source) [na:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109) [portal-service.jar!/:na]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96) [portal-service.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar!/:na]
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar!/:7.1.1.Final]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar!/:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar!/:na]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
Caused by: java.lang.IllegalAccessError: tried to access class com.lowagie.text.pdf.PdfDocument from class fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter
    at fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter.getInstance(ExtendedPdfWriter.java:48) ~[fr.opensagres.xdocreport.itext.extension-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.itext.extension.ExtendedDocument.<init>(ExtendedDocument.java:62) ~[fr.opensagres.xdocreport.itext.extension-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.pdf.internal.stylable.StylableDocument.<init>(StylableDocument.java:76) ~[org.odftoolkit.odfdom.converter.pdf-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.pdf.internal.ElementVisitorForIText.<init>(ElementVisitorForIText.java:148) ~[org.odftoolkit.odfdom.converter.pdf-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.pdf.PdfConverter.processBody(PdfConverter.java:114) ~[org.odftoolkit.odfdom.converter.pdf-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:65) ~[org.odftoolkit.odfdom.converter.pdf-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:43) ~[org.odftoolkit.odfdom.converter.pdf-1.0.5.jar:1.0.5]
    at org.odftoolkit.odfdom.converter.core.AbstractODFConverter.convert(AbstractODFConverter.java:42) ~[org.odftoolkit.odfdom.converter.core-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.converter.odt.odfdom.itext.ODF2PDFViaITextConverter.convert(ODF2PDFViaITextConverter.java:62) ~[fr.opensagres.xdocreport.converter.odt.odfdom-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:713) ~[fr.opensagres.xdocreport.document-1.0.5.jar:1.0.5]
    ... 48 common frames omitted

XWPF version log:

fr.opensagres.xdocreport.converter.XDocConverterException: java.lang.IllegalAccessError: com/lowagie/text/pdf/PdfDocument
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:748) ~[fr.opensagres.xdocreport.document-1.0.5.jar:1.0.5]
    at my.webapp.impl.ServiceImpl$1.write(ServiceImpl.java:102) ~[classes:na]
    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:32) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:17) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:585) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:506) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar!/:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar!/:1.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116) [portal-service.jar!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
    at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67) [portal-service.jar!/:na]
    at com.sun.proxy.$Proxy2286.doFilter(Unknown Source) [na:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109) [portal-service.jar!/:na]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109) [portal-service.jar!/:na]
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96) [portal-service.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar!/:na]
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar!/:7.1.1.Final]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar!/:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar!/:na]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar!/:na]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
Caused by: java.lang.IllegalAccessError: com/lowagie/text/pdf/PdfDocument
    at fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter.getInstance(ExtendedPdfWriter.java:48) ~[fr.opensagres.xdocreport.itext.extension-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.itext.extension.ExtendedDocument.<init>(ExtendedDocument.java:62) ~[fr.opensagres.xdocreport.itext.extension-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.pdf.internal.elements.StylableDocument.<init>(StylableDocument.java:78) ~[org.apache.poi.xwpf.converter.pdf-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.pdf.internal.PdfMapper.startVisitDocument(PdfMapper.java:159) ~[org.apache.poi.xwpf.converter.pdf-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.pdf.internal.PdfMapper.startVisitDocument(PdfMapper.java:111) ~[org.apache.poi.xwpf.converter.pdf-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:196) ~[org.apache.poi.xwpf.converter.core-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:56) ~[org.apache.poi.xwpf.converter.pdf-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:38) ~[org.apache.poi.xwpf.converter.pdf-1.0.5.jar:1.0.5]
    at org.apache.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:45) ~[org.apache.poi.xwpf.converter.core-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.convert(XWPF2PDFViaITextConverter.java:67) ~[fr.opensagres.xdocreport.converter.docx.xwpf-1.0.5.jar:1.0.5]
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:713) ~[fr.opensagres.xdocreport.document-1.0.5.jar:1.0.5]
    ... 48 common frames omitted

Wrong line-height/margin in pdf

The pdf table I'm trying to generate looks different in pdf than in docx. The same is true for text paragraphs not in table.

I'm using xDocReport 1.0.5 and running Office 2010.

Docx:
table_docx

Pdf:
table_pdf

Duplicate XHTMLPageBeforeBody with different content

We have a problem when building our assembly:
_
[04:00:13]Step 1/1: build and deploy (Simple Build Tool (Scala)) (10m:45s)
[04:09:56][Step 1/1] 1 error was encountered during merge
[04:10:58]
Step 1/1 deduplicate: different file contents found in the following:
/home/tca/work/teamcityagent/temp/ivy2/cache/fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension/jars/fr.opensagres.xdocreport.itext.extension-1.0.5.jar:fr/opensagres/xdocreport/xhtml/extension/XHTMLPageBeforeBody.class
/home/tca/work/teamcityagent/temp/ivy2/cache/fr.opensagres.xdocreport/org.odftoolkit.odfdom.converter.xhtml/jars/org.odftoolkit.odfdom.converter.xhtml-1.0.5.jar:fr/opensagres/xdocreport/xhtml/extension/XHTMLPageBeforeBody.class
[04:10:59][Step 1/1] Step build and deploy (Simple Build Tool (Scala)) failed
_

The only difference in the two files are:
import org.odftoolkit.odfdom.converter.core.utils.StringUtils;
vs
import fr.opensagres.xdocreport.utils.StringUtils;

ODT --> PDF Tabbing issues

I am looking into xdocreport to replace a Windows process which has an OO
install and performs ODT -> PDF conversions. We have a large number of ODT
documents which contain tabs.

I read the xdocreport Wiki on the iText issue with Tabs and see this as a
non-starter for moving to xdocreport for odt conversions. Is there a
work-around for this issue other than removing the tabs from the odts?

I also read this on iText: http://itextpdf.com/sandbox/objects/Tabs
and was wondering if there is now a way to support tabbing in ODT --> PDF conversions?

Thanks,
Kevin

Multithreading problem

Hi,I'm converting odt to pdf with a multithread application 10-20 thread

I'm using 1.0.5 on windows 7 64 bit with these libraries

org.odftoolkit.odfdom.converter.pdf-1.0.5.jar
org.odftoolkit.odfdom.converter.core-1.0.5.jar
fr.opensagres.xdocreport.itext.extension-1.0.5.jar
itext 2.1.7
odfdom-java-0.8.7.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar

Hi receive this exception,something seems non thread safe:

rg.odftoolkit.odfdom.converter.core.ODFConverterException: java.util.ConcurrentModificationException
at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:82)
at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:43)
at org.odftoolkit.odfdom.converter.core.AbstractODFConverter.convert(AbstractODFConverter.java:42)
at fr.opensagres.xdocreport.samples.odt.converters.pdf.TestConverter.convert(TestConverter.java:67)
at fr.opensagres.xdocreport.samples.odt.converters.pdf.MultiThreadManipolationRunnerDocX.run(MultiThreadManipolationRunnerDocX.java:65)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at com.lowagie.text.FontFactoryImp.getFont(Unknown Source)
at com.lowagie.text.FontFactoryImp.getFont(Unknown Source)
at com.lowagie.text.FontFactory.getFont(Unknown Source)
at com.lowagie.text.FontFactory.getFont(Unknown Source)
at fr.opensagres.xdocreport.itext.extension.font.AbstractFontRegistry.getFont(AbstractFontRegistry.java:53)

Supported Java version?

Are you aware of any constraints regarding the version of Java to be used with XDocReport and its dependencies (-> java 6, 7, 8)?

Thanks,
--Nick

convert with JODConverter

Hi,
I created MyServlet implements AbstractProcessXDocReportServlet for generate à report with OpenOffice odt ,MyServlet works fine and generates report .odt but I want to convert the file generated to another format with JODConverter API ,my question is how can I retrieve the file generated by the MyServlet and send it to another servelt or programme so that I use JODConverter API to convert the file

Thanks.

How to format a date type value in a velocity template ?

Hi,

I would like to choose the format of date value into the velocity template. Here is a simple example.

I've a model Person with an attribute of date type (i.e Date birthday).

public class Person {
Date birthday
}

In my context i give the instance of my Person

IContext context = report.createContext();
context.put("incoming", refModel);

Into my Word document, actually i have this template content

$incoming.birthday

But the result is not "user friendly". Do you have an idea to format directly my date value into the velocity template ? I don't want to add a specific value into the context with the right format value of my date...

Thanks

Mickael

Docx to PDF: default font size not handled

Depending on the contents of the node w:docDefaults in /word/styles.xml , we get different default font sizes. This is not translated correctly in PDF conversion.

The default structure of the w:docDefaults node is roughly as follows:

<w:docDefaults>
    <w:rPrDefault>
        <w:rPr>
            <w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi" />
            <w:sz w:val="22" />
            <w:szCs w:val="22" />
            <w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="ar-SA" />
        </w:rPr>
    </w:rPrDefault>
    <w:pPrDefault>
        <w:pPr>
            <w:spacing w:after="160" w:line="259" w:lineRule="auto" />
        </w:pPr>
    </w:pPrDefault>
</w:docDefaults>

The problem lies within the node w:rPrDefault. There are 3 possible scenarios:

  1. it is present, and contains font size information
    In this case, the default font size in MS Word is obviously equal to the specified value
  2. it is present, but doesn't contain font size information
    In this case, the default font size is set to 10 in MS Word
  3. it is absent
    In this case, the default font size is set to 11 in MS Word

The problem is that XDocReport has no provisions for the second and third case. Consequently, no font size information is passed to iText, which defaults to 12.

I have found that this applies to Office 365, Office 2013, and Office 2010. 2007 is unconfirmed as of now. I have no idea if this is a bug or a feature. For the record: I haven't found any documents where scenario 3 applies, but I have found an instance of scenario 2 in the wild.

SimpleImageInfo does not support JPEG/Exif format

Hello everyone,

Some jpeg images are not recognized by the SimpleImageInfo class. Here is a simple test to reproduce the problem:

InputStream in = TestClass.class.getResourceAsStream("your-image.jpg");
SimpleImageInfo info = new SimpleImageInfo(in);
System.out.println(info.getMimeType());

Here are two different JPEG files format found on google:
A JPEG/JFIF format : http://www.w3.org/MarkUp/Test/xhtml-print/20050519/tests/jpeg422jfif.jpg
A JPEG/Exif format : http://abbysfloraldesigns.com/wp-content/uploads/2012/11/2004-12-21-071.jpg

In case of the exif image (which is the format used by some digital cameras) an IOException is thrown (message = "Unsupported image type") : this can cause a failure during the report generation.
After some research this format is using an Appn marker that is not seem to be take into account on the algorithm.

Thanks in advance for your feedback.

Saving *.docx generates ParseException: <w:fldSimple becomes <w:instrText

Also, let me start by giving a big shout out for this excellent library! Many thanks!

I'm running into an issue, which is somewhat mentioned in #3 and #38, but not very explicitly. When adding and removing just as little as a space in a *.docx file, the document.xml gets (sometimes) optimized. Changing a <w:fldSimple into <w:instrText and consequently breaking the generation process (see the XML code for a single mergefield). Is the anything I can do (on the backend or in MS Word itself)? Or does someone has a workaround?

Many thanks in advance and keep up the good work!

<w:fldSimple w:instr=" MERGEFIELD  ${name}  \* MERGEFORMAT ">
    <w:r w:rsidR="0092309C">
        <w:rPr>
            <w:noProof/>
        </w:rPr>
        <w:t>«${name}»</w:t>
    </w:r>
</w:fldSimple>

... becomes

<w:r>
    <w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
    <w:instrText xml:space="preserve"> MERGEFIELD  ${name}  \* MERGEFORMAT </w:instrText>
</w:r>
<w:r>
    <w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r w:rsidR="0092309C">
    <w:rPr>
        <w:noProof/>
    </w:rPr>
    <w:t>«${name}»</w:t>
</w:r>
<w:r>
    <w:rPr>
        <w:noProof/>
    </w:rPr>
    <w:fldChar w:fldCharType="end"/>
</w:r>

XDocReport Tools doesn't works with word 2013 on Windows 7 64bits

Hi, I have an issue with the XDocReport Tools. After downloaded versions 1.0.4 and add it to my STARTUP word directory, It appear correctly in my word, but I can't use it cause of an error who tell me that the object is not available on this machine.

Also when I ctrl + F11 to open vba editor and try to open XDocReport I get "the project can't be displayed"

I use word 2013 + windows 7 64bits

anyone have fix this ?

Inserted dynamic Image gives Parsing error

Hi

I've got a problem when I insert more than 1 template image in a docx.

I tested my code with your docx "DocxProjectWithFreemarkerAndImage.docx" , my code works, with all images .
But if I use a new docx with more than 1 template image, I get this error :

freemarker.core.ParseException: Parsing error in template "fr.opensagres.xdocreport.document.docx.DocxReport@6bba64!word/document.xml" in line 4, column 9352:
Encountered "[/#escape]", but was expecting one of:


<ELSE_IF>
.........
at freemarker.core.FMParser.generateParseException(FMParser.java:4672)
at freemarker.core.FMParser.jj_consume_token(FMParser.java:4543)
at freemarker.core.FMParser.If(FMParser.java:1208)
at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2347)
at freemarker.core.FMParser.Content(FMParser.java:2593)
at freemarker.core.FMParser.OptionalBlock(FMParser.java:2761)
at freemarker.core.FMParser.Escape(FMParser.java:2279)
at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2420)
at freemarker.core.FMParser.Content(FMParser.java:2593)
at freemarker.core.FMParser.OptionalBlock(FMParser.java:2761)
at freemarker.core.FMParser.Root(FMParser.java:2933)
at freemarker.template.Template.(Template.java:193)
at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:419)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:330)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:205)
at freemarker.template.Configuration.getTemplate(Configuration.java:740)
at freemarker.template.Configuration.getTemplate(Configuration.java:665)
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:110)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:775)
at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:521)
at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:487)
at fr.opensagres.xdocreport.samples.docxandfreemarker.Test1.execute(Test1.java:169)

It works with only one image, but not with more.
It doesn't work also if I insert one more new image to your docx "DocxProjectWithFreemarkerAndImage.docx"

I think I make something wrong when I insert the new image, but I don't find out.
I insert new image as explain in https://code.google.com/p/xdocreport/wiki/DocxReportingJavaMainDynamicImage.

Did you already see this problem ?

Thanks for reading my issue

Word :Unspecified error - recover the contents of this document

erreur_1
erreur_2

What steps will reproduce the problem?

1.Just testing the template
2.I added a #foreach to my original template which was working fine before
3.I attached a java project (java main) and all the stuff to test (Template docx)

What is the expected output? What do you see instead?

I got a error message that says. Cannot be opened because there are problems with the contents, if I click on details I see:
Unspecified error:

Location: Part: /word/document.xml, Line: 1, Column:0

Later on, I clicked on "Ok button" and I see the following error message:

"Word found unreadable content in LabelBoxTemplate.docx_200120151134.docx. Do you want to recover the contents of this document ? if you trust the source of this document, click Yes.

After I clicked "Yes"; I can see the document in perfect way, therefore my problem is this annoying error message.

What version of the product are you using? On what operating system?

I'm on Windows, Microsoft Office Professional Plus 2010 version 14.0.7015.1000
xdocreport 1.0.5

Please provide any additional information below.
I'm using velocity for my template. The problem is the template.

The problem seems to be the "foreach;"

I add this: #foreach ( $LIST_LEGAL_ADVISING in $LIST_LEGAL_ADVISINGS )

and at the end of document this: #end.

Thanks you very much for your help in advance,

P.D: I added a zip file (LabelTest.zip) with a java main to test, you can locate at http://code.google.com/p/xdocreport/issues/detail?can=2&start=100&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=463 because it's no possible to add this kind of file here.

How to list template's fields before process the merge

Hi

I'm using xDocReport 1.0.4 and I'm discovering it

I'm using
fr\opensagres\xdocreport\samples\docxandfreemarker\DocxProjectWithFreemarkerAndImage.java
for my test and I'm trying to list the freemarker of the template before any process.

I can list text freemarker with the method :

FieldsExtractor extractor = new FieldsExtractor();
report.extractFields(extractor);
List fields = extractor.getFields();
for(FieldExtractor field : fields) System.out.println(field.getName());

Console :

project.name

I can see 'project.name' freemarker, but not all images (logo, originalSizeLogo, forcedSizeLogo, ... )

How can I list all variable of the template ?

My aim is to read a template, list all freemarkers, show them to the user, ask him to associate them to a text or an image , and them generate the result in docx, then in pdf.

Do you think it is possible with xDocReport ?

And if all of this is possible, can I read the size of the template's image in the aim to generate the new image with the same size ?

Thanks a lot for reading my issue

Regards

While using @before-cell and @after-cell random cells and even rows can be deleted

---Sorry, accidendally I have closed issue #37 so this is it once again---

What steps will reproduce the problem?

  1. Create a lot of several mergefields in .docx document (e.g. @before-cell#if($p.source) and @after-cell#end in a table cell).
    In my case the larger is the document the more is a probability that some of the mergefields will be divided into different runs in document.xml as it is shown below.
    bad
    good
  2. Try to fill this template using java/scala.

What is the expected output? What do you see instead?
I expect that every mergefield will be filled but in practice the other situation happens - those mergefields that were divided into various runs (during creating template) will not be filled. If you try to launch your java code once again you will discover that the same mergefields were not filled because mergefields are stored in the template itself.

What version of the product are you using? On what operating system?

  • xDocReport 1.0.6, but I tried to use earlier versions too - it does't matter.
  • MS Word 2010 for creating templates - the problem, as I understand, is in it but I would like to ask you to create more smart solution that will take this stupid fault into consideration
  • OS Windows 8.1

Please provide any additional information below.
The most interesting thing is that if you try to delete and re-enter bad mergefields with the same information there will be a probability they will not be spoiled again.

I understand it is not a problem of yours and your library. Moreover it's really easy to use and it's a pleasure to work with it, but this trouble is a real headache for me and doesn't allow to work normally. Please add some features so that this problem will not be a problem anymore.

Here you can find a template, scala/java code and resulting output. I need to implement my project in scala so this template was processed using scala code too. But for your convenience I've added equivalent java code.
https://www.dropbox.com/sh/f2iyaiyvqg7wy1m/AAAf7nfNnTuULFstakS-59hUa?dl=0

This issue was also created there: https://code.google.com/p/xdocreport/issues/detail?id=483
UPD:
I've been tried to find a bit more information what exactly is wrong and I've found that as it's shown at screenshots every run has its own RSID parameter. It serves for conveniet merging of documents and can be turned off. It could be helpful, but..

  • In the attached template "@before-cell#if($print.variableThree)" mergefield was broken even without any RSIDs and wasn't filled correctly.
  • In my project (sorry, I can't attach it) it seems that turnind RSIDs off helped and fresh mergefields (I tested ones with "@before-cell" token - it is the main headache) were really created as a single run. Whatever after processing resulting table didn't contain some cells/rows/columns (I can't guess a rule in which they are being deleted) as before.

Then I've tried to edit document.xml myself to make broken mergefields look like ordinary ones. It didn't affect on template's view but my program began throwing strange parse exceptions even if I've only removed really unnecessary runs.

Thank you very much!
Nick.

XDocReport and XML

I'm trying to figure out how to port your DocxXMLProjectWithFreemarkerList.java over to a Velocity based implementation, but I'm a little lost on implementation.

When I went to https://code.google.com/p/xdocreport/wiki/VelocityTemplateContextXML, it said to "Use Velocity Anakia by registering a JDOM Document in the Java context." Does that mean I need to use Anakia to convert my xml to match your app's style? I naively thought I could just copy the code in step 1 and 2, modify it to match my variables and then it would work, but it looks like it will be more complicated than that. FYI, my end goal is to make a service where I just input the JDOM Element and merge the document with that.

Any help you could give me would be greatly appreciated.

Question: Table with dynamic columns

Hi,
is it possible to create table with columns depending on a variable in the context?

I tried:

  1. Field $objs.Name in a table cell, when rendering I have n rows
  2. I used #foreach ... $obj.Name ... #end, but #foreach, $obj.Name and #end are each in a cell, and when rendering I obtain three cells for each record: Name .

Do you have any suggestions?

Thanks,
tan

Java 8 support for Preview using XDocReport.dotm

What steps will reproduce the problem?

  1. Install Java 8
  2. Try to do a preview document using XDocReport.dotm
  3. Error comes as it seems that Java 7 is expected

What is the expected output? What do you see instead?
Java 8 should not be a problem

What version of the product are you using? On what operating system?
1.0.4, Windows

Support interactive forms in conversion to PDF

Hello guys,

It would be really great to implement support for interactive forms in conversion to PDF. I've successfully tested that it's possible to do it in iText 2.1.7 (even when they claim it's not). Interactive forms can be easily defined in LibreOffice and therefore their support in xDocReport would make it an ultimate tool i believe.

I've posted the question in stackoverflow, see: http://stackoverflow.com/questions/25803252/add-support-to-xdocreport-converts-odt-to-pdf-with-interactive-forms

Thanks in advance for your feedback.

Licence

The file header.txt shows that you refer to MIT license, but do you mind telling us explicilty (Readme/License)?

Thanks.
Nick

Insert images coming from HTML code

Hi, I have a problem when I use the library with an ODT template.

I've created a variable within the ODT template, and then I replace it with some HTML code:

<p>Testing image:</p>
<div><img border="0" src="http://cdn.playbuzz.com/cdn/7dd8deae-3e00-4fd3-83be-a306e22e81de/c50bdb2e-95bc-4423-862f-83e949001fbf.jpg" width="128" /></div>

But when the library generates the ODT output file, I can see the paragraph but not the image. Are html tags supported by the library?

Thanks.

Invalid version of freemarker jar in xdrtools.bat (for 1.0.4 release)

What steps will reproduce the problem?

  1. Preview throws an exception while using XDoc report macro
  2. xdrtools.bat is referring to freemarker-2.3.18.jar, whereas freemarker-2.3.20.jar is packaged in lib folder

What is the expected output? What do you see instead?
Please change the version of freemarker jar in xdrtools.bat

What version of the product are you using? On what operating system?
1.0.4, Windows

NPE converting CTSdtCell to PDF

When converting to PDF, a CTSdtCell ( = StructuredDocumentTags Cell) in the XWPF structure will throw a NPE when XDocReport looks through its style properties. As far as I can see, this is a long-standing POI bug.

FYI I already have a fix for my specific use case: blagae@0d67b0d
I'll create a pull request once I've written some tests and cleaned up the commit, but I can't guarantee that this catches the fundamental problem from POI everywhere. Someone with deeper knowledge of XDocReport should check whether there are other occurrences, and whether this fix will apply there, too.

freemarker wont clear its internal caches - OOM after several thousand runs

Using this code:

InputStream xmlIn = new ByteArrayInputStream(this.getData());
InputStream tmplIn = this.getInputStreamForExternal(getAttribute("template",null));

IXDocReport report = XDocReportRegistry.getRegistry().loadReport( tmplIn, TemplateEngineKind.Freemarker );
IContext context = report.createContext();

// XML input data as source
InputSource projectInputSource = new InputSource( xmlIn );
                freemarker.ext.dom.NodeModel project = freemarker.ext.dom.NodeModel.parse( projectInputSource );
context.put( "doc", project );

ByteArrayOutputStream out = new ByteArrayOutputStream(320000);
report.process( context, out );

// Unregistering -> Since unclear how input streams will be cached ? 
XDocReportRegistry.getRegistry().clear();
return out.toByteArray();

to perform templating. It seems that freemarker code uses cache which will never get cleared. Even under high pressure the cache grows and produces OOM after several thousand iterations.

Any hints on how to handle this:
a.) using another load mechanism (URL instead of stream) so freemarker can efficiently use caching ?
b.) configuring freemarker cache differently ?
c.) exposing freemarker cache to evtl. clear it actively ?

docxrep-2015-02-27-3 snapshot _users_jkleemann_snapshots - yourkit java profiler 2013 build 13086 - 64-bit

convert docx to pdf with wrong line height

when convert docx to pdf , the line height in pdf is lower than in word 。

A Word document look like this:
b

after convert to pdf look like:
default

xdocreport version: 1.0.5

OSGI. Importing fr.opensagres.xdocreport.document.images.IImageProvider

fr.opensagres.xdocreport.template.formatter.AbstractFieldsMetadataClassSerializer

try
{
    IIMAGEPROVIDER_CLASS = Class.forName( "fr.opensagres.xdocreport.document.images.IImageProvider" );
}
catch ( ClassNotFoundException e )
{
     e.printStackTrace();
}

This creates a problem(java.lang.ClassNotFoundException) in osgi-environment, both plugins (fr.opensagres.xdocreport.template and fr.opensagres.xdocreport.document ) installed and resolved but:

  • fr.opensagres.xdocreport.document export fr.opensagres.xdocreport.document.images
  • fr.opensagres.xdocreport.template don't import fr.opensagres.xdocreport.document.images

Must be used the directive DynamicImport-Package in manifest or explicitly specify class.

process to contribute to documentation

As I'm trying to learn XDocReport, I stumbled on to the fact that docs need much attention. Maybe what a developer new to project can much better do is to contribute to documents.

However collaboration on GitHub wikis are not as easy as normal repositories, therefore if contributors setup a mirror repo for wikis as described here any body may contribute to docs much easier.

Dynamic Images in Table with Freemarker syntax in DOCX template

Hi,

I have implemented a "DOCX-template" to PDF-with-data functionality using xDocReport with Freemarker.

I can create templates in DOCX using Freemarker's syntax, then xDocReport merges it with the actual data from the database to generate a PDF as an output.

This works like a dream, many thanks for it!

However I have problems with dynamic images in tables. Let's say I have a table with one column and three different images (in three different rows).

I'd like to generate these images in the PDF. In order to do so, this is what I need in the template docx in the first cell of the table (as Word MergeFields):

@before-row[#list Table_1 as row]
(here would come a placeholder image with a bookmark, where the bookmark is the name of the > image component which I'd like to print)
@after-row[/#list]

However, I think the bookmark should be "row.something", but I cannot add dot (.) in Word as a bookmark. Please find attached picture.
capture

The Java side looks like this (excerpt):

// load DOCX Template Document by filling FreeMarker Template Engine
InputStream inputStream = new FileInputStream(templateDocFile);
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(inputStream, TemplateEngineKind.Freemarker);

// create context Java model, data map and fields metadata (to manage images)
IContext context = report.createContext();
Map<String, Object> data = new HashMap<String, Object>();
FieldsMetadata metadata = new FieldsMetadata();
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();

// looping through the rows of table - we have some variables to make sure it iterates through all the cells of the table - I didn't put all the row-column iterating logic here
for (int rowIndex = 0; rowIndex <= rowNum - 1; rowIndex++) {
   Map<String, Object> row = new HashMap<String, Object>();
          // looping through the columns of table
          for (int x = 0; x <= colNum - 1; x++) {
              FieldsMetadata metadata = new FieldsMetadata();
              metadata.addFieldAsImage(currentElement.getNameOfImage(),    NullImageBehaviour.RemoveImageTemplate);
              IImageProvider image = new ByteArrayImageProvider(currentElement.getValueAsBytes(), true);
             row.put(currentElement.getNameOfImage(), image);
            report.setFieldsMetadata(metadata);

        }
        rows.add(row);
}

// and later on...
context.put(element.getNameOfTable(), rows); // this would be "Table_1" in our example
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
report.convert(context, options, baos);
return baos.toByteArray();

Is this correct so far? Can you please provide me a working example of dynamic images in tables using DOCX templates with Freemarker syntax?

Some details:
fr.opensagres.xdocreport.core -- 1.0.4
fr.opensagres.xdocreport.document.docx -- 1.0.4
fr.opensagres.xdocreport.template.freemarker -- 1.0.4
fr.opensagres.xdocreport.converter.docx.xwpf -- 1.0.4
org.apache.poi.xwpf.converter.pdf -- 1.0.4
freemarker -- 2.3.23

Convert from ODT to PDF of merged rows doesn`t work

Im trying to convert Open Office document to PDF. Im using PDFConvertor from org.odftoolkit.odfdom.converter.pdf.itext5
Open Office document contains table with merged rows see the screenshot.
In generated pdf last cell from merged row is missing. Look second screenshot.
The problem is reproducable.

mergedrowsopenoffice
mergedrowsgeneratedpdf

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString

When trying to encrypt pdf using PDFWriter the following error is thrown:

at com.lowagie.text.pdf.PdfEncryption.(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.setEncryption(Unknown Source)
at se.newseed.pdfservice.PdfService$PdfServiceThread$1.configure(PdfService.java:260)
at fr.opensagres.xdocreport.itext.extension.ExtendedDocument.(ExtendedDocument.java:64)
at org.odftoolkit.odfdom.converter.pdf.internal.stylable.StylableDocument.(StylableDocument.java:76)
at org.odftoolkit.odfdom.converter.pdf.internal.ElementVisitorForIText.(ElementVisitorForIText.java:148)
at org.odftoolkit.odfdom.converter.pdf.PdfConverter.processBody(PdfConverter.java:114)
at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:65)
at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:43)
at org.odftoolkit.odfdom.converter.core.AbstractODFConverter.convert(AbstractODFConverter.java:42)
at fr.opensagres.xdocreport.converter.odt.odfdom.itext.ODF2PDFViaITextConverter.convert(ODF2PDFViaITextConverter.java:62)
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:713)
... 2 more
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1OctetString
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 14 more

This stackOverFlow thread explains that backward compatibility issues with iText exists with newer versions of the BouncyCastle libraries

http://stackoverflow.com/questions/10391271/itext-bouncycastle-classnotfound-org-bouncycastle-asn1-derencodable-and-org-boun

Is there anyway that I can use a lower version of bounty castle?

Problems with tables into template

HI guys,

I have a problem when try to fill a template. I have a table with 3 columns and 5 rows but only need fill 1 column. Following the example (ODTTableWithoutFieldsMetadataWithFreemarker), prepare my template with this content in the 5 rows:

1 row.- @before-row[#list experiencia as e]${e.mesIni} ${e.mesFin}@after-row[/#list]
2 row.- ${e.empresa}
3 row.- ${e.sector}
4 row.- ${e.puesto}
5 row.- ${e.funciones}

But have an error in the first variable ${e.mesIni} (see screenshot) and don't know whats the problem.

I need to repeat this table with different data but always have same structure (3 columns and X rows, filling last column).

Someone cant help me? it is very urgent.

Thanks so much

error

Class not found exception while trying to convert report to PDF

I'm trying to use the last code on this page to generate a PDF out of the report.
I know that report generation is successful because I can save the doc as XDoc and it works fine. However when I try to save it as PDF I get following output:

fr.opensagres.xdocreport.converter.XDocConverterException: java.lang.NoClassDefFoundError: org/apache/poi/xwpf/usermodel/IRunBody
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:748)
    at XdocVelocityMap.main(XdocVelocityMap.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/xwpf/usermodel/IRunBody
    at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:55)
    at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:38)
    at org.apache.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:45)
    at fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.convert(XWPF2PDFViaITextConverter.java:67)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:713)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.poi.xwpf.usermodel.IRunBody
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 11 more

these are my defined dependencies:
screen shot 2015-08-04 at 23 56 44

any idea what could be missing?

ServiceLoader issues

Right now dependency of document formats and template engines is handled via ServiceLoader. This is causing issues with plugin discovery in existing java applications since not all jars may be available by the current Thread Context Classloader.

An example of the error I've seen is:

fr.opensagres.xdocreport.core.XDocReportException: Impossible to create report for the input stream. The report loader supports only [] files type.

I'm wondering if there is a way of manually declaring capabilities available, so that we can explicitly set what converters are available rather than relying on ServiceLoader to determine this for us. I.e, we can construct the XDocReport class instance and say: use this document type and this template engine.

about Report types: Tabular and its Transpose(Timeseries)

Hi there,
I was able to create reports using your xDocReports to create column based tabular reports.
But I don't know the syntax to make a report based on the Transpose of this.(this type of report could also be called a Timeseries type of report.
I have attached 2 images to illustrate what I am referring to.

Regards,
P
salesprofitreports_tabular1
salesprofitreports021

PDF Converter + Apache POI 3.12: NoClassDefFoundError: org/apache/poi/wp/usermodel/Paragraph

When trying to convert some docx to pdf, it throws NoClassDefFoundError: org/apache/poi/wp/usermodel/Paragraph.
This happens, when Apache POI 3.12 is on the ClassPath. When using POI 3.11 it works as expected.

This is the code we use:

OutputStream out = ...;
XWPFDocument doc = new XWPFDocument(docxFile.getInputStream());
PdfOptions options = PdfOptions.create().fontEncoding("windows-1250");
PdfConverter.getInstance().convert(doc, out, options);

pom.xml:

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.12</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.12</version>
</dependency>
<dependency>
    <groupId>fr.opensagres.xdocreport</groupId>
    <artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
    <version>1.0.5</version>
</dependency>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.