vb.net - Obraining SSRS report in the form of pdf -
i want ssrs report in form of pdf (or other portable format) automatically. mean when user presses button, instead of viewing report in report view, should converted pdf
please give me vb.net code if possible.
any welcomed !
thanks
please try code.
private sub generatereport(paramlist hashtable) rs.credentials = system.net.credentialcache.defaultcredentials rsexec.credentials = system.net.credentialcache.defaultcredentials dim historyid string = nothing dim deviceinfo string = nothing dim format string = "pdf" dim results byte() dim encoding string = string.empty dim mimetype string = string.empty dim extension string = string.empty dim warnings reportexecution.warning() = nothing dim streamids string() = nothing dim filename string = "c:\myreport.pdf" ' change want save dim _reportname string = "/sales/myreport" ' change report dim _historyid string = nothing dim _forrendering boolean = false dim _values reportingservice.parametervalue() = nothing dim _credentials reportingservice.datasourcecredentials() = nothing dim _parameters reportingservice.reportparameter() = nothing _parameters = rs.getreportparameters(_reportname, _historyid, _forrendering, _values, _credentials) dim ei reportexecution.executioninfo = rsexec.loadreport(_reportname, historyid) dim parameters(_parameters.length - 1) reportexecution.parametervalue param integer = 0 _parameters.count - 1 parameters(param) = new reportexecution.parametervalue parameters(param).label = _parameters(param).name parameters(param).name = _parameters(param).name parameters(param).value = paramlist(param) next rsexec.setexecutionparameters(parameters, "en-us") results = rsexec.render(format, deviceinfo, extension, mimetype, encoding, warnings, streamids) dim stream new system.io.filestream(filename, io.filemode.openorcreate) stream.write(results, 0, results.length) stream.close() end sub
Comments
Post a Comment