Anyone can know how to change html data into excel in java. I have 1 Healthcare related application in which monthly report is to be generated at the end of the month. so this gonna possible in java????
Printable View
Anyone can know how to change html data into excel in java. I have 1 Healthcare related application in which monthly report is to be generated at the end of the month. so this gonna possible in java????
Ye it is possible, but you will need to give us alot of inforamtion on what you are trying to acheive. Most importantly sample input and sample output. The best way would be to produce a CSV which can then be imported into Excel.
Sorry for the slow reply.
Regards,
Chris
Suppose I have databse in which daliy I entered some information of student like roll no., class, age , sex, fee status etc. at the end of the month I want that a file will generate in the excel format that comprises of all the details of the student for the particular month. Please respond me as soon as possible. If you have code in java for this than it will be very helpul for me.
Thanks
You will need to write a Java application that connects to the Database you are using and then convert the data into an CSV since it is easier and then imort that data into Excel.
Regards,
Chris
Please provide me how to change data into CSV.
Comma-separated values - Wikipedia, the free encyclopedia
Regards,
Chris
Let me explain
I just design 2 -3 web pages in java, one for to registration form to enter student information in databse, and 2 nd page to fetch the data from database to show details of the student into a tabular form and third page is the home page where there are 3 links 1.for registration page 2. display details 3. generate report. for 3rd page i does not understand how to initiate shall i make a button that have written Generate report and call an action event on that or make link on the main page to redirect that main page onto some other page???
for trail purposes i used ms-access.
pls provide me your gmail id so that i will chat wid u whenever i'm get stuck into in the problem.
Both of these methods would work. I would probably go for the action event on the button..Quote:
Originally Posted by rgupta31
This tutorial will help you connect to the access database:
http://www.javaprogrammingforums.com...jdbc-java.html
You just need to select 'Microsoft Access Database' at the ODBC Data Source Administor stage.
Thank you very much who posted(JavaPF) this useful information for me.
I'll try this, if i face any problem i'll get back to you.
Thnaks again.
No problem :)
If you get stuck then please post whatever code you have so far and hopefully I will be able to help you move forward.
Please provide me full code for convert some database data into excel, i.e. from jsp to excel. I did but not got it.
rgupta31, please don't double post. Creating another duplicate thread won't make things happen any faster.
First you need to work out the logic for how you are going to do this.
I suggest you first connect to the database, extract the information line by line, and then write it out again as a .csv file. Chris provided you a link with information on .csv.
I already gave you the link to a tutorial on how to connect to the database and you can use this tutorial to write the csv file:
http://www.javaprogrammingforums.com...sing-java.html
This is untested but it will look something like this:
Code :import java.sql.*; import java.io.*; public class Rgupta31 { /** * JavaProgrammingForums.com */ public static void main(String[] args) { try { String newLine = System.getProperty("line.separator"); Writer output = null; File file = new File("ExcelFile.csv"); output = new BufferedWriter(new FileWriter(file)); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:schooldb"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("Select * from [Sheet1$]"); ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); while (rs.next()) { for (int i = 1; i <= numberOfColumns; i++) { if (i > 1) System.out.print(", "); String columnValue = rs.getString(i); System.out.print(columnValue); output.write(columnValue); output.write(newLine); } System.out.println(""); } st.close(); con.close(); output.close(); } catch (Exception ex) { System.err.print("Exception: "); System.err.println(ex.getMessage()); } } }
Don't just try and run this without reading the JDBC tutorial first:
http://www.javaprogrammingforums.com...jdbc-java.html