jasper-reports

Jasper iReport custom date and custom time

a 夏天 提交于 2019-12-31 04:00:07
问题 In Excel, I have a date format yyyy.MM.dd hh:mm and a time format hh:mm. I set this as a source for an iReport database. For the date I set a custom date format in iReport, same as in Excel. Then I set class="java.util.Date" . For the time, which class should I choose? I've tried many, none working. I think, the problem is, that I cannot set another custom date format, so the iReport does not recognise it. Thank you for your help. 回答1: It is quite slightly harder to solve this your new case

JasperReports: How to add a WHERE statement in SQL query depending on a Boolean parameter?

岁酱吖の 提交于 2019-12-31 03:46:11
问题 How can I add a sub where statement in SQL if my Boolean parameter is true in JasperReports ? For example, I have my SQL as below: SELECT * FROM shops WHERE region = "Canada" ORDER BY name If my parameter is true, I would like to add and isactive = 'Y' just before ORDER BY . Anybody knows how I can achieve this? 回答1: You can add additional parameter for setting additional clause value. After that you can use $P!{} syntax in query. The sample: <parameter name="param" class="java.lang.Boolean"/

Blank space at end of page

五迷三道 提交于 2019-12-31 02:56:14
问题 Background A subreport with a column title and a detail section both set to 20px high. When the subreport record displays on the main report, the subreport prints as expected until when it reaches at the bottom of the page. Then the subreport prints just the column header and left blank space, then again starts on new page with column header and its detail. Question So, would you make it either print the whole subreport on same page, or start whole report from new page? Master Report JRXML

Blank space at end of page

北城余情 提交于 2019-12-31 02:56:07
问题 Background A subreport with a column title and a detail section both set to 20px high. When the subreport record displays on the main report, the subreport prints as expected until when it reaches at the bottom of the page. Then the subreport prints just the column header and left blank space, then again starts on new page with column header and its detail. Question So, would you make it either print the whole subreport on same page, or start whole report from new page? Master Report JRXML

Export custom HTML template

一世执手 提交于 2019-12-31 02:14:42
问题 Background Exporting to HTML generates the following: <html> <head> <title></title> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <style type="text/css"> a {text-decoration: none} </style> </head> <body vlink="#000000" text="#000000" link="#000000" alink="#000000"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td width="50%"> </td> <td align="center"> <!-- The report --> </td> <td width="50%"> </td> </tr> </tbody> </table> </body> </html>

Running JasperViewer on Tomcat as part of a web application

匆匆过客 提交于 2019-12-31 01:11:10
问题 I have learned that JasperViewer (default preview component of JasperReports ) is a Swing component, so is there any way to convert or embed it in a web application? Some say I should use Java Web Start , but from what i have learned from this link JWS is useful to download and install an application on client machine and this is not our case. the other work around that it may work (maybe just in theory) is converting jFrame to jApplet as briefly described in this link Have you tried any of

How to read jrxml file inside the jar file?

会有一股神秘感。 提交于 2019-12-30 14:51:42
问题 I have a bunch of iReport source code (jrxml) locate inside the workspace with the following path: <project>/report/<jrxml_file> When I pack my source code into jar file. I will have this file structure directory: <jar_file>/report/<jrxml_file> In my source code, I have these code to validate the existence of the jrxml file: File file = new File("report/jrxml_file"); if (!file.exists()) { return false; } When I execute this jar file through the command: java -jar MyJar.jar I hit an error

JasperReports collection as datasource?

时间秒杀一切 提交于 2019-12-30 11:31:50
问题 I'm trying to find out how to use a string collection as a datasource in JasperReports. I guess I found the solution, but I can't get this to work, can anyone assist me? set as datasource the special data source JREmptyDatasource( $F{my_collection}.size() ) This creates an empty data set with the same size of records as the collection. Pass the $F{my_collection} as parameter to the sub dataset (using the data set run of the List). To print the current element of the collection: $P{my

JasperReports collection as datasource?

房东的猫 提交于 2019-12-30 11:31:30
问题 I'm trying to find out how to use a string collection as a datasource in JasperReports. I guess I found the solution, but I can't get this to work, can anyone assist me? set as datasource the special data source JREmptyDatasource( $F{my_collection}.size() ) This creates an empty data set with the same size of records as the collection. Pass the $F{my_collection} as parameter to the sub dataset (using the data set run of the List). To print the current element of the collection: $P{my