Posted by: piman007 | 05-07-2007

How to output JSP page to Word or Excel?

To word

<%@page contentType="application/msword; charset=tis-620" language="java"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%@page errorPage="../error.jsp" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
</head>

<body>
Hello this is my test of export to MSWORD….. <br>
It is okey ….

</body>
</html>

 

To excel

<%@page contentType="application/vnd.ms-excel; charset=tis-620" language="java"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%@page errorPage="../error.jsp" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
</head>

<body>
Hello this is my test of export to EXCEL….. <br>
It is okey ….

<TABLE>
<TR>
<TD>A</TD>
<TD>B</TD>
<TD>C</TD>
</TR>
<TR>
<TD>D</TD>
<TD>E</TD>
<TD>F</TD>
</TR>
<TR>
<TD>G</TD>
<TD>A</TD>
<TD>B</TD>
</TR>
</TABLE></body>
</html>


ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

หมวดหมู่

%d bloggers like this: