Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rCell = readCell.getContents();
- float testnumber = Float.parseFloat(rCell);
- AssetManager assetManager = getAssets();
- InputStream inputStream = null;
- try {
- inputStream = assetManager.open("MyFile.xls");
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- readAsset = Workbook.getWorkbook(inputStream);
- } catch (IOException e) {
- e.printStackTrace();
- } catch (BiffException e) {
- e.printStackTrace();
- }
- Sheet s = readAsset.getSheet(0);
- Fnamexls="testfile" + ".xls";
- File sdCard = Environment.getExternalStorageDirectory();
- directory = new File (sdCard.getAbsolutePath() + "/MyFolder");
- directory.mkdirs();
- sdFile = new File(directory, Fnamexls);
- wbSettings = new WorkbookSettings();
- wbSettings.setLocale(new Locale("en", "EN"));
- try {
- wrWorkbook = Workbook.createWorkbook(sdFile, wbSettings);
- writeSheet = wrWorkbook.createSheet("First Sheet", 0);
- int row = s.getRows();
- int col = s.getColumns();
- //xx = "";
- for (int c = 0; c < col; c++) {
- for (int r = 0; r < row; r++) {
- Cell z = s.getCell(c, r);
- xx = z.getContents();
- Label label4 = new Label(c, r, String.valueOf(xx));
- try {
- writeSheet.addCell(label4);
- } catch (RowsExceededException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (WriteException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- wrWorkbook.write();
- try {
- wrWorkbook.close();
- } catch (WriteException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //createExcel(excelSheet);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- readTest();
- public void readTest(){
- Workbook m_workBook = null;
- try {
- m_workBook = Workbook.getWorkbook(sdFile);
- } catch (IOException e) {
- e.printStackTrace();
- } catch (BiffException e) {
- e.printStackTrace();
- }
- readSheet = m_workBook.getSheet(0);
- int rRow = readSheet.getRows();
- int rCol = readSheet.getColumns();
- Cell readCell = readSheet.getCell(2, 0);
- rCell = readCell.getContents();
- float testnumber = Float.parseFloat(rCell); //Line error
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement