Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:-
Description
When on page > 1 in a paginated dataTable, the dataExporter (ignorePagination=false) will add empty rows to the spreadsheet accounting for entries in previous pages. For example, on page 1 it will correctly export the current page data with no extra empty rows. If you paginate to page 2 or 3, you will see the current page exported but also a large amount of empty rows which make up the previous pages. Attached is a screenshot.
It's question about OutputHandler for Excel.
DataExporter provide rowIndex, which used by ExcelOutputHandler.
Way to fix this IMO next:
(file ExcelOutputHandler.java, changed lines market with ///!)
...
private Integer startRow = null; ///!
...
public void writeCell(Object output, int col, int row) {
if(startRow == null) startRow = new Integer(row); ///!
WritableCell cell = null;
if( output instanceof String )
{ cell = new Label(col, row + 1 - startRow.intValue(), (String)output); ///! }else if( output instanceof Double )
{ cell = new Number(col, row + 1 - startRow.intValue(), ((Double)output).doubleValue()); ///! }try
{ sheet.addCell(cell); }catch(WriteException e)
{ System.out.println("Could not write excel cell"); e.printStackTrace(); }}