Jump to content
  • DOCX exporter formatting issues

    Assigned User teodord
    CategoryBug report
    ResolutionNo Change Required



    We have been testing the DOCX exporter from Jasper Reports 3.6.0. There are a number of (hopefully) small, but none the less, critical issues with the resulting document formatting.


    All of the following small issues refer to the DOCX document contained in the unit test file, http://www.steve-chamberlain.co.uk/Files/Jasper%20Reports%203.6.0%20DOCX%20Test.zip.


    The zip file contains:


    - The report in DOCX format.

    - The report in PDF format (this format shows exactly what we want to see our report in DOCX).

    - The report source as a .jrprint file in order to recreate/test these issues.


    1) Page 2 of the document should contain legal information (this is visible in the PDF version).


    2) The table of contents is displayed in italics. This should not be the case (see page 3-5 of the PDF for how it should look).


    3) There is no text in the page footers. Page footers should display a project name and the page numbers.


    4) Many of the headings have been displayed in italics. See chapter 4 "Test Case Specifications" for an example on page 9.


    5) Chapter 6 on page 67 contains data in a table like format. It seems that the lines and text have not been rendered for the row cells. Headers are correct though.


    6) Staying with chapter 6 of the report, the padding in the text boxes is not quite correct (the text is only half rendered).

    User Feedback

    Recommended Comments



    Thank you for providing files so that we can easily respond to your issues:


    1) The DOCX exporter is a grid exporter, similar to the HTML and XLS exporters. It cannot display overlapping elements. On page two, you have a third text field "COVER_PAGE" with white forecolor on white background (can't be seen with the naked eye), which overlaps your legal information, which in turn cannot display. Avoid overlapping elements when you export to DOCX, HTML, XLSX or XLSX.


    2) The PDF is actually wrong, since the style called "Collis - Sub Heading Style" is both bold and italic. The PDF is wrong because for italic and bold fonts, you need special fonts. Please check the /demo/samples/fonts sample in JR to learn more about fonts and PDF. I suggest you make use of font extensions, one being available as a downloadable JAR together with the other JR files at Sourceforge.net.


    3) Same reason as 1). Your line at y="803" strikes through all the page footer text fields which are at y="802", overlapping them.


    4) Same reason as 2). PDF is wrong as the text field is indeed italic.

    You need to specify pdfFontName, pdfEncoding and isPdfEmbedded attributes for the font. But I suggest you simply use font extensions, as they made these PDF-related font attributes deprecated.


    5) Same reason as 1). Image overlaps text field behind.


    6) This is the only true DOCX exporter problem that you have spotted. Indeed, we are not controlling the line spacing yet in the DOCX exporter. Basically, Word puts more space between two rows of text, than we do in our AWT calculations at report fill time. I suggest you create a separate tracker to track this single problem further. After you do so, we'll close this tracker here.


    Thank you,



    Link to comment
    Share on other sites

    Hi Teodor,


    Thanks for your feedback. It seems we have some things to look at in our report templates. I have never come across this problem of overlapping elements and I don't remember reading anything about this in the documentation or javadoc; is this documented somewhere in case I need further help?


    It will take some time to implement your suggestions in our templates, but feel free to close this issue report. I have made a separate issue report of point 6 (issue #4468).


    Best Regards,


    Steve Chamberlain.

    Link to comment
    Share on other sites



    You did not come across the missing elements issues probably because you did not try to export to HTML or XLS yet. These grid exporter issues are explained in these FAQs here:






    As for the PDF font issues, not sure why you did not spot the problem sooner. In any case, make sure you use font names that you ship with your reports as font extensions and you should have no problem with PDF.


    I'm closing this.


    Thank you,



    Link to comment
    Share on other sites

  • Create New...