Summary: | Problems with the cell format when setting border | ||
---|---|---|---|
Product: | POI | Reporter: | Gianfrancesco Martinico <PVG-Martinico> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 1.5.1 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | All |
Description
Gianfrancesco Martinico
2002-06-13 09:50:44 UTC
can you provide a code snipplet of what you are doing to set the border? I have problems when I set the border of a cell without setting a color for the border. For instance, have a look at the following code: _______________________________________________________________________ HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); HSSFRow row = null; HSSFCell cell = null; // Creating Title Cell Style HSSFFont fontTitle = wb.createFont(); HSSFCellStyle csTitle = wb.createCellStyle(); fontTitle.setFontHeightInPoints((short)10); fontTitle.setColor(HSSFColor.WHITE.index); fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); csTitle.setFont(fontTitle); csTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER); csTitle.setBorderBottom(HSSFCellStyle.BORDER_THICK); csTitle.setBorderTop(HSSFCellStyle.BORDER_THICK); csTitle.setBorderLeft(HSSFCellStyle.BORDER_THICK); csTitle.setBorderRight(HSSFCellStyle.BORDER_THICK); /*********************** Code commented ************************** //csTitle.setLeftBorderColor(HSSFColor.BLACK.index); //csTitle.setRightBorderColor(HSSFColor.BLACK.index); //csTitle.setTopBorderColor(HSSFColor.BLACK.index); //csTitle.setBottomBorderColor(HSSFColor.BLACK.index); ******************************************************************/ csTitle.setFillPattern((short)1); csTitle.setFillForegroundColor(HSSFColor.BLUE_GREY.index); // Setting Format General csTitle.setDataFormat((short)0); row = sheet.createRow((short)0); for (short j = 0; j < 10; ++j) { cell = row.createCell((short)j); cell.setCellStyle(csTitle); } _________________________________________________________________________ If I try to click the right mouse button on the generated cells, the pop up window won't appear. If I instead remove the comments and set explicitly the border color of the cell, then the pop-up window will appear. I will suggest to assign a default border color to avoid this behaviour. I have problems when I set the border of a cell without setting a color for the border. For instance, have a look at the following code: _______________________________________________________________________ HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); HSSFRow row = null; HSSFCell cell = null; // Creating Title Cell Style HSSFFont fontTitle = wb.createFont(); HSSFCellStyle csTitle = wb.createCellStyle(); fontTitle.setFontHeightInPoints((short)10); fontTitle.setColor(HSSFColor.WHITE.index); fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); csTitle.setFont(fontTitle); csTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER); csTitle.setBorderBottom(HSSFCellStyle.BORDER_THICK); csTitle.setBorderTop(HSSFCellStyle.BORDER_THICK); csTitle.setBorderLeft(HSSFCellStyle.BORDER_THICK); csTitle.setBorderRight(HSSFCellStyle.BORDER_THICK); /*********************** Code commented ************************** //csTitle.setLeftBorderColor(HSSFColor.BLACK.index); //csTitle.setRightBorderColor(HSSFColor.BLACK.index); //csTitle.setTopBorderColor(HSSFColor.BLACK.index); //csTitle.setBottomBorderColor(HSSFColor.BLACK.index); ******************************************************************/ csTitle.setFillPattern((short)1); csTitle.setFillForegroundColor(HSSFColor.BLUE_GREY.index); // Setting Format General csTitle.setDataFormat((short)0); row = sheet.createRow((short)0); for (short j = 0; j < 10; ++j) { cell = row.createCell((short)j); cell.setCellStyle(csTitle); } _________________________________________________________________________ If I try to click the right mouse button on the generated cells, the pop up window won't appear. If I instead remove the comments and set explicitly the border color of the cell, then the pop-up window will appear. I will suggest to assign a default border color to avoid this behaviour. Fixed... Thanks for the report. |