2011년 1월 2일 일요일
[Android Course][English][Theme][DB] - Android Java Excel API(jxl.jar) Usage
In addition, inquiries, or questions, please contact us.
(joonryang@gmail.com)
1. 'Jxl.jar' Download
1) Download URL.
http://www.andykhan.com/jexcelapi/download.html
=> Download the latest version.
2) 'jxl.jar' File Find.
ex) 'jexcelapi_2_6_12.tar.tar'
2. Eclipse Project 'jxl.jar' Add File
1) 'Eclipse -> Project -> Properties' Select
2) Java Build Path -> Libraries -> Add JARs -> 'jxl.jar' Add
3. Android Java Coding.
※ 'Java Excel API' is a basic grammar.
For more information, 'jxl.jar' downloading, installed 'Doc' See article.
1) 'Excel File' Create
/ / FileName (Full Path) to the excel file is created
WritableWorkbook workbook = Workbook.createWorkbook(new File(FileName));
2) 'Worksheet' Create
WritableSheet sheet1 = workbook.createSheet("Sheet-Name1", 0);
WritableSheet sheet2 = workbook.createSheet("Sheet-Name2", 1);
WritableSheet sheet3 = workbook.createSheet("Sheet-Name3", 2);
3) 'Column' Create
jxl.write.WritableCellFormat format = new WritableCellFormat();
jxl.write.Label label = null;
label = new jxl.write.Label(0,0,"Column1",format);
sheet.addCell(label);
label = new jxl.write.Label(1,0,"Column2",format);
sheet.addCell(label);
4) Save & Close
workbook.write();
workbook.close();
5) Excel File Reading
File filePath = new File(File Full Path Name);
Workbook workbook = Workbook.getWorkbook(filePath);
Sheet sheet = workbook.getSheet(0);
// Excel File Total row & column count
int rowLength = sheet.getRows();
int columnsLength = sheet.getColumns();
// Reading
String[][] data = new String[rowLength][columnsLength];
for(int i = 0; i < rowLength; i++) {
for(int j = 0; j < columnsLength; j++) {
Cell cell = sheet.getCell(j, i);
data[i][j] = cell.getContents();
}
}
In addition, inquiries, or questions, please contact us.
(joonryang@gmail.com)
라벨:
android excel,
excel,
jxl,
jxl.jar,
workbook
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기