50,547
社区成员
发帖
与我相关
我的任务
分享
package cn.hit;
import java.io.File;
import java.io.IOException;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class Jxl {
public static void main(String[] args) {
try {
String testPathString = "F:\\Users\\sun\\Desktop\\New folder\\";
WritableWorkbook workbook = Workbook.createWorkbook(new File(testPathString + "output.xls"));
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
Label label = new Label(0, 2, "A label record");
WritableCellFormat wcf = new WritableCellFormat();
wcf.setShrinkToFit(true);
label.setCellFormat(wcf);
sheet.addCell(label);
workbook.write();
workbook.close();
} catch (IOException e) {
e.printStackTrace();
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
}
}
用jExcelApi就能设置,POI有还是没有呢??????