Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4040

Add an export file name property for JasperReport

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: 8.5.2
    • Fix Version/s: 8.6.1
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None
    • gh.sprint.customfield.default.name:
      ZK 8.6.0 S2, ZK 8.6.1 S1

      Description

      In the current implementation, ZK JasperReport exports are generated as FileInputStream and sent to the client using ZK org.zkoss.zk.au.http.AuDynaMediar. The AMedia is always generated with the file name "report."+format.

      https://github.com/zkoss/zkcml/blob/master/zkex/src/org/zkoss/zkex/zul/Jasperreport.java#L565
      https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/au/http/AuDynaMediar.java

      However, AuDynaMediar doesn't use the file name when a response is written to the client.
      https://github.com/zkoss/zk/blob/master/zcommon/src/org/zkoss/util/media/AMedia.java

      By adding the following, it would be possible to generate export files with a chosen file name.

      1- In JasperReport, add a field for exportName (or similar).
      2- In JasperReport, use the exportName + "." + format instead of "report."+format
      3- In AuDynaMedia, use the media name as source name for the download if any.
      for example:
      if(media.getName() != null && ! media.getName().equals(""))

      { response.setHeader("Content-disposition","inline; filename="+media.getName() ); }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                CharlesQiu CharlesQiu
                Reporter:
                MDuchemin MDuchemin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Time Spent - 5 hours, 30 minutes Remaining Estimate - 2 hours, 30 minutes
                  2h 30m
                  Logged:
                  Time Spent - 5 hours, 30 minutes Remaining Estimate - 2 hours, 30 minutes
                  5h 30m