• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JSP to OpenOffice

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:oracle: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......
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic