您当前的位置:
FineReport帮助文档 - 全面的报表使用教程和学习资料
>>
自定义上传文件至磁盘
>> 历史版本
历史版本1 :自定义上传文件至磁盘
返回文档
编辑时间:
11-10 15:35
历史版本:
最新历史版本
下一篇历史版本
内容长度:
6259
图片数:
1
目录数:
3
修改原因:
修正错误
目录:
1. 问题描述
2. 示例
3. 实现步骤
1. 问题描述
编辑
在定时任务完成之后,有时候需要将文件导出至自定义位置,而不是系统默认位置
%FR%WebReport\WEB-INF\schedule
,这时候就可以通过自定义附件来处理,通过自定义类文件修改文件导出的位置。
2. 示例
编辑
导出excel和pdf,并把生成的对应文件保存在指定路径中去,本例中的路径是放在D盘中。
3. 实现步骤
编辑
3.1 编写类文件
定义一个OutputExcel类文件,实现AbstractOutputFileAction接口,具体代码如下:
</span></div><div class="doc_description" style="color: rgb(56, 56, 56); font-size: 14px; text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">编译类文件,将生成的OutputExcel.class放在<span class="doc_dir" style="font-weight: bold; color: rgb(139, 0, 139);">%FineReport_home%\WebReport\WEB-INF\classes\com\fr\output</span>文件夹下。</div><div class="doc_description" style="color: rgb(56, 56, 56); font-size: 14px; text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="doc_warning" style="color: red;">注:类文件放的位置只需要与编写类文件里面的package位置对应即可。</span></div><div class="doc_h2" style="font-weight: bold; font-size: 15px; color: rgb(56, 56, 56); margin-top: 11px; margin-bottom: 11px;"><div class="hdwiki_tmmll">3.2 定时任务</div></div><div class="doc_description" style="color: rgb(56, 56, 56); font-size: 14px; text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">参照<span><a href="http://www.finereporthelp.com/help/22/10/2.html" target="_blank">定时生成日报</a></span>配置定时任务,到第三步—输出设置的时候,在<span class="doc_navigation" style="font-weight: bold; color: rgb(0, 128, 128);">附件类型</span>后面勾选excel,word,pdf,则可将定时任务结果导出为excel,word以及pdf格式,然后勾选下面的是否自定义附件处理,并在类名处填写正确类名,点击完成即可。如下图:</div><div class="doc_description" style="color: rgb(56, 56, 56); font-size: 14px; text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="/uploads/201511/1447140919GJg5CTpU.png" style="padding: 10px 0px 5px;" /></div><div class="doc_h2" style="font-weight: bold; font-size: 15px; color: rgb(56, 56, 56); margin-top: 11px; margin-bottom: 11px;"><div class="hdwiki_tmmll">3.3 效果查看</div></div><p></p><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;">在D盘下面可以查看到3个不同格式的导出文件,分别为aaaa.xls;aaaa.pdf;aaaa.doc。如下图:</div> </div> </div> </div> </div> </div> </body> </html>