mình có một file "myfile.xls" trong thẻ nhớ. vậy mình làm cách nào hay dung libs nào để đọc được file này. giúp mình với.
mình lên google thì có đoạn code này nhưng khi chạy thì nó báo không tìm thấy file.
Mã nguồn PHP:
[color=#000000]
string path [/color][color=#007700]= [/color][color=#0000bb]environment[/color][color=#007700].[/color][color=#0000bb]getexternalstoragedirectory[/color][color=#007700]().[/color][color=#0000bb]getabsolutepath[/color][color=#007700]() + [/color][color=#dd0000]"/myfile.xls"[/color][color=#007700]; [/color][color=#0000bb]init[/color][color=#007700]([/color][color=#0000bb]path[/color][color=#007700]); [/color]
Mã:
public void init(string filepath) {
// todo auto-generated method stub
fileinputstream fs = null;
try{
fs = new fileinputstream(new file(filepath));
contentreading(fs);
}catch(exception e){
e.printstacktrace();
}
}
public void contentreading(inputstream fileinputstream){
workbooksettings ws = null;
workbook workbook = null;
sheet s = null;
cell rowdata[] = null;
int rowcount = '0';
int columncont = '0';
int totalsheet = '0';
try{
ws = new workbooksettings();
ws.setlocale(new locale("en", "en"));
workbook = workbook.getworkbook(fileinputstream);
totalsheet = workbook.getnumberofsheets();
if(totalsheet > 0){
for(int j =0; j < totalsheet; j++){
system.out.println("sheet name: " + workbook.getsheet(j).getname());
}
}
sheet sheet = workbook.getsheet(0);
// get number row and col contain data
int rows = sheet.getrows();
int cols = sheet.getcolumns();
system.out.println("data in file:");
// read data in each cell
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
cell cell = sheet.getcell(col, row);
system.out.print(cell.getcontents() + "\t");
}
system.out.println("
");
}
// close
workbook.close();
} catch (biffexception e) {
system.out.println("file not found
" + e.tostring());
} catch (ioexception e) {
system.out.println("file not found
" + e.tostring());
}
}
Mua dương vật ví thử thế nà tốt Bạn cần phải xác định xem sẽ dùng nó để làm những gì? tỉ dụ: Nếu muốn có dương vật giả để kích thích điểm G, bạn nên chọn loại dương vật giả làm từ chất liệu cứng...
Phương pháp để phụ nữ sử dụng dương vật giả đúng cách?