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.

Best Regards,
Mahesh Ganapathy

On 3/26/08, ook? ook! <[EMAIL PROTECTED]> wrote:
>
> Mahesh,
>
> The headless mode is already set.
> As expected, using an int casted in short don't differ from using directly
> a
> short.
>
> I'm playing with the styles, but I just gained an headache. Hoping someone
> will see the light ;)
>
> Thank you for your help.
>
> 2008/3/26, Mahesh Ganapathy <[EMAIL PROTECTED]>:
> >
> > Hello,
> > I am doing the exact same thing. even the way you call getCellStyle and
> > getFont. The only difference in code is when you do a resize, you
> declare
> > i
> > as short while I declare it as int and cast it to short inside the loop
> > (see
> > code below)
> >
> >
> > for (int i = 0; i < 6; i++)
> > {
> >    if (i != TITLE_COLUMN)
> >    {
> >       transmittalSheet.autoSizeColumn((short) i);
> >    } else
> >    {
> >       transmittalSheet.setColumnWidth(TITLE_COLUMN, TITLE_COLUMN_WIDTH);
> >    }
> > }
> >
> >
> > Also try adding the following line right at the beginning of your
> layout()
> > method
> >
> > System.*setProperty*("java.awt.headless", "true");
> >
> >
> > On 3/26/08, ook? ook! <[EMAIL PROTECTED]> wrote:
> >
> >
> > > Thank you for your information, Mahesh.
> > >
> > > Hum... Here some parts of the code:
> > >
> > > private static HSSFCellStyle _BOLD_STYLE = null;
> > >    private static HSSFFont _BOLD_FONT = null;
> > >
> > >    private HSSFCellStyle getBoldStyle() {
> > >        if (null == _BOLD_STYLE) {
> > >            _BOLD_STYLE = _wb.createCellStyle();
> > >            _BOLD_STYLE.setFont(getBoldFont());
> > >        }
> > >        return _BOLD_STYLE;
> > >    }
> > >
> > >    private HSSFFont getBoldFont() {
> > >        if (null == _BOLD_FONT) {
> > >            _BOLD_FONT = _wb.createFont();
> > >            _BOLD_FONT.setFontHeightInPoints((short)10);
> > >            _BOLD_FONT.setColor(HSSFFont.COLOR_NORMAL);
> > >            _BOLD_FONT.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
> > >        }
> > >        return _BOLD_FONT;
> > >    }
> > >
> > > Then during usage:
> > >
> > > HSSFCell c = null;
> > >        _curCellIndex = -1;
> > >        r = _sheet.createRow(++_curRowIndex);
> > >        c = r.createCell(++_curCellIndex);
> > >        final HSSFRichTextString ref = new
> > HSSFRichTextString("Référence");
> > >        c.setCellValue(ref);
> > >        c.setCellStyle(getBoldStyle());
> > >
> > > This is done somthing like 13times for "headers" in my sheet.
> > >
> > > And once the page is created, I call this:
> > >
> > > private void layout() {
> > >        _sheet.setColumnWidth((short)0, (short)2500);
> > >        _sheet.setColumnWidth((short)1, (short)2500);
> > >
> > >        for (short i = 2; i < 30; ++i) {
> > >            _sheet.autoSizeColumn(i);
> > >        }
> > >    }
> > >
> > > Then autoSizeColumn fire that strange exception.
> > >
> > > I think I'm following the same way than you. Can you see a problem in
> my
> > > lines?
> > >
> > > Thank you.
> > >
> > > 2008/3/26, Mahesh Ganapathy <[EMAIL PROTECTED]>:
> > > >
> > > > (remeber to see
> > > > http://poi.apache.org/hssf/quick-guide.html#WorkingWithFonts for
> > > > resrictions on number of fonts/styles in a workbook)
> > > >
> > > >
> > >
> >
>

Reply via email to