標籤:java excel jxl
1、設計源碼
/** * * @title:ExcelUtils.java * @Package:com.you.utils * @Description:<h3>一句話描述功能</h3> * @author:遊海東 * @date:2015-3-21下午10:17:34 * @version V1.0 * */package com.you.utils;import java.io.File;import java.io.IOException;import jxl.Workbook;import jxl.write.Label;import jxl.write.Number;import jxl.write.WritableSheet;import jxl.write.WritableWorkbook;import jxl.write.WriteException;import jxl.write.biff.RowsExceededException;/** * * 項目名稱:Excel * 類名稱:ExcelUtils * 類描述: * 建立人:遊海東 * 建立時間:2015-3-21下午10:17:34 * 修改人:遊海東 * 修改時間:2015-3-21下午10:17:34 * 修改備忘: * @version V1.0 * */public class ExcelUtils {public static void main(String[] args){try {//產生Excel檔案WritableWorkbook wwb = Workbook.createWorkbook(new File("chart.xls"));//產生第一頁工作表WritableSheet sheet = wwb.createSheet("第一頁", 0);//指定儲存格Label label = new Label(0, 0, "chart");try{sheet.addCell(label);Number number = new Number(1,1,34.556);sheet.addCell(number);wwb.write();wwb.close();} catch (RowsExceededException e) {e.printStackTrace();} catch (WriteException e) {e.printStackTrace();}} catch (IOException e) {e.printStackTrace();}}}
2、設計結果
Java產生Excel檔案