I. Overview
1. Version
Report Server Version |
---|
10.0 |
2. Application scenarios
After scheduled tasks are complete, you may need to export a file to a customized location instead of the default location. In this case, you can use custom attachments to change the location of the file to be exported.
3. Functions overview
In the File Processing step of a scheduled scheduling task, select Custom attachment processing. You can modify the location for exporting files by using custom class files.
II. Example
Export Excel and PDF files, and save the generated files in the specified path. In this example, the path is in the test folder on drive C.
1. Writing class files
1) Define an OutputExcel class file to implement OutputActionHandler<OutputClass> Interface, the specific code is as follows:
https://code.fanruan.com/demo/example/src/release/10.0/src/main/java/com/fr/output/OutputExcel.java
2) Compile the class file and place the generated OutputExcel. class file in the %FineReport_home%FineReport_home%\webapps\webroot\WEB-INF\classes\com\fr\output
Note: The location of the class file only needs to correspond to the location of the "package" in the class file.
2. Scheduled task
1) Adding a task
For details about how to add a task, see Task Schedule Setting.
2) The task name is Customize_uploading_files_to_disks.
The default user group is Platform user Anna, and click OK. As shown below:
3) Scheduling objects
Click next, select the template GettingStartedEN.cpt, the file name is called test, and check excel03, excel07, word, PDF on the right side of the attachment file. As shown below:
Note: This method does not support the check box in Dispatcher Result In addition to the general results, members of the default user group will receive individual results
4) Scheduling period
Click Next and do nothing. As shown below:
5) File processing
Click Next, check Custom Attachment Processing, select the OutputExcel. Class file in Section II.1. of this article, and click Save. As shown below:
3. Effect viewing
Export files in different formats can be viewed under the Test folder in disk C, as shown in the following figure: