groovy - Trying to setCellValue on blank cell -
i trying insert text blank cell
getrow( 0 ).getcell( 0 ).setcellvalue( 'hat selection' )
and keep getting
cannot invoke method setcellvalue() on null object
why can't insert text blank cell? how can i?
in case of object null, should first create , should set value on that. use createrow if have not created row already.
sheet.createrow(0);
if have created row, not respective cell first create respective cell , put desired value. use
sheet.getrow(0).createcell(0).setcellvalue(value);
or can combine all
sheet.createrow(0).createcell(0).setcellvalue(value);
Comments
Post a Comment