<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    馬光軍--------BLOG

    BlogJava 聯(lián)系 聚合 管理
      1 Posts :: 25 Stories :: 5 Comments :: 0 Trackbacks
    <html>
        
    <head>
        
    <title>projectGovPlace_list.jsp</title>
            
    <meta http-equiv="pragma" content="no-cache">
            
    <meta http-equiv="cache-control" content="no-cache">
            
    <meta http-equiv="expires" content="0">
            
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
            
    <meta http-equiv="description" content="This is my page">
            
    <link href="css/strongpt.css" rel="stylesheet" type="text/css">
        
    </head>
        
    <body>
            
    <table width="100%" border="0" align="center" cellPadding="0"
                cellSpacing
    ="0" id="datatable">
                
    <tr align="center">
                    
    <td width="4%" class="table_title">
                        #
                    
    </td>
                    
    <td width="14%" class="table_title">
                       項目
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_2">
                    
    <td align="center">
                        
    <input name="classId" value="8913" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>項目</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_1">
                    
    <td align="center">
                        
    <input name="classId" value="005" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>其他</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_2">
                    
    <td align="center">
                        
    <input name="classId" value="004" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>單位自籌</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_1">
                    
    <td align="center">
                        
    <input name="classId" value="003" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>銀行貸款</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_2">
                    
    <td align="center">
                        
    <input name="classId" value="002" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>開行貸款</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_1">
                    
    <td align="center">
                        
    <input name="classId" value="001" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>市本級財政</span>
                    
    </td>
                
    </tr>
            
    </table>
            
    <input type="button" onClick="return AutomateExcel();"
                value
    ="導(dǎo)出到EXCEL" />
            
    </br>
            
    <input type="button" onClick="return AllAreaWord();" value="導(dǎo)出到WORD" />
            
    <script language="javascript">
                
    function AutomateExcel(){
                    
    var elTable = document.getElementById("datatable"); //要導(dǎo)出的table id。
                    var oRangeRef = document.body.createTextRange(); 
                    oRangeRef.moveToElementText(elTable); 
                    oRangeRef.execCommand(
    "Copy");
                    
    var appExcel = new ActiveXObject("Excel.Application");
                    appExcel.Workbooks.Add().Worksheets.Item(
    1).Paste(); 
                    appExcel.Visible 
    = true
                    appExcel 
    = null;
                }
                
    //導(dǎo)出到word
                //指定頁面區(qū)域內(nèi)容導(dǎo)入Word
                function AllAreaWord(){
                    
    var oWD = new ActiveXObject("Word.Application");
                    
    var oDC = oWD.Documents.Add("",0,1);
                    
    var orange =oDC.Range(0,1);
                    
    var elTable = document.getElementById("datatable"); 
                    
    var sel = document.body.createTextRange();
                    sel.moveToElementText(elTable);
                    
    //sel.select();
                    sel.execCommand("Copy");
                    orange.Paste();
                    oWD.Application.Visible 
    = true;
                    oWD 
    = null;
                }
            
    </script>
        
    </body>
    </html>
    通過以上的代碼,就能實現(xiàn)jsp中table內(nèi)容導(dǎo)出到word或excel
    posted on 2008-12-02 20:12 馬光軍 閱讀(2190) 評論(2)  編輯  收藏

    Feedback

    # re: jsp中table內(nèi)容導(dǎo)出到word或excel 2010-01-25 10:22 bulesky
    點擊按鈕沒反應(yīng),為什么?  回復(fù)  更多評論
      

    # re: jsp中table內(nèi)容導(dǎo)出到word或excel 2013-08-21 15:03 哇哇哇
    onClick="return AutomateExcel();"
    把return和;去掉 不過 這種形式的用這種方法導(dǎo)出的很不理想的啊  回復(fù)  更多評論
      


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 久久久久亚洲?V成人无码| 国产高清免费在线| 亚洲av永久无码精品表情包| 人妻18毛片a级毛片免费看| 国产在线ts人妖免费视频| 亚洲成av人无码亚洲成av人| 热99re久久免费视精品频软件 | 亚洲精品乱码久久久久久中文字幕 | 成年轻人网站色免费看| 亚洲欧洲另类春色校园网站| 成人免费无码视频在线网站| 久久综合久久综合亚洲| 日本特黄特色免费大片| 黄色a级片免费看| 国产成人亚洲精品91专区手机| 一级毛片免费播放男男| 国产亚洲人成网站在线观看不卡| 日韩免费高清播放器| 日韩亚洲Av人人夜夜澡人人爽| 亚洲视频免费观看| 亚洲精品无码不卡在线播放| 免费a级毛片无码av| a级在线免费观看| 亚洲精品美女在线观看| 成人免费视频观看无遮挡| 无码天堂va亚洲va在线va| 亚洲无线观看国产精品| 亚欧色视频在线观看免费| 在线精品自拍亚洲第一区| 亚洲精品乱码久久久久久按摩 | 国产精品免费电影| 特色特黄a毛片高清免费观看| 亚洲国产精品一区第二页| 69式互添免费视频| 国产亚洲成在线播放va| 国产成人亚洲综合色影视| 免费看国产成年无码AV片| 一级毛片完整版免费播放一区| 亚洲视频网站在线观看| 亚洲av无码国产精品色在线看不卡| a级毛片高清免费视频|