| Author |
JSP to OpenOffice
|
Subhradip Podder
Ranch Hand
Joined: Aug 27, 2007
Posts: 36
|
|
I was develop a report section in my project where the output is converted from jsp to excel format and i was succesful to develop that. But now a days we can use OpenOffice and then i face a problem,because i'm unable to generated output from jsp to OpenOffice. In Excel my code like bellow.... <%@ page contentType="application/vnd.ms-excel" %> <%@ page language="java" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.*" %> <%@ page import="java.text.*" %> <html> <head> <title>WCT Report</title> </head> <body> <table> <tr><th colspan="4"><b>WCT Report</b></th></tr> <tr> <th>Vendor Name:</th> <th>State:</th> ............ ........... </tr> <% PreparedStatement ps=null; Connection con=null; ResultSet rs=null; int m=0; Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc racle:thin:@172.16.90.139:1531:PROD","apps","apps"); String f_date=request.getParameter("f_date"); String t_date=request.getParameter("t_date"); ps=con.prepareStatement("..............."); ps.setString(1,f_date); ............ ............ while(rs.next()) { %> <tr> <td><%= rs.getString(1) %> </td> .................. ................... </tr> <%} %> </table> </body> </html> Please help me to give your valuable suggestion......
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
First, it's important to realize that you're not converting anything to Excel format with the code you've posted. All you did was set the content type which causes the browser to open your textual output in Excel. If Open Office is installed on the user's machine and the mime types associations are set in their browser you should be able to do the same thing. Here is a list of the mime types used by Open Office. http://framework.openoffice.org/documentation/mimetypes/mimetypes.html [ March 15, 2008: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: JSP to OpenOffice
|
|
|