Hi,
I made application which needs to save the report file. I got report
file from the database and i got it as ResulSet.
I found in internet library calls CSVWriter which helps me save the
raport. The problem is that i dont know how to parse it to proper
Excel look.The code looks like this :
FileDialog d = new FileDialog(frame,"What file do you want to
save?",FileDialog.SAVE);
d.setFile("*.csv");
d.setDirectory(".");
d.show();
String saveFile;
if((saveFile = d.getFile()) != null) {
filename.setText(saveFile);
directory.setText(d.getDirectory());
try{
CSVWriter writer = new CSVWriter(new
FileWriter(directory.getText()+filename.getText()), ',');
writer.writeAll(rsDane2 , t);
writer.close();
}catch(java.sql.SQLException e){e.printStackTrace();}
catch(java.io.IOException f){ f.printStackTrace(); }
} else {
filename.setText("You pressed cancel");
directory.setText("");
}
I would be greatfull for any help. Im looking for two solutions.
1) How can I convert saved csv file to Excel or diffrent type of file
( The prioritet is the data be visable ) Cause with comma i cant see
anything :(
2) Maybe there is diffrent way to save ResultSet to the excel file.
This is really big array so i think the best way is to save it in
excel file
Jeff Higgins - 19 Apr 2008 17:54 GMT
How can I convert saved csv file to Excel ...
Open the csv file in Excel and save as worksheet or workbook.
Jeff Higgins - 19 Apr 2008 18:27 GMT
Maybe there is diffrent way to save ResultSet to the excel file.
<http://office.microsoft.com/en-us/excel/HA100996641033.aspx>
Marzena - 19 Apr 2008 19:12 GMT
Im talking about doing this using Java.
Save ResultSet to CSV which will be parse to fit Excel file. Or any
other way ...dont know :/
Jeff Higgins - 19 Apr 2008 20:16 GMT
> Im talking about doing this using Java.
> Save ResultSet to CSV which will be parse to fit Excel file. Or any
> other way ...dont know :/
I'm sorry, but I don't understand "parse to fit Excel file".
Roedy Green - 19 Apr 2008 21:40 GMT
On Sat, 19 Apr 2008 09:28:45 -0700 (PDT), Marzena
<marzena.bortnik@gmail.com> wrote, quoted or indirectly quoted someone
who said :
>I made application which needs to save the report file. I got report
>file from the database and i got it as ResulSet.
>I found in internet library calls CSVWriter which helps me save the
>raport. The problem is that i dont know how to parse it to proper
>Excel loo
see http://mindprod.com/jgloss/excel.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Alex.From.Ohio.Java@gmail.com - 19 Apr 2008 21:59 GMT
> Hi,
> I made application which needs to save the report file. I got report
[quoted text clipped - 31 lines]
> This is really big array so i think the best way is to save it in
> excel file
Two good free products:
http://poi.apache.org/
http://jexcelapi.sourceforge.net/
Alex.
http://www.myjavaserver.com/~alexfromohio/
Marzena - 20 Apr 2008 21:57 GMT
Tnx
JExcelApi was perfect:-) and helped me :-)