I have same case with you, i also read template and write the data on graph value range cell, and it works.
I have 30 rows and 4 column data generated.

this is my code

  /**?????????????
    [EMAIL PROTECTED] java.io.File ?
    */
   public void openFile(File file) throws Exception{
       if(!file.exists() || file==null) {
           connected = false;
           throw new Exception("File didn't Exist");
       }
       FileInputStream fs=null;
       try{
           sourceFile = file;
           fs = new FileInputStream(file);
           poiFS  =  new POIFSFileSystem(fs);
           excel = new HSSFWorkbook(poiFS);
           connected = true;
       }catch(Exception ex){
           throw new Exception("Wrong File");
       }finally{
           try{fs.close();}catch(Exception ex){}
       }
   }
   /**?????????????????????????????????????
    [EMAIL PROTECTED] ??????????????????
    */
   public void saveFile(File file) throws Exception{
       if(file==null) {
           connected = false;
           throw new Exception("File didn't Exist");
       }
       FileOutputStream os=null;
       ObjectOutputStream obj=null;
       try{
           byte[] bt = excel.getBytes();
           os = new FileOutputStream(file);
           //obj = new ObjectOutputStream(os);
           //obj.write(bt);
           excel.write(os);
           //poiFS.writeFilesystem(os);
       }catch(Exception ex){
           throw new Exception("Wrong File");
       } finally{
           //obj.close();
           os.close();
       }
   }
----- Original Message ----- From: "Lucille DJARA" <[EMAIL PROTECTED]>
To: "'POI Users List'" <poi-user@jakarta.apache.org>
Sent: Monday, April 02, 2007 6:42 PM
Subject: RE: Chart sheet problem - Unable to read file


Hi,

I am already using POI 3 Alpha version.
It seems to be OK when the charts have small data (2 columns and 3 rows).
And when the data is bigger I get the error.

My test is this one (I only load the tenplate and write it into a new file):

public class MyXLSTest {

public static void main(String[] args) {
copy("test_bar1.xls", "output_bar1.xls");
copy("test_bar2.xls", "output_bar2.xls");
copy("test_line1.xls", "output_line1.xls");
copy("test_line2.xls", "output_line2.xls");
}

public static void copy(String input, String output){
try {
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(input));
HSSFWorkbook wb = new HSSFWorkbook(fs);
FileOutputStream fileOut = new
FileOutputStream(output);
wb.write(fileOut);
fileOut.flush();
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

I ran this test with different input and I got this conclusion.

Are you sure that it is fixed for all charts?

Thank you.

Lucille

-----Original Message-----
From: dedy rustandi [mailto:[EMAIL PROTECTED]
Sent: 31 March 2007 02:18
To: POI Users List
Subject: Re: Chart sheet problem - Unable to read file

You should use POI 3 Alpha version. That bug has been fixed
----- Original Message ----- From: "Lucille DJARA" <[EMAIL PROTECTED]>
To: <poi-user@jakarta.apache.org>
Sent: Saturday, March 31, 2007 12:35 AM
Subject: Chart sheet problem - Unable to read file


Hi,



I am trying to use the HSSF API to:

1. load a template contaning a chart sheet 2. write data 3. save the new
file with the data



It is OK when the chart sheet is the last sheet of my workbook, but when
there are other sheets after the chart sheet I get the message "Unable to
read file" from MS Excel. It is OK with OpenOffice.

If I do Save As with OpenOffice, then I can open it with MS Excel



Can somebody tell me what to do in order that my file can be open with MS
Excel?



Thanks



Lucille






----------------------------------------------------------------------------
----


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 2007/03/30
13:15


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.24/742 - Release Date: 2007/04/01 20:49




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to