DisplayTag

ExcelHssfView sets Encoding for headerColumn too late

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1.1
  • Component/s: Export
  • Labels:
    None

Description

in ExcelHssfView:

line 127-129 the encoding should be set first: Please Correct this:

wrong:
cell.setCellValue(columnHeader);
cell.setCellStyle(headerStyle);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);

right:
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(columnHeader);
cell.setCellStyle(headerStyle);


This is taken from the documentation:
setCellValue:
set a string value for the cell. Please note that if you are using full 16 bit unicode you should call setEncoding() first.

Activity

Hide
fabrizio giustina added a comment -
fixed as suggested, thanks
Show
fabrizio giustina added a comment - fixed as suggested, thanks
Hide
Giorgos Saslis-Lagoudakis added a comment -
Don't know if you've fixed this already, but the DefaultHSSFExportView -- which makes use of the HssfTableWriter class to create the table -- has the same issue. This needs to be addressed in the writeHeaderFooter(String value, HSSFRow row, HSSFCellStyle style) method of the HssfTableWriter class as well:

wrong:
this.currentCell.setCellValue(value);
this.currentCell.setCellStyle(style);
this.currentCell.setEncoding(HSSFCell.ENCODING_UTF_16);


right:
this.currentCell.setEncoding(HSSFCell.ENCODING_UTF_16);
this.currentCell.setCellValue(value);
this.currentCell.setCellStyle(style);


thanks!
Giorgos
Show
Giorgos Saslis-Lagoudakis added a comment - Don't know if you've fixed this already, but the DefaultHSSFExportView -- which makes use of the HssfTableWriter class to create the table -- has the same issue. This needs to be addressed in the writeHeaderFooter(String value, HSSFRow row, HSSFCellStyle style) method of the HssfTableWriter class as well: wrong: this.currentCell.setCellValue(value); this.currentCell.setCellStyle(style); this.currentCell.setEncoding(HSSFCell.ENCODING_UTF_16); right: this.currentCell.setEncoding(HSSFCell.ENCODING_UTF_16); this.currentCell.setCellValue(value); this.currentCell.setCellStyle(style); thanks! Giorgos

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
3m
Original Estimate - 3 minutes
Remaining:
3m
Remaining Estimate - 3 minutes
Logged:
Not Specified
Time Spent - Not Specified