| | |
| | | int rowNo = (1 + rownum) - startNo;
|
| | | for (int i = startNo; i < endNo; i++)
|
| | | {
|
| | | rowNo = i > 1 ? rowNo + 1 : rowNo + i;
|
| | | rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo;
|
| | | row = sheet.createRow(rowNo);
|
| | | // 得到导出对象.
|
| | | T vo = (T) list.get(i);
|
| | | Collection<?> subList = null;
|
| | | if (isSubListValue(vo))
|
| | | if (isSubList())
|
| | | {
|
| | | subList = getListCellValue(vo);
|
| | | subMergedLastRowNum = subMergedLastRowNum + subList.size();
|
| | | if (isSubListValue(vo))
|
| | | {
|
| | | subList = getListCellValue(vo);
|
| | | subMergedLastRowNum = subMergedLastRowNum + subList.size();
|
| | | }
|
| | | else
|
| | | {
|
| | | subMergedFirstRowNum++;
|
| | | subMergedLastRowNum++;
|
| | | }
|
| | | }
|
| | |
|
| | | int column = 0;
|
| | | for (Object[] os : fields)
|
| | | {
|
| | |
| | | if (!headerStyles.containsKey(key))
|
| | | {
|
| | | CellStyle style = wb.createCellStyle();
|
| | | style = wb.createCellStyle();
|
| | | style.cloneStyleFrom(styles.get("data"));
|
| | | style.setAlignment(HorizontalAlignment.CENTER);
|
| | | style.setVerticalAlignment(VerticalAlignment.CENTER);
|
| | |
| | | if (!styles.containsKey(key))
|
| | | {
|
| | | CellStyle style = wb.createCellStyle();
|
| | | style = wb.createCellStyle();
|
| | | style.setAlignment(excel.align());
|
| | | style.setVerticalAlignment(VerticalAlignment.CENTER);
|
| | | style.setBorderRight(BorderStyle.THIN);
|
| | |
| | | {
|
| | | // 创建cell
|
| | | cell = row.createCell(column);
|
| | | if (isSubListValue(vo) && attr.needMerge())
|
| | | if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
|
| | | {
|
| | | CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column);
|
| | | sheet.addMergedRegion(cellAddress);
|