2014-02-12 24 views
0

我在此處有此代碼可將創建的XtraReport導出爲PDF文件。但是我收到一條錯誤消息,指出「它正在被另一個進程使用」。導出爲PDF(XTRAReport DevExpress)錯誤:正在被另一個進程使用

有沒有辦法讓我避免這個錯誤?我試圖通過使用System.IO.File.Delete刪除文件,但它不斷收到錯誤消息。另外,考慮到我真的需要使用相同的文件名。

下面的代碼:

Dim ReturnText As String = "" 

    Dim dtReport As DataTable = Nothing 

    Dim dtRows() As DataRow = Nothing 

    Dim XRPath As String = "reports/travel.repx" 

    Dim XRSubPath As String = "reports/travel_costallocation.repx" 

    Dim SQL As String = String.Empty 

    Dim xrBandTag As String = String.Empty 

    Dim xrGroupField As GroupField = Nothing 

    Dim xrProtectBands As String = "[BottomMargin][PageFooter][PageHeader][ReportHeader]" 

    Dim xrFilename As String = String.Empty 

    Dim xParams As Integer = 0 

    Dim dAccessTo As DataTable = Nothing 

    Dim bUpdate As Boolean = False 

    Dim ReportID As Integer = 0 

    Dim ReportData() As Object = Nothing 

    Dim Value() As String = Nothing 

    Dim xrReport As XtraReport = Nothing 

    'manipulate report here 

xrReport.ExportToPdf(ServerPath & "\documents\travelpdf\eTravelNo_" & PathID & ".pdf") 

謝謝你的幫助提前。

回答

相關問題