SSRS 2008 Render report in Word using RS.exe
I am trying to generate a ssrs report in Word document.
The following is the script that I have written:
----ReportRender.rss
Dim format as string = "Word"
Dim fileName as String = "C:\Export2.doc"
Dim reportPath as String = "/Folder/MailLetter"
Public Sub Main()
' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string
Dim mimeType as string = "application/word"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
Dim parameters(2) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "WhereStr"
parameters(0).Value = "where pkey=2832"
parameters(1) = New ParameterValue()
parameters(1).Name = "Indicator"
parameters(1).Value = "23"
results = rs.Render(reportPath, format,Nothing, Nothing, parameters,Nothing, Nothing, mimeType,encoding, reportHistoryParameters, warnings, streamIDs)
' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()
End Sub
The command line execution code:
rs -i ReportRender.rss -s http://myserver/ReportServer -u mydomain\userid -p mypassword -e exec2005
I get the connection failure error.
Please suggest.
May 26th, 2012 2:17pm
Hello sunilkumar-BIPro,
After reviewing the code, I have some questions about the error you encountered.
I am not sure that the code is written correctly. Based on my experience, the
Render function does not contain the parameter ReportPath. Here is the usage of the function: http://msdn.microsoft.com/en-us/library/reportexecution2005.reportexecutionservice.render.
Please refer to the article to update the code you provided and share us the correct code.The issue is connection failure error. Can you provide me the detail error information, please? Therefore, we can get more information about this issue. Here is a way to collect the detail error message. Please use the following format to run the rs command.
rs -i ReportRender.rss -s http://myserver/ReportServer -u mydomain\userid -p mypassword -e exec2005 2> text.log 1>&2
Then, please copy the content in the text.log out and post it to the thread. I hope we can get more detail from the above steps and find out a solution to this problem.
Regards,
EdwardEdward Zhu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 4:42am