I'm trying to generate a jasper report containing a table (jr:table tag) within a Java application, having the jasperreports library version 6.11.0
I generated the .jrxml file template file using Jaspersoft Studio 6.11.0, and when I paste it within my IntelliJ IDE I get a warning like jr:Table is not allowed here and after generating the pdf containing the report, only the header of the report is found wihtin that pdf and no table.
Note: within the Jaspersoft Studio the table is generated correctly.
Also I get no error within the Java app logs.
Related
I have created a jasper report using Jaspersoft Studio 6.19.1. This report utilizes a referenced jar file. The report works fine when running it locally. However, I'm getting an error when running the report from the repository. The error is unable to resolve referenced java class. My question what is the correct way to add and configure a jar file to the server?
Thank you
Has anyone ever gotten this error in iReport 5.6 when trying to open the jrxml file?
Attribute 'hTextAlign' is not allowed to appear in element 'style'
The cause of problem
The jrxml file is just a xml file. It is a common practice to validate xml files with help of XSD schema.
The JasperReports engine is doing the same - it is using xsd schema to validate the report's template (jrxml file).
The xsd was changed at 6.x version compared with 5.x version.
The schema for latest version of JasperReports is available with url. You can always find the link to schema at header of jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ... xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" ...>
Looks like your template (jrxml file) was created or edited with JasperReports Studio of 6.x version and saved without applying compatitbility with 5.x version option (Compatibility warning dialog).
How to solve this issue:
You can use Jaspersoft Studio (JSS) for modifying report's template. Maybe it is the best choice because the iReport is deprecated (it is not supported since the end of 2015 year) and supports only 5.6 and oldest versions of JasperReports templates/features.
You can save the template at compatitbility mode as 5.x version at JSS and after this continue edit the jrxml file with iReport
The dialog appears during saving template at JSS and looks like this:
To enable this dialog you should change settings at form called via Window -> Preferences menu.
Always use only iReport designer. But be aware: it does not support 6+ version of JasperReports templates.
How to check the difference in schemas of 5.x and 6.x versions
The xsd schema for any version of JasperReports can be found at JasperReports package with source code or at repository of source code.
This is a fragment (screenshot) of comparing xsd files of 5.6.1 (left panel) and 6.3.0 (right panel) versions.
As you can see that the hTextAlign attribute from your error message presents only at xsd of 6.x version. This is a cause of the error you got
Remove all attribute textAdjust="StretchHeight" in textField tag. I have removed the attribute and it worked fine for me Screen.
I had the same problem while trying to parse an XML document. It worked after removing the textAdjust property from the report source XML. All values gives exception: CutText, StretchHeight and ScaleFont.
Use isStretchWithOverflow="true" instead of textAdjust="StretchHeight"
I am using Jasper Reports in my Grails 3 application to generate PDF files. I had some issue with Jasper Report plugin for Grails. So we are using Jasperreport jars to generate the PDF.
compile 'net.sf.jasperreports:jasperreports:6.2.1'
I created a 'JasperReports' in project level and added all the jrxml and jasper files. In the development environment I use the below way to compile the report.
jasperReport = JasperCompileManager.compileReport('JasperReports/FYF_Report.jrxml')
Everything works fine in development but when the war is generated it is not including the 'JasperReports' folder. I tried adding the folder in conf but it did not work.
Let me know if I am missing any configuration to include the 'JasperReports' folder in war.
I resolved the issue by adding the JasperReports folder in src/main/webapp. Path to access the files will be different in local and Production, So I am getting the real path from context as below
def sc=session.getServletContext()
def reportsPath=sc.getRealPath("/")
jasperReport = JasperCompileManager.compileReport(reportsPath+'JasperReports/FYF_Report.jrxml')
I have a jrxml file which has database as MongoDB and I have generated the JRXML file desgined through Ireport 5.6.0 , I need to compile jrxml file and generate as PDF how to do it through JAVA code. Can anyone help me on this.
I'm using JasperReports 3.7.6 with NetBeans 6.9.1 and iReport 3.7.6. I have a report that uses scriptlets. When I run it from iReport everything is fine because I can tell iReport where to find the .jar file with the scriptlets. When I run that same report from a JSF-2.0 application the fields that rely on the scriptlet are not being populated correctly - i.e. the scriptlet isn't being called. I've tried putting the scriptlet in the project's library folder and I've tried copying the package containing the scriptlet into the project. Neither has worked. I'm not sure how I can get the report to call the scriptlets when it is run from my JSF project. Can anyone shed some light on this for me?
Ugh. What is it with me and rookie mistakes? I have my JSF project pulling the .jasper files from a specific locations. To that end I have my iReport compiling the reports to that particular file location. At some point in the past week I was fiddling with another report and didn't want it to go to the same location as my project reports ... so I changed the compile location in iReport. It was after that when I created all the scriptlet functionality. When I added the scriptlet functionality and compiled the reports, I forgot to change the compile location back to the project report folder. The reports were compiling elsewhere. So my project was using the old versions of the report files. Updating the compile location in iReport and recompiling the reports fixed the issue. The .jar file in my library works fine.