Monday, February 20, 2012

Problems using RSClientPrint

We are using VB.NET 2005 to develop a WinForms application that uses SQL Server 2005 Reporting Services to produce reports.

We want to print a large report programmatically without preview. RSClientPrint looked like a good solution but it produces an error when we try to use it.

Details...
I added Interop.RSClientPrintLib.dll Version 1.0.0.0 to my application and used the code sample I found at:
http://msdn2.microsoft.com/en-us/library/ms159195.aspx

The call to print looks like:
RSClientPrint.Print("http://ourServer/reportserver", strReportPathParameters, "Report_name")

This call generates an error message:
"An error occured during printing. (0x80004002)"

and throws an exception:
"Specified cast is not valid"

Any ideas appreciated.

I think it would help if you include in your post the line of code that sets the strReportPathParameters parameter... The entire code block would be even better.

|||

The entire block of code follows:

Dim RSClientPrint As New RSClientPrintLib.RSClientPrint

RSClientPrint.MarginLeft = 12.7
RSClientPrint.MarginTop = 12.7
RSClientPrint.MarginRight = 12.7
RSClientPrint.MarginBottom = 12.7
RSClientPrint.Culture = 1033
RSClientPrint.UICulture = 9

Dim strReportPathParameters As String = ""
Dim strTempValue As String = ""
Dim iCounter As Integer = 0
Dim myEnumerator As IEnumerator = _
m_parameterValues.GetEnumerator
Dim aParameterValue As ParameterValue
While myEnumerator.MoveNext()
aParameterValue = CType(myEnumerator.Current, ParameterValue)
strTempValue = aParameterValue.Value
strTempValue = strTempValue.Trim
strReportPathParameters += "&" + _
aParameterValue.Name + "=" + strTempValue
End While

strReportPathParameters = "%2fAppFolder%2ftax_invoice" _
+ strReportPathParameters

'Copy from the help file
'RSClientPrint.Print("http://localhost/rtm", "%2fEmployee_Sales_Summary&ReportMonth=6&ReportYear=2004&EmpID=20", "Employee_Sales_Summary")

'Our call that generates the errors
RSClientPrint.Print("http://ourserver/reportserver", strReportPathParameters, "Tax_Invoice")

|||

Hi mate,

I got exactly the same problem as you did, have you got any clue now?

Thanks.

|||Any updates on this situation?.. I'm in the exact same boat|||From everything I've been able to find, the RSClientPrint utility is an activex control that is only usable from client side code on a webpage, and it won't work in a winform. It also won't work being called from server side code. It must be called from the webpage itself (ie javascript).

No comments:

Post a Comment