When scheduling a report, you can specify the timezone that should be applied to the output instead of using the data source's timezone. This works for all outputs except Excel (XLS), both paginated and non-paginated. To overcome this limitation, you must explicitly enable timezone usage in XLS output.
Setting Timezones in Scheduled Excel (XLS) Reports | ||
Configuration File | ||
.../WEB-INF/classes/jasperreports.properties | ||
Property | Value | Description |
net.sf.jasperreports.export. | true | Define this property as true to apply timezones in scheduled Excel (XLS) reports. |
This property can also be defined on individual elements in the report's JRXML if only certain fields should apply the timezone.
Incorrect Time Stamp Pattern Appearing in Excel Export
When exporting reports to Excel, the time stamp appears in the following pattern "mmm d, yyyy h:mm:ss a" instead of "MMM d, yyyy h:mm:ss AM/PM".
To resolve this, you need to add mapping to the map in applicationContext.xml. It ensures date patterns in Java 11 will convert to corresponding Excel date patterns. And Excel export will have the correct time stamp, that is, "MMM d, yyyy h:mm:ss AM/PM".
To add the mapping:
1. | Open the file .../WEB-INF/applicationContext-webapp.xml for editing. |
2. | Locate the formatPatternsMap bean and add the following new entry. |
<entry key="d MMM, yyyy, h:mm:ss a" value="d MMM, yyyy h:mm:ss AM/PM"/> |
3. | Restart the server. |
Recommended Comments
There are no comments to display.