3469_3470: Use variable to make code more readable.

This commit is contained in:
U-BASIS\zhaohui 2018-01-26 15:14:27 -05:00
parent 4a4e163571
commit c7a7898b95

View File

@ -245,13 +245,14 @@ class ReportExcel implements TableReportModule {
public void addRow(List<String> rowData) {
Row row = sheet.createRow(rowIndex);
for (int i = 0; i < rowData.size(); ++i) {
Cell excelCell = row.createCell(i);
try {
row.createCell(i).setCellValue(rowData.get(i));
excelCell.setCellValue(rowData.get(i));
} catch (Exception e) {
if (e instanceof java.lang.IllegalArgumentException && rowData.get(i).length() > EXCEL_CELL_MAXIMUM_SIZE) {
row.getCell(i).setCellValue(Bundle.ReportExcel_exceptionMessage_dataTooLarge() + e.getMessage());
excelCell.setCellValue(Bundle.ReportExcel_exceptionMessage_dataTooLarge() + e.getMessage());
} else {
row.getCell(i).setCellValue(Bundle.ReportExcel_exceptionMessage_errorText());
excelCell.setCellValue(Bundle.ReportExcel_exceptionMessage_errorText());
}
}
}