//autoSizeColumn()方法自动调整excel列宽
importjava.io.FileOutputStream;
importorg.apache.poi.hssf.usermodel.HSSFCell;
importorg.apache.poi.hssf.usermodel.HSSFCellStyle;
importorg.apache.poi.hssf.usermodel.HSSFFont;
importorg.apache.poi.hssf.usermodel.HSSFRow;
importorg.apache.poi.hssf.usermodel.HSSFSheet;
importorg.apache.poi.hssf.usermodel.HSSFWorkbook;
importorg.apache.poi.hssf.usermodel.HSSFRichTextString;
importorg.apache.poi.hssf.usermodel.HSSFDataFormat;
importorg.apache.poi.hssf.usermodel.HSSFComment;
importorg.apache.poi.hssf.usermodel.HSSFPatriarch;
importorg.apache.poi.hssf.usermodel.HSSFClientAnchor;
publicclassPoiCreateExcelTest {
publicstaticvoidmain(String[] args) {
//创建新的Excel 工作簿
HSSFWorkbook workbook =newHSSFWorkbook();
//在Excel工作簿中建一工作表,其名为缺省值, 也可以指定Sheet名称
<