See https://poi.apache.org/apidocs/org/apache/poi/ss/util/CellUtil.html#setCellStyleProperty(org.apache.poi.ss.usermodel.Cell,%20org.apache.poi.ss.usermodel.Workbook,%20java.lang.String,%20java.lang.Object) On Jan 19, 2016 8:19 AM, "Javen O'Neal" <[email protected]> wrote:
> Make sure you call cell.setCellStyle(myCellStyle) when you're doing. You > may want to use CellUtil.setStyleProperties to avoid creating duplicate > styles or modifying the styles of other cells that share the same style. > On Jan 19, 2016 08:06, "Schene, Chris" <[email protected]> wrote: > >> Hi, >> >> I am using this code to create a cell that I want left justified but it is >> showing up as centered >> >> private CellStyle createCellString(XSSFWorkbook wb, int c) { >> CellStyle myCellStyleStyle= wb.createCellStyle(); >> XSSFFont myFont= wb.createFont(); >> myFont.setFontHeightInPoints((short)10); >> myFont.setFontName("Arial"); >> //System.out.println("createCellString color = " + c + >> "(" + >> getColorName(c) + ")"); >> myFont.setColor((short) c); >> myFont.setBold(c == getColorIndex("BLACK") ? false : >> true); >> myFont.setItalic(false); >> myCellStyleStyle.setFont(myFont); >> myCellStyleStyle.setAlignment((short) ALIGN_LEFT); >> myCellStyleStyle.setVerticalAlignment(valign); >> return myCellStyleStyle; >> } >> >> >> >> Christopher Schene >> Field Engineer >> Global >> Fraud and Identity Solutions >> >> Experian >> 16260 N. 71st Street >> Suite #400 ?Scottsdale >> Arizona, USA >> 85254 >> +1 602.290.9792 mobile >> +1 480.751.3928 office >> [email protected] >> www.experian.com <http://www.experian.com/> >> >> >> >> >> >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >>
