本文介绍了Displaytag Export Excel不导出所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Displaytag将表数据导出到Excel.

I want to export the table data into Excel using Displaytag.

最初是将所有数据导出到Excel,但是默认情况下,displaytag使用CSV格式导出到Excel.

Initially it's exporting all the data to Excel, however by default displaytag is using CSV format to export into Excel.

此解决方案解决了该问题 Displaytag将CSV导出到.xls文件

This solution fixed that problem Displaytag is exporting CSV into a .xls file

但是,现在新生成的excel工作表仅具有选定的页面数据,而不是整个表/列表.它导出的第二页数据是我在第二页,依此类推.

However, now new generated excel sheet is having only the selected page data rather than entire table/list. It's exporting 2nd page data is I am in 2nd page and so on.

但是我要导出所有页面数据.

But I want to export all pages data.

我完整的displaytag.properties

my complete displaytag.properties

export.types=csv excel xml rtf pdf  
export.excel=true
export.xml=true 
export.csv=true
export.rtf=false
export.pdf=false
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
export.pdf.class=org.displaytag.export.DefaultPdfExportView
export.rtf.class=org.displaytag.export.DefaultRtfExportView

在Jsp中用于表格

<displaytag:setProperty name="export.csv.filename" value="test.csv" />
<displaytag:setProperty name="export.excel.filename" value="test.xls" />
<displaytag:setProperty name="export.xml.filename" value="test.xml" />

顺便说一句,除excel以外,其他导出格式(csv,xml)正在生成完整的数据.

Btw, other export formats (csv,xml) are generating complete data except for excel.

推荐答案

这似乎是Bug,并且是Displaytag中的已知问题 http://jira.codehaus.org/browse/DISPL-361

This seems to be bug and known issue in Displaytaghttp://jira.codehaus.org/browse/DISPL-361

我找到了一种解决方法,可能对其他人有用!

I found a workaround, might be useful for others!

if(this.request.getParameter(TableTagParameters.PARAMETER_EXPORTING) != null)){
  return complete List;
}else {
  return based on user inputs
}

这篇关于Displaytag Export Excel不导出所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 11:01