生成SSRS并自动转换为PDF

时间:2012-01-06 14:01:10

标签: vb.net

我想自动将我的SSRS转换为pdf并存储到我硬盘上的某个位置(例如C:\ My Reports) 如何实现这一目标?

由于

1 个答案:

答案 0 :(得分:2)

使用报告服务Web服务。这样做的好帖是:http://geekswithblogs.net/bsherwin/archive/2007/04/29/112094.aspx

Dim result() As Byte
Dim report As String = "/Sample Reports/Sales Order Detail"
Dim format As String = "PDF"
Dim historyid As String = Nothing
Dim devinfo As String = ""
Dim credentials() As SQLRS.DataSourceCredentials = Nothing
Dim showhide As String = Nothing
Dim encoding As String
Dim mimetype As String
Dim warnings() As SQLRS.Warning = Nothing
Dim reporthistoryparams As SQLRS.ParameterValue() = Nothing
Dim streamid() As String = Nothing
Dim sh As New SQLRS.SessionHeader
ws.SessionHeaderValue = sh 
Next, get the result from the web service:

result = ws.Render(report, format, historyid, devinfo, parameters, _
            credentials, showhide, encoding, mimetype, reporthistoryparams, _
            warnings, streamid)

Dim stream As FileStream = File.Create("C:\My Reports\report.pdf", results.Length)
stream.Write(results, 0, results.Length)
stream.Close()