public static void autoColumn(XSSFSheet sheet){
    int maxColumn = sheet.getRow(0).getPhysicalNumberOfCells();
    for(int i = 0; i < maxColumn; i++){
        sheet.autoSizeColumn(i);
    }
    for(int columnNum = 0; columnNum <= maxColumn; columnNum++){
        int columnWidth = sheet.getColumnWidth(columnNum) / 256;
        for(int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++){
            Row currentRow;
            if(sheet.getRow(rowNum) == null){
                currentRow = sheet.createRow(rowNum);
            }else{
                currentRow = sheet.getRow(rowNum);
            }

            if(currentRow.getCell(columnNum) != null){
                Cell currentCell = currentRow.getCell(columnNum);
                try {
                    int length = currentCell.toString().getBytes("GBK").length;
                    if(columnWidth < length + 1){
                        columnWidth = length + 8;
                    }
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
        sheet.setColumnWidth(columnNum, columnWidth * 256);
    }
}