Click here to Skip to main content
15,909,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All


I am trying to export data to excel from div in which there is drpodown control also
but all data is exporting fine except cross sign in place of dropdown


i am doing with the help of vb script like following


divrpt is div id


VB
<script language="vbscript" type="text/vbscript">	
function goExportExcel()

        ON ERROR RESUME NEXT
        if Isobject(document.getElementById("divrpt")) = false then EXIT FUNCTION

        DIM sHTML, oExcel, fso, filePath
        sHTML = document.all.item("divrpt").outerhtml
        sHTML = replaceMe(sHTML)
        alert(sHTML)
        StripHTMLwithnoclass = Replace(Replace(Replace(sHTML,"class=bordergrey","style='background-color: #CCCCCC;'"),"class=commontablebg","style='background-color:#FBF8F8;'"),"class=clsborder","style='BORDER-RIGHT: #F5F5F5 1px solid;BORDER-TOP: #F5F5F5 1px solid;BORDER-LEFT: #F5F5F5 1px solid;BORDER-BOTTOM:#F5F5F5 1px solid;'")
        SET fso = CreateObject("Scripting.FileSystemObject")
        filePath = fso.GetSpecialFolder(2) & "\tmpdata.xls"
        fso.CreateTextFile(filePath).Write(sHTML)
        err.Clear()
        SET oExcel = CreateObject("Excel.Application")
        IF err.number>0 OR oExcel =NULL THEN
            msgbox("You need to have Excel Installed and Active-X Components Enabled on your System.")
            EXIT FUNCTION
        END IF
        oExcel.Workbooks.open(filePath)
        oExcel.Workbooks(1).WorkSheets(1).Name = "D-Mat Data"
        oExcel.Visible = true
        Set fso = Nothing
End function
</script>
Posted
Updated 23-Mar-12 2:58am
v4
Comments
[no name] 23-Mar-12 8:58am    
<Pre> tag added.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900