Kogie / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

NullPointerException when generating pdf from docx #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
private static void createPDF() {
try {
 long start = System.currentTimeMillis();

 InputStream is = new FileInputStream(new File(
                    "docx/RC03.docx"));
 XWPFDocument document = new XWPFDocument(is);
 PdfOptions options = PdfOptions.create();
 OutputStream out = new FileOutputStream(new File(
                    "pdf/RC03.pdf"));
 PdfConverter.getInstance().convert(document, out, options);

 System.err.println("Generate pdf/TableWithRowsColsSpan.pdf with "
                    + (System.currentTimeMillis() - start) + "ms");

 } 
catch (Throwable e) {
 e.printStackTrace();
        }
    }

Original issue reported on code.google.com by fhoudeb...@gmail.com on 12 Dec 2012 at 10:27

Attachments:

GoogleCodeExporter commented 9 years ago
Thank's to have attach your docx. I think the problem is with tabs stop (awful 
to manage that). I will see this problem as soon as I will find time.

Regards Angelo

Original comment by angelo.z...@gmail.com on 12 Dec 2012 at 10:36

GoogleCodeExporter commented 9 years ago
windows xp and 7
org.apache.poi.xwpf.converter.pdf : 1.0.0
jdk 6

Original comment by fhoudeb...@gmail.com on 12 Dec 2012 at 10:36

GoogleCodeExporter commented 9 years ago
NPE problem is fixed. It was because of the "centered" tab used in the header 
of the docx. However I don't know how to manage "centered" tab, so the pdf has 
text align on right and not centered.

I have added in our Junit the attached docx of this issue 
http://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.apa
che.poi.xwpf.converter.pdf/src/test/resources/org/apache/poi/xwpf/converter/core
/Issue206.docx

Original comment by angelo.z...@gmail.com on 12 Dec 2012 at 6:27

GoogleCodeExporter commented 9 years ago
It solves my problem!
Thanks for being so fast and efficient 

Original comment by fhoudeb...@gmail.com on 13 Dec 2012 at 8:32

GoogleCodeExporter commented 9 years ago
Hi

I am using xdocreport 1.0.0 and I have experienced the same null pointer 
problem as shown in the stack trace on this issue.

Can you tell me which release contians this fix please?

Cheers

Original comment by Mr.M.McM...@googlemail.com on 3 Jul 2013 at 10:26

GoogleCodeExporter commented 9 years ago
1.0.2 is ok for instance

Original comment by fhoudeb...@gmail.com on 3 Jul 2013 at 7:42

GoogleCodeExporter commented 9 years ago

Original comment by angelo.z...@gmail.com on 18 Feb 2014 at 1:45