<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">
                       項(xiàng)目
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_2">
                    
    <td align="center">
                        
    <input name="classId" value="8913" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>項(xiàng)目</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>開(kāi)行貸款</span>
                    
    </td>
                
    </tr>
                
    <tr align="center" class="table_1">
                    
    <td align="center">
                        
    <input name="classId" value="001" type="radio" />
                    
    </td>
                    
    <td>
                        
    &nbsp;
                        
    <span>市本級(jí)財(cái)政</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
                //指定頁(yè)面區(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>
    通過(guò)以上的代碼,就能實(shí)現(xiàn)jsp中table內(nèi)容導(dǎo)出到word或excel
    posted on 2008-12-02 20:12 馬光軍 閱讀(2186) 評(píng)論(2)  編輯  收藏

    Feedback

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

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


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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲午夜福利精品久久| 男女猛烈无遮掩视频免费软件 | 久久久久久A亚洲欧洲AV冫| 国产成人午夜精品免费视频| 九九99热免费最新版| 天天综合亚洲色在线精品| 亚洲国产情侣一区二区三区| 亚洲国产精品无码久久久不卡| 日美韩电影免费看| 无码日韩人妻av一区免费| 最近中文字幕mv免费高清视频8 | 国产精品亚洲综合一区| 日韩免费三级电影| 最新猫咪www免费人成| 国产a视频精品免费观看| 日本免费大黄在线观看| 东方aⅴ免费观看久久av| 一级毛片免费不卡| h视频免费高清在线观看| 国产亚洲精品美女久久久久 | 最近免费最新高清中文字幕韩国| 中文字幕不卡高清免费| 一级做受视频免费是看美女| 国产亚洲日韩在线a不卡| 国产亚洲人成在线播放| 亚洲AV永久无码天堂影院| ass亚洲**毛茸茸pics| 亚洲欧洲日产国码在线观看| 亚洲精品视频免费在线观看| 亚洲天堂中文字幕| 久久亚洲国产精品成人AV秋霞| 久久久久亚洲精品无码蜜桃| 久久青青草原亚洲av无码app | 日批视频网址免费观看| 99精品免费视品| 一区二区三区无码视频免费福利| 国产羞羞的视频在线观看免费| 久久国产精品免费专区| 91精品啪在线观看国产线免费| 精品无码无人网站免费视频| 国产精彩免费视频|