Details
Description
With the old version of Apache POI we used the Region class to define merged region whose constructor method was
new Region(firstRow, firstCol, lastRow, lastCol);
In the new version the class to use is CellRangeAddress wich use the constructor method
new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
Notice the signature changed from old way to new one. The fact is in displaytag-poi-2.2 I found the erronous old signature used to build the new class.
This would lead to a crash in the xls export of a table caption.
This is the fix for this bug :
/**
* Obtain the region over which to merge a cell.
* @param first Column number of first cell from which to merge.
* @param last Column number of last cell over which to merge.
* @return The region over which to merge a cell.
*/
private CellRangeAddress getMergeCellsRegion(int first, int last)
{
- return new CellRangeAddress(this.currentRow.getRowNum(), first, this.currentRow.getRowNum(), last);
+ return new CellRangeAddress(this.currentRow.getRowNum(), this.currentRow.getRowNum(), first, last);
}
Best Regards.
new Region(firstRow, firstCol, lastRow, lastCol);
In the new version the class to use is CellRangeAddress wich use the constructor method
new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
Notice the signature changed from old way to new one. The fact is in displaytag-poi-2.2 I found the erronous old signature used to build the new class.
This would lead to a crash in the xls export of a table caption.
This is the fix for this bug :
/**
* Obtain the region over which to merge a cell.
* @param first Column number of first cell from which to merge.
* @param last Column number of last cell over which to merge.
* @return The region over which to merge a cell.
*/
private CellRangeAddress getMergeCellsRegion(int first, int last)
{
- return new CellRangeAddress(this.currentRow.getRowNum(), first, this.currentRow.getRowNum(), last);
+ return new CellRangeAddress(this.currentRow.getRowNum(), this.currentRow.getRowNum(), first, last);
}
Best Regards.
http://displaytag.homeip.net/displaytag-examples-1.2/example-new-export.jsp
root cause
Exception: [.DefaultHssfExportView] !DefaultHssfExportView.errorexporting! Cause: The 'to' row (0) must not be less than the 'from' row (24)