• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to get excel Value in specific Format ?

Hi All,
I have used Apache POI to read Excel file. In my Excel file there are three columns Code, Detail, CodeType. Below is the excelReadFile() method

private static void readExcelFile(Context context, String filename) {
if (!isExternalStorageAvailable() || isExternalStorageReadOnly()) {
Log.w("FileUtils", "Storage not available or read only");
return;
}

try {
// Creating Input Stream
File file = new File(context.getExternalFilesDir(null),

filename);
FileInputStream myInput = new FileInputStream(file);

// Create a POIFSFileSystem object
POIFSFileSystem myFileSystem = new POIFSFileSystem

(myInput);
// Create a workbook using the File System
HSSFWorkbook myWorkBook = new HSSFWorkbook

(myFileSystem);
// Get the first sheet from workbook
HSSFSheet mySheet = myWorkBook.getSheetAt(0);

/** We now need something to iterate through the cells.
**/
Iterator<Row> rowIter = mySheet.rowIterator();

while (rowIter.hasNext()) {
HSSFRow myRow = (HSSFRow) rowIter.next();
Iterator<Cell> cellIter = myRow.cellIterator();
while (cellIter.hasNext()) {
HSSFCell myCell = (HSSFCell)

cellIter.next();
Log.w("FileUtils", "Cell Value: " + myCell.toString());
Toast.makeText(context, "cell Value: " + myCell.toString(),

Toast.LENGTH_SHORT).show();
}
}
} catch (Exception e) {
e.printStackTrace();
}

return;
}

Now i want one method to get codeType when user entered Code on EditText Button

Thanks....
 
I've moved this to our Application Development forum so our coders could have a look.:)
 
Could you please place your code inside the
Code:
 tags? This retains the proper formatting and makes it much easier to read. Thanks. =)
 
Could you please place your code inside the
Code:
 tags? This retains the proper formatting and makes it much easier to read. Thanks. =)[/QUOTE]
If you check this page ([url=http://androidforums.com/misc.php?do=bbcode]Android Forums - BB Code List[/url]), there are a few options for formatting, code, PHP, and HTML.

You'll find them roughly 2/3 of the way down the page.:)
 
Back
Top Bottom