Hi,
 I get array out of bound exception in reading some xls files. I have
attached problematic xls file and the
 err text file. Could please someone explain what is the problem??
 <<err>>      <<simpletmpl.xls>> 

Verison 1.2.0


 The code snippet is:

****************************************************************************
*****************************************
public static void main(String[] args) throws IOException {
  
  FileOutputStream out    = new FileOutputStream("myout.xls");  
  POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
  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());
  c.setCellValue("Changed");
  System.out.println(cs.getFillForegroundColor());
  System.out.println("NUmber of fonts " + wb.getNumberOfFonts());
        
    wb.write(out);


****************************************************************************
***************************************************

thanks in advance
Swamy

Attachment: err
Description: Binary data

Attachment: simpletmpl.xls
Description: MS-Excel spreadsheet

Reply via email to