Commit 49223dfe authored by yanzg's avatar yanzg

设置单元格的值

parent efe320d2
......@@ -287,19 +287,6 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
}
}
/**
* 开始生成Excel文件
*
* @return 当前对象
*/
public ExcelConsole<T> open() {
this.check();
TableHead head = this.initHead();
initExcel(head);
return this;
}
private void writeDefineRow(List<ExcelDefineRow> rows) {
// 创建行
for (ExcelDefineRow row : rows) {
......@@ -308,12 +295,37 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
for (ExcelDefineCell cell : row.getCells()) {
cell.cellStyle = createCellStyle(cell);
cell.cell = createCell(sheetRow, cell.getColumn(), cell.getValue(), cell.cellStyle);
// 合并单元格
if (cell.getWidthSize() > 1 || cell.getHeightSize() > 1) {
int rowStart = rowIndex;
int rowEnd = rowStart + cell.getHeightSize() - 1;
int columnStart = cell.getColumn();
int columnEnd = columnStart + cell.getWidthSize() - 1;
CellRangeAddress region = new CellRangeAddress(rowStart, rowEnd, columnStart, columnEnd);
sheet.addMergedRegion(region);
setDefaultStyle(region, cell.cellStyle);
}
}
rowIndex++;
}
}
private void writeDefineFormula(List<ExcelDefineRow> rows) {
}
/**
* 开始生成Excel文件
*
* @return 当前对象
*/
public ExcelConsole<T> open() {
this.check();
TableHead head = this.initHead();
initExcel(head);
return this;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment