void | autoSizeColumn(int column, boolean useMergedCells) Adjusts the column width to fit the contents. |
void | autoSizeColumn(int column) Adjusts the column width to fit the contents. |
//列宽
sheet.autoSizeColumn(0,true);//第一列是合并列
for(int i=1;i<=1+years.size()*4;i++){
sheet.autoSizeColumn(i);
}
解释:对于合并列需要用 sheet.autoSizeColumn(0,true)方法,用 sheet.autoSizeColumn(0)无效