Using RS.EXE to export a report from Command Line (URGENT)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • goal2007
    New Member
    • Jul 2007
    • 25

    Using RS.EXE to export a report from Command Line (URGENT)

    ' File: Test.rss
    Dim format as string = "Excel"
    Dim fileName as String = "C:\Export2.xls "
    Dim reportPath as String = "/TimeByEmployee"

    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 = "ms-excel"
    Dim warnings() AS Warning = Nothing
    Dim reportHistoryPa rameters() As ParameterValue = Nothing
    Dim streamIDs() as string = Nothing
    rs.Credentials = System.Net.Cred entialCache.Def aultCredentials

    Dim parameters(3) As ParameterValue
    parameters(0) = New ParameterValue( )
    parameters(0).N ame = "Employee"
    parameters(0).V alue = " "
    parameters(1) = New ParameterValue( )
    parameters(1).N ame = "Department s"
    parameters(1).V alue = " "
    parameters(2) = New ParameterValue( )
    parameters(2).N ame = "Week Number"
    parameters(2).V alue = WeekNumber
    results = rs.Render(repor tPath, format, _
    Nothing, Nothing, parameters, _
    Nothing, Nothing, encoding, mimeType, _
    reportHistoryPa rameters, warnings, streamIDs)

    ' Open a file stream and write out the report
    Dim stream As FileStream = File.OpenWrite( fileName)
    stream.Write(re sults, 0, results.Length)
    stream.Close()

    End Sub

    'End of script



    here is how i run it



    rs -i RunReport.rss -s http://localhost/reportserver -v WeekNumber=90 -e mgmt2000



    this is the error i get:

    The value of parameter 'Parameters' is not valid. also how can i cgange this line to pdf

    Dim mimeType as string = "ms-excel" i tried this but it did not

    work

    Dim mimeType as string = "ms-pdf"


    Thanks
  • sfrobinson
    New Member
    • Feb 2008
    • 1

    #2
    Don't know about the Parameters error, but if the first two parameter values are defaulted within the report, you may not want to specify them in script at all.

    As far as switching from Excel to PDF, replace your corresponding statements with the following:

    Code:
    Dim format as string = "PDF"
    Dim mimeType as string = "application/pdf"
    Hope this helps.

    Comment

    Working...