Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear All

I have user control in which i export div to excel using javascript..

In the same i want to export div to pdf..

My vbscript is as follows


VB
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



divrpt is my div id


Please help me out for exporting to pdf..

I cant use any server side code because to make changes in each and every page will not be feasible ..for the same reason i need same in VBSCRIPT or any scripting language..
Posted
Updated 17-Jul-12 3:02am
v3

1 solution

See this link for a similar issue

aspx to pdf conversion using c#[^]

Regards
Sebastian
 
Share this answer
 

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