Bug 9831

Summary: Problems with the cell format when setting border
Product: POI Reporter: Gianfrancesco Martinico <PVG-Martinico>
Component: HSSFAssignee: 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
Hi evetyone,
I'm working with the 1.6 version of Jakarta Poi.

I have still problems while trying to open the format cell popup window. This 
happens when I set up the border of the cell.
Can you please check if everything is OK or that I missed something?

Thanks for your help.
Comment 1 Andy Oliver 2002-07-15 00:46:35 UTC
can you provide a code snipplet of what you are doing to set the border?
Comment 2 Gianfrancesco Martinico 2002-07-15 07:50:57 UTC
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.
Comment 3 Gianfrancesco Martinico 2002-07-15 07:51:19 UTC
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.
Comment 4 Glen Stampoultzis 2002-07-20 14:12:02 UTC
Fixed... Thanks for the report.