java - POI apache next row if not empty -
i wrote in excel file poi , if line completed passes row after not erase in xls file!
i can not find effective method.
currently code is:
private static boolean saveexcelfile(context context, string filename) { // check if available , not read if (!isexternalstorageavailable() || isexternalstoragereadonly()) { log.w("fileutils", "storage not available or read only"); return false; } boolean success = false; //new workbook workbook wb = new hssfworkbook(); cell c = null; //cell style header row cellstyle cs = wb.createcellstyle(); cs.setfillforegroundcolor(hssfcolor.lime.index); cs.setfillpattern(hssfcellstyle.solid_foreground); //new sheet sheet sheet1 = null; sheet1 = wb.createsheet("myorder"); // generate column headings row row = sheet1.createrow(0); c = row.createcell(0); c.setcellvalue("item number"); c.setcellstyle(cs); c = row.createcell(1); c.setcellvalue("quantity"); c.setcellstyle(cs); c = row.createcell(2); c.setcellvalue("price"); c.setcellstyle(cs); sheet1.setcolumnwidth(0, (15 * 500)); sheet1.setcolumnwidth(1, (15 * 500)); sheet1.setcolumnwidth(2, (15 * 500)); // create path place our list of objects on external storage file file = new file(context.getexternalfilesdir(null), filename); fileoutputstream os = null; try { os = new fileoutputstream(file); wb.write(os); log.w("fileutils", "writing file" + file); success = true; } catch (ioexception e) { log.w("fileutils", "error writing " + file, e); } catch (exception e) { log.w("fileutils", "failed save file", e); } { try { if (null != os) os.close(); } catch (exception ex) { } } return success; }
do have idea?
Comments
Post a Comment