zoukankan      html  css  js  c++  java
  • 网页上内容导出到word里

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>网页上内容导出到word</title>
    </head>
    <body>
    <div id="Layer1" >Happy New Year ! ! !
    <input type=button name=’button_export’ title=’导出到word’  onclick=OpenWord() value=下载到word></div>
    </div>

    <p>this is a test!</p>
    <table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
    <Tr><Td>1</td><Td>2</td><Td>3</td></tr>
    <Tr><Td>4</td><Td>5</td><Td>6</td></tr>
    <Tr><Td>7</td><Td>8</td><Td>9</td></tr>
    </table>
    </body>
    </html>
    <script language="javascript">
    function OpenWord(){
    Layer1.style.border=0
    ExcelSheet = new ActiveXObject(’Word.Application’);
    ExcelSheet.Application.Visible = true;
    var mydoc=ExcelSheet.Documents.Add(’’,0,1);
    myRange =mydoc.Range(0,1)
    var sel=Layer1.document.body.createTextRange()
    sel.select()
    Layer1.document.execCommand(’Copy’)
    sel.moveEnd(’character’)
    myRange.Paste();
    location.reload()
    ExcelSheet.ActiveWindow.ActivePane.View.Type=9
    }
    </script>
  • 相关阅读:
    scrapy模拟用户登录
    我为什么选择Vim
    关于72键配列键盘的想法
    vim配图
    解决一些python的问题记录
    ros资料记录,详细阅读
    C语言的历史
    将制定目录家到系统PATH环境变量中
    让vim更加智能化
    如何自定义路径
  • 原文地址:https://www.cnblogs.com/zhuor/p/223299.html
Copyright © 2011-2022 走看看