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(); } } }
原文地址:http://blog.csdn.net/you23hai45/article/details/44523669