国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

把本頁內容導出成word文件或excel文件(原創)

2019-11-18 16:23:37
字體:
來源:轉載
供稿:網友

  說明:文件unload.js在js目錄下,文件unload_Excel.jsp和unload_Word.jsp在unload目錄下。

1,unload.js
/**************************************************
作者:云鳳生(hainanyun@hotmail.com)
創建日期:2005-1-21
最后修改日期:2005-3-30

Function:
1,unload_word():unload local page as word file
2,unload_excel():unload local page as excel file
3,...(waiting for your additional work)

For example:
1,in the head of Html file,include this file:
<script src="js/unload.js" type="text/javascript"></script>
2,add unload button:
<input type="button" value="導出為Word文檔"  name="download" onclick="unload_word(location.href)" >
<input type="button" value="導出為Excel文檔" name="download" onclick="unload_excel(location.href)" >
**************************************************/
function unload_word()
{
        var url=location.href;
        location.href='unload/unload_word.jsp?url='+url;
}

function unload_excel()
{
        var url=location.href;
        location.href='unload/unload_excel.jsp?url='+url;
}


2,unload_excel.jsp
<%
   response.setHeader("Content-disposition","attachment; filename=%>
<%@ page contentType="
application/vnd.ms-excel; charset=gb2312"%>
<%@ page import="Java.net.URL"%>

<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<%
String url_target = new String(request.getParameter("url"));
String filename = new String();

URL url = new URL(url_target);
filename = url.getFile();
%>

<jsp:include page="<%=filename%>" />


3,unload_word.jsp
<%
   response.setHeader("Content-disposition","attachment; filename=print_tmp.doc");
%>
<%@ page contentType="application/vnd.ms-word; charset=gb2312"%>
<%@ page import="java.net.URL"%>

<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<%
String url_target = new String(request.getParameter("url"));
String filename = new String();

URL url = new URL(url_target);
filename = url.getFile();
%>

<jsp:include page="<%=filename%>" />
進入討論組討論。

(出處:http://www.survivalescaperooms.com)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 明水县| 太湖县| 柳河县| 泾川县| 青浦区| 和龙市| 呼伦贝尔市| 临沧市| 治县。| 黄骅市| 南澳县| 澄迈县| 南华县| 安图县| 改则县| 万盛区| 建平县| 虹口区| 绥江县| 会昌县| 漾濞| 西华县| 襄汾县| 遵义市| 牙克石市| 子长县| 北票市| 周口市| 宁陕县| 巴林右旗| 云梦县| 元阳县| 武城县| 宾川县| 温宿县| 海南省| 北京市| 获嘉县| 彰化市| 武穴市| 永平县|