2014-03-29 2 views
0

프로그래밍 방식으로 SSRS 보고서를 PDF 형식으로 렌더링하려면 다음 코드가 제안되었습니다. 시도했지만 작동하지 않습니다.코드를 수정하여 보고서를 렌더링하는 방법

어떤 것이 필요한지 제안 할 수 있습니까? 감사

Dim format As String = "PDF" 
    Dim fileName As String = "C:\Output.pdf" 
    Dim reportPath As String = "/[Report Folder]/Invoice" 

    ' Prepare Render arguments 
    Dim historyID As String = Nothing 
    Dim deviceInfo As String = Nothing 
    Dim extension As String = Nothing 
    Dim encoding As String 
    Dim mimeType As String = "application/pdf" 
    Dim warnings() As Microsoft.Reporting.WinForms.Warning = Nothing 
    Dim streamIDs() As String = Nothing 
    Dim results() As Byte 

    ReportViewer1.LocalReport.Render(format, deviceInfo, mimeType, encoding, fileName, streamIDs, warnings) 


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

당신은 직접 쓸 수 없습니다로 ** C : \의 Output.pdf ** 같아요 디렉토리를 만들고 쓰기 권한을 제공합니다. 그런 다음 ** C : \ some_writable_directory \ Output.pdf **와 같은 것을 시도하십시오. –

답변

1

FileStream을 아무것도가에 기록되지 얻을 않을 것이다, 그래서 당신이 results 변수에 아무것도 지정하지 않기 때문에 그것은 작동하지 않습니다. 당신은 resultsRender 방법의 결과를 할당해야합니다

results = ReportViewer1.LocalReport.Render(format, deviceInfo, mimeType, encoding, fileName, streamIDs, warnings) 
관련 문제