DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12899>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12899

Corrupted, but readable excel file is generated. Excel displays "File error. Some 
number formats may have been lost." on open.

           Summary: Corrupted, but readable excel file is generated. Excel
                    displays "File error. Some number formats may have been
                    lost." on open.
           Product: POI
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi,
I tried to generate excel file from template. When opening generated file with 
Excel (2002) it displayed the message: "File error. Some number formats may 
have been lost.".

Here are the files:
 - template file (http://www.geocities.com/et_victor/template.xls)
 - generated file (http://www.geocities.com/et_victor/result.xls)
 
The source of a generator program follows:
import java.io.*;
import java.util.*;
import java.sql.*;

import beans.common.*;
import beans.customers.*;

import util.transfer.*;

import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;

public class ExcelGenerator
{
 private static void generate(File objTemplate, File objTarget) throws Exception
 {
  //open
  FileInputStream fis = new FileInputStream(objTemplate);
  POIFSFileSystem fs = new POIFSFileSystem(fis);
  HSSFWorkbook wb = new HSSFWorkbook(fs);
  fis.close();

  FileOutputStream fileOut = new FileOutputStream(objTarget);
  wb.write(fileOut);
  fileOut.close();
 }

 public static void main(String[] args)
 {
  try
  {
   File objTemplate = new File("c:/temp/template.xls");
   File objTarget = new File("c:/temp/result.xls");
   generate(objTemplate, objTarget);
  }catch (Exception ex)
  {
   ex.printStackTrace();
  }
 }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to