poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bret Gregory <bret.greg...@accesspointinc.com>
Subject Loss of Formating and Image when using a template
Date Mon, 17 May 2004 13:53:54 GMT

I am new to POI and am running into some problems trying to create a new
report using a template in POI 2.5.
I found a similar problem being reported in POI 2.0 but the bug report said
that it was resolved. 

Basically, I have a test case that attempts to modify one cell in the new
worksheet.  When I attempt to open the newly created file it gives me an
error that Microsoft attempted to repair the file.  Here is a copy of the
log:


	Errors were detected in file
'C:\API_RECON\test_data\excel_manipulation_test.xls'
	The following is a list of repairs:

	Damage to the file was so extensive that repairs were not possible.
Excel attempted to recover your formulas and values, but 	some data
may have been lost or corrupted.

The file opens, but all the formatting is gone and the image is not
displayed.
Is anyone else having this problem?  Any help is much appreciated.  


Here is my test code:

  public ExcelTest() {
  
    try {
      FileInputStream file = new
FileInputStream("C:\\API_RECON\\test_data\\Reconciliation_Report_Template.xl
t");
      HSSFWorkbook wb = new HSSFWorkbook(file, true);
      HSSFSheet sheet = wb.getSheetAt(0);
      HSSFRow title_row = sheet.getRow(3);
      HSSFCell title_cell = title_row.getCell((short)0);
      title_cell.setCellValue("TEST TEST TEST");
      
      FileOutputStream out = new
FileOutputStream("C:\\API_RECON\\test_data\\excel_manipulation_test.xls");
      wb.write(out); 
      out.close(); 

    } catch (FileNotFoundException fnf) {
      fnf.printStackTrace();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }  
  }
  
  public static void main(String[] args) {
    new ExcelTest();
  }






---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message