| | |
| | | package com.vci.starter.poi.util; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.vci.starter.poi.annotation.ExcelColumn; |
| | | import com.vci.starter.poi.annotation.ExcelTitle; |
| | | import com.vci.starter.poi.bo.*; |
| | |
| | | //写值 |
| | | setCellValue(cell, value); |
| | | } |
| | | //设置自适应列宽 |
| | | sheet.autoSizeColumn(ed.getCol()); |
| | | if(ed.getWidth()!=null && ed.getWidth()>0){ |
| | | sheet.setColumnWidth(cell.getColumnIndex(),(int)(ed.getWidth() + 0.72)*256); |
| | | } |
| | |
| | | if (ed.getColTo() < ed.getCol()) { |
| | | ed.setColTo(ed.getCol()); |
| | | } |
| | | List<CellRangeAddress> cellRangeAddressList = sheet.getMergedRegions(); |
| | | sheet.addMergedRegion(new CellRangeAddress(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo())); |
| | | }); |
| | | } |