While I understand it may be a bit confusing at current, please only
mail one list. I'll take a look at this. Expect an answer from me
Saturday at the latest.
Glen if you are available sooner can you look at this?
Thanks,
Andy
On Wed, 2002-01-30 at 10:15, Thutika, Swamy wrote:
>
>
> -----Original Message-----
> From: Thutika, Swamy
> Sent: Wednesday, January 30, 2002 10:11 AM
> To: '[EMAIL PROTECTED]'
> Subject: How to get the FONT object of a cell?
>
>
> Hi all,
> I am trying to read an xls file and get the font of a cell. How do I do
> that?? I use 120 version
> When I tried to get font index for that i get following error:
>
> Font idx is 22
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
> There only 6 font records, you asked for 22
>
> Here is the code snippet:
> ****************************************************************************
> *********************************************
> POIFSFileSystem fs = new POIFSFileSystem(new
> FileInputStream("myfile.xls"));
> HSSFWorkbook wb = new HSSFWorkbook(fs); // create a workbook
> reference
> HSSFSheet s = wb.getSheetAt(0); // create a new sheet
> HSSFRow r = s.getRow(0); // get the first row object
> reference
> HSSFCell c = r.getCell((short)1); // get the first cell
> object reference
> HSSFCellStyle cs = c.getCellStyle(); // get the cell style
> //HSSFFont f = wb.createFont();
>
> short csIndex = cs.getIndex();
> System.out.println("Font idx is " + csIndex);
> //HSSFFont f = wb.getFontAt(csIndex);
> //System.out.println(f.getFontHeightInPoints());
> System.out.println(c.getStringCellValue());
> System.out.println(cs.getFillForegroundColor());
> ****************************************************************************
> ****************************************************
>
> Any help appreciated.
>
> thanks
> Swamy
--
www.superlinksoftware.com
www.sourceforge.net/projects/poi - port of Excel format to java
http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
- fix java generics!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh