在jsp中如何读取word文档?在线等待,急(不好意思,没有分了)
在jsp中如何读取word文档?
我从网上找了一个,但不支持汉字,请大家帮忙啊!
<%
String dir="temp";
String dir1=new String(dir.getBytes("8859_1"),"gb2312");
String file="test.doc";
String file1=new String(file.getBytes("8859_1"),"gb2312");
try
{
File f=new File("d:\\"+dir1+"\\"+file1);
RandomAccessFile flow=new RandomAccessFile(f,"rw");
String temp=null;
if(flow.length()!=0)
{
out.println("<table align=\"center\"><tr><td width=\"90%\">");
while((temp=flow.readLine())!=null)
{
String //temp1=new String(temp.getBytes("8859_1"),"gb2312");
temp1=new String(temp.getBytes("ISO-8859-1"),"GBK");
out.println("<pre>"+temp1+"</pre>");
}
out.println("</td></tr></table>");
flow.close();
}
else out.println("此新闻长度为零!");
}
catch(Exception e)
{}
%>