0
我想將xls文件數據顯示爲sq-lite數據庫,我對此沒有想法,請幫助我,我已創建xls文件並且還讀取它但不要「T現在如何展示這些數據插入數據sq-lite.In下面的代碼我已經給讀xls文件代碼如何將xls文件數據存儲到sqlite數據庫
try
{
InputStream input = new BufferedInputStream(new FileInputStream("/sdcard/raav.xls"));
POIFSFileSystem fs = new POIFSFileSystem(input);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
Iterator rows = sheet.rowIterator();
while(rows.hasNext())
{ HSSFRow row = (HSSFRow)
rows.next();
System.out.println("\n");
Iterator cells = row.cellIterator();
while(cells.hasNext())
{
HSSFCell cell = (HSSFCell) cells.next();
if(HSSFCell.CELL_TYPE_NUMERIC==cell.getCellType())
System.out.print(cell.getNumericCellValue()+" ");
else if(HSSFCell.CELL_TYPE_STRING==cell.getCellType())
System.out.print(cell.getStringCellValue()+" ");
else if(HSSFCell.CELL_TYPE_BOOLEAN==cell.getCellType())
System.out.print(cell.getBooleanCellValue()+" ");
else if(HSSFCell.CELL_TYPE_BLANK==cell.getCellType())
System.out.print("BLANK ");
else
System.out.print("Unknown cell type"); } }}
catch (Exception e) {
}
}
不清楚你想要什麼。你想直接存儲XLS文件還是將其轉換爲表格? – m0skit0 2014-09-30 07:48:55
我想直接存儲爲sq-lite數據庫 – Ravi 2014-10-04 09:37:22