Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > how can i put R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3707 of 3747
Post > Topic >>

how can i put ResultSet to Excel File

by Marzena <marzena.bortnik@[EMAIL PROTECTED] > Apr 19, 2008 at 11:16 AM

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("");
  }


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 being visible ) Cause with comma,space,tab
whatever i cant see
anything :( And i need to do it in Java code
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




 1 Posts in Topic:
how can i put ResultSet to Excel File
Marzena <marzena.bortn  2008-04-19 11:16:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 1:05:35 CDT 2008.