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

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

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

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

    BlogJava 聯系 聚合 管理
      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
    ="導出到EXCEL" />
            
    </br>
            
    <input type="button" onClick="return AllAreaWord();" value="導出到WORD" />
            
    <script language="javascript">
                
    function AutomateExcel(){
                    
    var elTable = document.getElementById("datatable"); //要導出的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;
                }
                
    //導出到word
                //指定頁面區域內容導入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>
    通過以上的代碼,就能實現jsp中table內容導出到word或excel
    posted on 2008-12-02 20:12 馬光軍 閱讀(2186) 評論(2)  編輯  收藏

    Feedback

    # re: jsp中table內容導出到word或excel 2010-01-25 10:22 bulesky
    點擊按鈕沒反應,為什么?  回復  更多評論
      

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


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


    網站導航:
     
    主站蜘蛛池模板: 国产成人免费高清激情视频| 99热在线免费播放| 亚洲另类激情专区小说图片| 99久久国产亚洲综合精品| 69堂人成无码免费视频果冻传媒| 亚洲经典在线中文字幕| 久久久免费精品re6| 亚洲综合一区二区精品久久| 67pao强力打造国产免费| 亚洲白色白色永久观看| 4虎永免费最新永久免费地址| 亚洲伊人久久大香线蕉结合| 成年丰满熟妇午夜免费视频| 亚洲人成人无码.www石榴| 日日操夜夜操免费视频| 免费播放国产性色生活片| 国产亚洲老熟女视频| 国产日韩AV免费无码一区二区| 亚洲午夜未满十八勿入| 国产在线观看免费观看不卡 | 亚洲综合亚洲国产尤物| 野花高清在线观看免费3中文 | 免费在线看片网站| h片在线观看免费| 亚洲va无码专区国产乱码| 亚洲精品国产免费| 国产亚洲一卡2卡3卡4卡新区 | 在线观看成人免费| 深夜特黄a级毛片免费播放| 国产成人麻豆亚洲综合无码精品| 午夜精品射精入后重之免费观看 | 一区二区视频在线免费观看| 久久夜色精品国产嚕嚕亚洲av| 国产妇乱子伦视频免费| 男女超爽视频免费播放| 亚洲成AV人片一区二区密柚| 人禽杂交18禁网站免费| 成年网站免费入口在线观看| 亚洲精品在线免费观看视频| 四虎永久在线精品免费影视| 久久综合九色综合97免费下载|