Thank you again, Mahesh.
I tried to specify the font name, but that didn't change anything.
The only workaround I've found out is to maintain a list of cells to which
apply the Style, but postponed the application *after* the autosizeColum().
The result is not perfect, but acceptable waiting for a fix of that problem.
2008/3/26, Mahesh Ganapathy <[EMAIL PROTECTED]>:
>
> Here is my code snippet
>
> [code]
> createFile(String filePath)
> {
> // Generate the fonts.
> generateFonts();
>
> // Generate the styles used in the workbook
> HSSFCellStyle headerStyle = getHeaderStyle();
> HSSFCellStyle subHeaderStyle = getSubHeaderStyle();
> HSSFCellStyle docheaderStyle = getDocHdrLabelStyle();
> HSSFCellStyle labelStyle = getLabelStyle();
> HSSFCellStyle valueStyle = getValueStyle();
> HSSFCellStyle expandedLabelStyle = getExpandedLabelStyle();
> HSSFCellStyle textAreaStyle = getTextAreaStyle();
> HSSFCellStyle documentDetailStyle = getDocumentDetailsStyle();
> :
> :
> :
> } // End createFile()
>
> private void generateFonts()
> {
> // Header Font
> m_headerFont = m_excelBook.createFont();
> m_headerFont.setFontHeightInPoints((short) 14);
> m_headerFont.setFontName("Arial");
> m_headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
>
> // Sub Header Font
> m_subHeaderFont = m_excelBook.createFont();
> m_subHeaderFont.setFontHeightInPoints((short) 12);
> m_subHeaderFont.setFontName("Arial");
> m_subHeaderFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
> :
> :
> :
> } // End generateFonts()
>
> private HSSFCellStyle getHeaderStyle()
> {
> HSSFCellStyle style = m_excelBook.createCellStyle();
> style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
> style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
> style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
> style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
> style.setFont(m_headerFont);
> return style;
> } // End getHeaderStyle()
>
> private HSSFCellStyle getSubHeaderStyle()
> {
> HSSFCellStyle style = m_excelBook.createCellStyle();
> style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
> style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
> style.setFont(m_subHeaderFont);
> return style;
> } // End getSubHeaderStyle()
>
> [/code]
>
>
> On 3/26/08, ook? ook! <[EMAIL PROTECTED]> wrote:
> >
>
> > Does your Font include Bold?
> >
> > 2008/3/26, Mahesh Ganapathy <[EMAIL PROTECTED]>:
> > >
> > > Hello,
> > > just for clarification, I am using *POI 3.0.2-FINAL-20080204 and JDK
> > > compiler compliance level 1.4*
> > > I am using the same code and I don't get the exception.
> > >
> > >
> >
>