Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

How to convert CSV to proper Excel file (every name in diffrent cell)

Thread view: 
Marzena - 19 Apr 2008 17:28 GMT
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 :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.