if (removeEmptyRow) {
// check blank rows.
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
Cell cell = modelSheet.getCell(i, j, false);
if (cell != null && isEffectiveCell(cell)) {
nonBlankRow[i] = true;
break;
}
}
}
}
double width = 0;
for (short i = 1; i < columnCount + 1; i++) {
if (!modelSheet.isColumnEmpty(i - 1)) {
width = modelSheet.getColumnWidth(i - 1) / (1000 * baseCharWidth);
width *= XLSRenderOption.ADJUST_FACTOR;//Adjust width
if (resizeEmptyColumn) {
xlsSheet.setColumnWidth((i - 1), (int) (width * 256));
} else {
if (!modelSheet.isColumnEmpty(i - 1)) {
xlsSheet.setColumnWidth((i - 1), (int) (width * 256));
}
}
}
}
HSSFCellStyle emptyCellStyle = processor.getEmptyCellStyle();
HSSFCell emptyCell = null;
boolean fitPageHeight = false;
int printAreaColumnStart = -1;
int printAreaColumnEnd = 0;
int printAreaRowStart = -1;
int printAreaRowEnd = 0;
for (short y = 1; y < rowCount; y++) {
if (!removeEmptyRow || nonBlankRow[y]) {
HSSFRow xlsRow = xlsSheet.createRow(y);
double height = modelSheet.getRowHeight(y) / 1000d;// + 2;
logger.log(Level.FINER, "row height " + y + ": " + height);
if (!modelSheet.isRowEmpty((y))) {
xlsRow.setHeightInPoints(Math.max((float) (height),2f));
}
if (printAreaRowStart == -1) {
printAreaRowStart = y;
}
printAreaRowEnd = y;
for (short x = 0; x < columnCount; x++) {
if (resizeEmptyColumn || ((!resizeEmptyColumn) && !modelSheet.isColumnEmpty(x))) {
emptyCell = xlsRow.createCell(x);
emptyCell.setCellStyle(emptyCellStyle);
if (printAreaColumnStart == -1) {
printAreaColumnStart = x;
}
printAreaColumnEnd = x;
Cell element = modelSheet.getCell(y, x, false);
if (element != null) {
exportCell(element,
x,
y,
xlsSheet,