Issue :
A report have parameter in footer called "CurrentDate" of "java.util.Date" type and default Value Expression is configured as "new Date()" (attached : "02243220.PNG")
When this report published on JRS and tried to export into .xlsx then Date & Time are not consistent but while exporting into .pdf and .csv is shows exactly same as of GUI.
Attached jrxml ("02243220_casetest_dev.jrxml") which contains below datetime format in footer section.
"Report created on : "+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format($P{CurrentDate})
Resolution :
Exporting to unpaginated Excel involves regenerating the report in unpaginated format, which also implies reevaluating parameters/expressions/etc
If you want to preserve the value of the parameter from the initial report generation, you can set the "net.sf.jasperreports.data.cache.included" property to true on the parameter
<parameter name="CurrentDate" class="java.util.Date" isForPrompting="false">
<property name="net.sf.jasperreports.data.cache.included" value="true"/>
<defaultValueExpression><![CDATA[new Date()]]></defaultValueExpression>
</parameter>
We have tested in local with above property and time is now consistent across all format.
Case Reference : #02243220
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now