RaceBase
RaceBase

Reputation: 18848

Displaytag Export Excel not exporting all rows

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

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

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

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.

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

in Jsp for the table

<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" />

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

Upvotes: 3

Views: 5383

Answers (2)

Saif
Saif

Reputation: 7042

The export amount controlled by below property configuration

export.amount=page  //only current page will be exported
export.amount=list //whole list will be exported

And Also try

export.excel.class=org.displaytag.export.excel.ExcelHssfView 

ExcelHssfView

instead of

export.excel.class=org.displaytag.export.excel.DefaultHssfExportView

or don't add this property (export.excel.class) in the .property file

Upvotes: 1

RaceBase
RaceBase

Reputation: 18848

This seems to be bug and known issue in Displaytag http://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
}

Upvotes: 0

Related Questions