Jump to content
  • TextElement textAlignment is not working with higher versions correctly

    CategoryBug report
    Component: 14539
    ResolutionNo Change Required

    Hello Jasper community,


    today I wanted to update my old Jasper version (6.0.0) to the current 6.7.0. So I started to compile my report.jrxml file and I saw that the textAlignment was not working properly. I was comparing a bit and found out that the problem is the compilation version. The same file compiled with 6.0.0 is working, compiled with the current version it´s not.


    Here is code snippet:



    I have added a picture of this behaviour. Are there any solutions?

    Thank you in advance!


    User Feedback

    Recommended Comments

    Which JasperReports version are you using to run the reports? If you're compiling the reports with 6.7.0, you should run them with the same version (or a newer one).




    Link to comment
    Share on other sites

    I was using jasperreports-6.7.0.jar in my client code. Or is it possible that there are other dependencies, e.g. itext, which is maybe responsible for textAlignment?


    Thank you for your help!





    Link to comment
    Share on other sites

    No, itext version doesn't matter.


    To double check the version, you could run a report with a text field with isStretchWithOverflow="true" and getClass().getResource("/default.jasperreports.properties") as text field expression. You should see jasperreports-x.y.z.jar somewhere in the text output.

    Link to comment
    Share on other sites

    Hey Lucian,

    I´m sorry for the circumstances! You are absolutely right. I changed the lib from the project but the project was including other projects with the 6.0.0 library and it was started before my changed project. Thank you for your research!



    Link to comment
    Share on other sites


    I'm using Jasper Studio 6.12.2 and all libraries are 6.12.2 as you can see in the image attached.

    However, in the preview I can't align the texts, in this case at left.

    What can be wrong?


    This happens with fields that are being retrieved from a field in the database and the datatype is text.

    If the datatype is somehow numeric (integer, double, float), it align.

    If the datatype is date and a pattern is defined, it align.


    Link to comment
    Share on other sites

  • Create New...