expects that row 0 has been created out of the documention of poi : to calculate column width : sheet.autosizecolumn uses java2d classes that throw exception if graphical environment is not available . in case if graphical environment is not available , you must tell java that you are running in headless mode and set the following system property : java.awt.headless = true . concode_field_sep PlaceHolder placeHolder concode_field_sep Field[] add concode_elem_sep void createHeader concode_elem_sep void createHeader concode_elem_sep String calculateCodeForCol concode_elem_sep void createFormulaRow concode_elem_sep void createFormulaRow concode_elem_sep void saveWorkbookTo concode_elem_sep void setValue concode_elem_sep void setValue concode_elem_sep CellStyle createDateCellStyle concode_elem_sep Field[] l concode_elem_sep CellStyle createBoldStyle concode_elem_sep String[] asList
void function ( Sheet arg0 ) { for ( int loc0 = 0 ; loc0 < arg0 . getRow ( 0 ) . getLastCellNum ( ) ; loc0 ++ ) { arg0 . autoSizeColumn ( loc0 ) ; } }