在ASP.NET/VBSCRIPT中将div导出为pdf [英] Export div to pdf in ASP.NET/VBSCRIPT
本文介绍了在ASP.NET/VBSCRIPT中将div导出为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人
我有用户控制,其中我使用javascript将div导出到excel..
同样,我想将div导出为pdf ..
我的vbscript如下
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
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是我的div ID
请帮我导出到pdf ..
我不能使用任何服务器端代码,因为在每个页面中进行更改都是不可行的.出于相同的原因,我需要在VBSCRIPT或任何脚本语言中使用相同的代码..
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..
推荐答案
请参阅此链接以解决类似的问题
使用c#将aspx转换为pdf [
See this link for a similar issue
aspx to pdf conversion using c#[^]
Regards
Sebastian
这篇关于在ASP.NET/VBSCRIPT中将div导出为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文