?????????????????Щ??????
???????????? ???????[ 2013/9/9 14:47:28 ] ????????
????4??????EXCEL
// ????Excel????
import java.io.File;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
public class CreateExcel{
public static void main(String args[]){
//Create_Excel c_e = new Create_Excel();
//c_e.createexcel();
//System.out.printf("success!!");
}
}
class Create_Excel{
public void createexcel(){
try{
// ?????
WritableWorkbook book = Workbook.createWorkbook(new File("test.xls"));
// ???????“????”????????????0??????????
WritableSheet sheet = book.createSheet("????"??0);
// ??Label????????????????????λ???????е????(0??0)
// ?????????????test
Label label1 = new Label(0??0??"test");
Label label2 = new Label(1??1??"test");
// ????????????????????????
sheet.addCell(label1);
sheet.addCell(label2);
/*
* ???????????????????? ???????Number????????·???????????????? ?????λ???????У?????У???555
*/
jxl.write.Number number = new jxl.write.Number(1??0??555);
sheet.addCell(number);
// д?????????????
book.write();
book.close();
}catch(Exception e){
System.out.println(e);
}
}
}
????5?????EXCEL
// ???Excel????
import java.io.File;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
/*
* ????1:???????????
* ????2:?????
* ????3:?????
* ????????0???
* ?????:?????????????
*/
public class ReadExcel{
static String result;
static Workbook book;
static Sheet sheet;
public static void main(String args[]){
//readExcel(0??1??0);
excelNum(0);
}
public static String readExcel(int no??int row??int line){
try{
book = Workbook.getWorkbook(new File("test.xls"));
// ????????????????
sheet = book.getSheet(no);
// ???????е???е?????
Cell cell1 = sheet.getCell(row??line);
result = cell1.getContents();
System.out.println(result);
book.close();
}catch(Exception e){
System.out.println(e);
}
return result;
}
//????????
public static int excelNum(int no){
int col = 0;
int row = 0;
try{
book = Workbook.getWorkbook(new File("test.xls"));
sheet = book.getSheet(no);
//?????????????
col = sheet.getColumns(); //????
row = sheet.getRows(); //????
System.out.println(col+" ??");
System.out.println(row+" ??");
book.close();
}catch(Exception e){
System.out.println(e);
}
return row;
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11