Yeah after some testing, it does appear to be the borders that are the
culprits rather than the color setting, which is a bummer because my entire
sheet is riddled with them. See the example code below which should help
isolate the problem.
cheers,
Ian
****************************************************************************
// java
import java.io.*;
// poi
import org.apache.poi.hssf.usermodel.*;
public class TestFormatCell {
public static void main(String[] args) {
try{
FileOutputStream out = new
FileOutputStream("./TestFormatCell.xls");// create new file
HSSFWorkbook wb = new HSSFWorkbook(); // create a new workbook
HSSFSheet sheet = wb.createSheet(); // create new sheets
wb.setSheetName(0, "sheet one");
HSSFFont font10Bold = wb.createFont();
font10Bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // make it bold
// create some cell styles to use
HSSFCellStyle cellStyleOne = wb.createCellStyle();
cellStyleOne.setFont(font10Bold);
cellStyleOne.setBorderRight(HSSFCellStyle.BORDER_THICK);
cellStyleOne.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFCellStyle cellStyleTwo = wb.createCellStyle();
cellStyleTwo.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyleTwo.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyleTwo.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyleTwo.setBorderBottom(HSSFCellStyle.BORDER_THIN);
HSSFRow r = null; // declare a row object reference
HSSFCell c = null; // declare a cell object reference
short rownum = (short)0;
r = sheet.createRow(rownum);
c = r.createCell((short)0);
c.setCellValue("This is the cell with the thick right border");
c.setCellStyle(cellStyleOne);
// let's skip a few rows to make sure we're out of the way of the
last cell
rownum = (short)5;
r = sheet.createRow(rownum);
c = r.createCell((short)0);
c.setCellValue("This is the cell with the thin borders");
c.setCellStyle(cellStyleTwo);
wb.write(out); // write the workbook to the output stream
out.close();
}
catch (Exception e) {
System.out.println("Exception " + e);
}
}
}
-----Original Message-----
From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
Sent: 07 May 2002 2:12
To: POI Users List
Subject: Re: Bug 6802 - Format Cells... dialog does not popup
Lets see some code that exposes this. I'm particuarly interested in the
color setting.
Basically this happens when a cell or font or what-have-you is set to
the improper color. Originally this happened often as we'd mis-aligned
BLACK to be 0x0. This WAS fixed. It is possible that we guessed wrong
on another color and you've exposed this... I tested this not to many
nights ago and it was working fine... So you may have stubled upon
another problem (or color) with the same symptom.
-Andy
Ian McIntosh wrote:
>Hi,
>
>Re: bug 6802 - "Format Cells... dialog does not popup" - the next to last
>comment in the bug description says that this should be included in the 1.5
>release. I've retried my code with the new release and it doesn't seem to
>have fixed the problem. I still get no dialog box when I right click and
>select Format Cells. Did it scrape through into the build or not?
>
>By the way, the new build certainly fixed some others - well done all
>concerned and keep up the good work.
>
>cheers,
>Ian
>
>
>________________________________________________________________________
>This email has been scanned for all viruses by the MessageLabs service.
>________________________________________________________________________
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs service.
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs service.
________________________________________________________________________