You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Amir Hossein Sharifzadeh <am...@gmail.com> on 2007/06/26 12:37:52 UTC

corrupt after rewriting

Dear Sir/ Madam
I need to read from Excel, change some data and rewrite in same excel like
these codes:
==============================================================
// reading
.....
POIFSFileSystem poifsFileSystem;
........
hssfWorkbook = new HSSFWorkbook(poifsFileSystem, false);

// change data from some cells in hssfWorkbook
....
....


//  Rewriting:
......
                FileOutputStream outputStream =
                    new FileOutputStream(CONFIG_PATH);
                hssfWorkbook.write(outputStream);
                outputStream.close();
==============================================================

after writing, when I open again this file, I see this file was damaged and
many content of my data have lost. I get this warning:
Excel file unreachable content in 'project.xsl'. Do you want to recover the
content of this workbook?......
please help me how can I rerwrite to Excel file without these problems.
Thanks a lot

Re: corrupt after rewriting

Posted by Amir Hossein Sharifzadeh <am...@gmail.com>.
I try with 2007and 2002

On 6/26/07, Tahir Akhtar <ta...@spectrum-tech.com> wrote:
>
> Which version of excel you are using to create the original file?
>
> Amir Hossein Sharifzadeh wrote:
> > I never open my excel "project.xsl" by Microsoft Excel, First I read
> file
> > from Excel by FileInputStream , then I close that, and I rewrite by
> > FileOutputStream.
> > That is not problem, I told I corrupt some data.
> > Would you please show me sample code for rewriting.
> > Thanks a lot
> > -- Sharifzadeh
> >
> >
> > On 6/26/07, Dónal Doyle <Do...@idiro.com> wrote:
> >>
> >> Should you be saving the file as project.xls and not project.xsl?
> >>
> >> Donal Doyle
> >> Idiro Technologies
> >> Synergy Centre, ITT Dublin,
> >> Tallaght, Dublin 24, Ireland
> >>
> >> T +353.1.657.2956
> >> M+353.86.876.1952 kes a subjec
> >> F +353.1.443.0582
> >> E: donal.doyle@idiro.com
> >>
> >>
> >> -----Original Message-----
> >> From: Amir Hossein Sharifzadeh [mailto:amirsharifzadeh@gmail.com]
> >> Sent: 26 June 2007 11:38
> >> To: user@poi.apache.org
> >> Subject: corrupt after rewriting
> >>
> >> Dear Sir/ Madam
> >> I need to read from Excel, change some data and rewrite in same excel
> >> like
> >> these codes:
> >> ==============================================================
> >> // reading
> >> .....
> >> POIFSFileSystem poifsFileSystem;
> >> ........
> >> hssfWorkbook = new HSSFWorkbook(poifsFileSystem, false);
> >>
> >> // change data from some cells in hssfWorkbook
> >> ....
> >> ....
> >>
> >>
> >> //  Rewriting:
> >> ......
> >>                FileOutputStream outputStream =
> >>                    new FileOutputStream(CONFIG_PATH);
> >>                hssfWorkbook.write(outputStream);
> >>                outputStream.close();
> >> ==============================================================
> >>
> >> after writing, when I open again this file, I see this file was damaged
> >> and
> >> many content of my data have lost. I get this warning:
> >> Excel file unreachable content in 'project.xsl'. Do you want to recover
> >> the
> >> content of this workbook?......
> >> please help me how can I rerwrite to Excel file without these problems.
> >> Thanks a lot
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: corrupt after rewriting

Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
Which version of excel you are using to create the original file?

Amir Hossein Sharifzadeh wrote:
> I never open my excel "project.xsl" by Microsoft Excel, First I read file
> from Excel by FileInputStream , then I close that, and I rewrite by
> FileOutputStream.
> That is not problem, I told I corrupt some data.
> Would you please show me sample code for rewriting.
> Thanks a lot
> -- Sharifzadeh
>
>
> On 6/26/07, Dónal Doyle <Do...@idiro.com> wrote:
>>
>> Should you be saving the file as project.xls and not project.xsl?
>>
>> Donal Doyle
>> Idiro Technologies
>> Synergy Centre, ITT Dublin,
>> Tallaght, Dublin 24, Ireland
>>
>> T +353.1.657.2956
>> M+353.86.876.1952 kes a subjec
>> F +353.1.443.0582
>> E: donal.doyle@idiro.com
>>
>>
>> -----Original Message-----
>> From: Amir Hossein Sharifzadeh [mailto:amirsharifzadeh@gmail.com]
>> Sent: 26 June 2007 11:38
>> To: user@poi.apache.org
>> Subject: corrupt after rewriting
>>
>> Dear Sir/ Madam
>> I need to read from Excel, change some data and rewrite in same excel 
>> like
>> these codes:
>> ==============================================================
>> // reading
>> .....
>> POIFSFileSystem poifsFileSystem;
>> ........
>> hssfWorkbook = new HSSFWorkbook(poifsFileSystem, false);
>>
>> // change data from some cells in hssfWorkbook
>> ....
>> ....
>>
>>
>> //  Rewriting:
>> ......
>>                FileOutputStream outputStream =
>>                    new FileOutputStream(CONFIG_PATH);
>>                hssfWorkbook.write(outputStream);
>>                outputStream.close();
>> ==============================================================
>>
>> after writing, when I open again this file, I see this file was damaged
>> and
>> many content of my data have lost. I get this warning:
>> Excel file unreachable content in 'project.xsl'. Do you want to recover
>> the
>> content of this workbook?......
>> please help me how can I rerwrite to Excel file without these problems.
>> Thanks a lot
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>


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


Re: corrupt after rewriting

Posted by Amir Hossein Sharifzadeh <am...@gmail.com>.
I never open my excel "project.xsl" by Microsoft Excel, First I read file
from Excel by FileInputStream , then I close that, and I rewrite by
FileOutputStream.
That is not problem, I told I corrupt some data.
Would you please show me sample code for rewriting.
Thanks a lot
-- Sharifzadeh


On 6/26/07, Dónal Doyle <Do...@idiro.com> wrote:
>
> Should you be saving the file as project.xls and not project.xsl?
>
> Donal Doyle
> Idiro Technologies
> Synergy Centre, ITT Dublin,
> Tallaght, Dublin 24, Ireland
>
> T +353.1.657.2956
> M+353.86.876.1952
> F +353.1.443.0582
> E: donal.doyle@idiro.com
>
>
> -----Original Message-----
> From: Amir Hossein Sharifzadeh [mailto:amirsharifzadeh@gmail.com]
> Sent: 26 June 2007 11:38
> To: user@poi.apache.org
> Subject: corrupt after rewriting
>
> Dear Sir/ Madam
> I need to read from Excel, change some data and rewrite in same excel like
> these codes:
> ==============================================================
> // reading
> .....
> POIFSFileSystem poifsFileSystem;
> ........
> hssfWorkbook = new HSSFWorkbook(poifsFileSystem, false);
>
> // change data from some cells in hssfWorkbook
> ....
> ....
>
>
> //  Rewriting:
> ......
>                FileOutputStream outputStream =
>                    new FileOutputStream(CONFIG_PATH);
>                hssfWorkbook.write(outputStream);
>                outputStream.close();
> ==============================================================
>
> after writing, when I open again this file, I see this file was damaged
> and
> many content of my data have lost. I get this warning:
> Excel file unreachable content in 'project.xsl'. Do you want to recover
> the
> content of this workbook?......
> please help me how can I rerwrite to Excel file without these problems.
> Thanks a lot
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

RE: corrupt after rewriting

Posted by Dónal Doyle <Do...@idiro.com>.
Should you be saving the file as project.xls and not project.xsl?

Donal Doyle
Idiro Technologies
Synergy Centre, ITT Dublin,
Tallaght, Dublin 24, Ireland

T +353.1.657.2956
M+353.86.876.1952
F +353.1.443.0582
E: donal.doyle@idiro.com


-----Original Message-----
From: Amir Hossein Sharifzadeh [mailto:amirsharifzadeh@gmail.com] 
Sent: 26 June 2007 11:38
To: user@poi.apache.org
Subject: corrupt after rewriting

Dear Sir/ Madam
I need to read from Excel, change some data and rewrite in same excel like
these codes:
==============================================================
// reading
.....
POIFSFileSystem poifsFileSystem;
........
hssfWorkbook = new HSSFWorkbook(poifsFileSystem, false);

// change data from some cells in hssfWorkbook
....
....


//  Rewriting:
......
                FileOutputStream outputStream =
                    new FileOutputStream(CONFIG_PATH);
                hssfWorkbook.write(outputStream);
                outputStream.close();
==============================================================

after writing, when I open again this file, I see this file was damaged and
many content of my data have lost. I get this warning:
Excel file unreachable content in 'project.xsl'. Do you want to recover the
content of this workbook?......
please help me how can I rerwrite to Excel file without these problems.
Thanks a lot


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