public static void main(String args[]) throws IOException{
String[] headers = {"column1","column2","column3", "column4", "column5", "column6", "column7"};
TimeStatistic time = new TimeStatistic();
time.start();
SXSSFWorkbook wb = new SXSSFWorkbook();
Sheet sheet = wb.createSheet();
//styles
XSSFCellStyle cellstyle = (XSSFCellStyle) wb.createCellStyle();
cellstyle.setFillForegroundColor(new XSSFColor(new Color(255,0,0)));
cellstyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
//add headers
Row row = sheet.createRow(0);
for(int i=0; i<headers.length; i++){
Cell cell = row.createCell(i);
cell.setCellStyle(cellstyle);
cell.setCellValue(headers[i]);
}
for(int i=0; i < 65536; i++){
row = sheet.createRow(i+1);
for(int j=0; j<headers.length; j++){
row.createCell(j).setCellValue(11111111);
}
}
FileOutputStream fileOut = new FileOutputStream("1.xlsx");
wb.write(fileOut);
time.end();
System.out.println(time.time());
int hw[] = getStringWidth("中国");
System.out.println(hw[0] + "," + hw[1]);
}
原文:http://1129254.blog.51cto.com/1119254/1732213