12행 코드 excel 내보내기

1793 단어 ExcelMicrosoft
<html>
<head>
<script language=javascript>
function preview() { 
        window.clipboardData.setData("Text",document.all('table1').outerHTML);
        try{
        var ExApp = new ActiveXObject("Excel.Application")
        var ExWBk = ExApp.workbooks.add()
        var ExWSh = ExWBk.worksheets(1)
        ExApp.DisplayAlerts = false
        ExApp.visible = true
        }catch(e){
            alert(" Microsoft Excel !")
            return false
        } 
        ExWBk.worksheets(1).Paste;    
}
</script>
</head>
<body>
<table id="table1" border="1" width="200px">
<tr  align="center"><th> </th><th> </th></tr>
<tr align="center"><td> 1</td><td> 1</td></tr>
<tr align="center"><td> 2</td><td> 2</td></tr>
<tr align="center"><td> 3</td><td> 3</td></tr>
<tr align="center"><td> 4</td><td> 4</td></tr>
<tr align="center"><td> 5</td><td> 5</td></tr>
<tr align="center"><td> 6</td><td> 6</td></tr>
<tr align="center"><td> 7</td><td> 7</td></tr>
<tr align="center"><td> 8</td><td> 8</td></tr>
</table>
<button onclick="preview()">preview</button>
</body>
</html>

좋은 웹페이지 즐겨찾기