/*
* 那么现在就可以看看读取Excel中JXL中这四步骤如何体现:
* 1,通过Workbook的静态方法getWorkbook选取Excel文件Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));
* 2,通过Workbook的getSheet方法选择第一个工作簿(从0开始) Sheet sheet =workbook.getSheet(0);
* 3,通过Sheet方法的getCell方法选择位置为C2的单元格(两个参数都从0开始)Cell c2 = sheet.getCell(i,j);i=列,j=行
* 4,通过Cell的getContents方法把单元格中的信息以字符的形式读取出来 String stringc2 =c2.getContents();
*/
Workbook wb = null;
Sheet mysheet = null;
InputStream is = new FileInputStream(getFile());
wb = Workbook.getWorkbook(is);
mysheet = wb.getSheet(0);
Cell c2 = mysheet.getCell(1, 2);
String stringc2 = c2.getContents();
System.out.print(stringc2 + " ");
/* 写Excel步骤:
* 1,创建:WritableWorkbook book=Workbook.createWorkbook(newFile(“测试.xls”));
* 2,设置“第一页”的工作表,参数0表示这是第一页 WritableSheetsheet=book.createSheet(“第一页”,0);
* 3,指定单元格Label位置是第i列第j行(i,j) 以及单元格内容为context Label label=new Label(0,0,”context”);
* 4, 将定义好的单元格添加到工作表中sheet.addCell(label);
*/
WritableWorkbook book = Workbook.createWorkbook(os);
WritableSheet sheet = null;
sheet = book.createSheet("sheet", 0);
sheet.addCell(new Label(0, 0, "星期"));