Hi,UltraGridDocumentExporter1.Export(Me.ugvDataGrid, MyPath, DocumentExport.GridExportFileFormat.PDF) don't work when i put this line in a second thread .... why ?The thread procédure:Private Sub ThreadProcedure() Try _ugePDF.Export(_Grid, _Chemin, DocumentExport.GridExportFileFormat.PDF) Finally End Try End SubTo launch the thread: Public Sub Exporter() _ExportThread = New Thread(New ThreadStart(AddressOf ThreadProcedure)) _ExportThread.IsBackground = True _ExportThread.Start() End SubIt's working with ExcelExporter ...
Perhaps that's wrong?:
Public Sub New(ByVal uGrid As UltraGrid)
_ugePDF = New UltraGridDocumentExporter_Grid = uGrid_ugePDF.TargetPaperOrientation = Infragistics.Documents.Report.PageOrientation.Landscape_ugePDF.TargetPaperSize = Infragistics.Documents.Report.PageSizes.Letter_ugePDF.ImageCompressorType = ImageCompressorType.Flate_ugePDF.AutoSize = AutoSize.None_ugePDF.UseFileBuffer = False
End Sub
If it's working, then it's sheer luck. It's a dangerous thing to do and I would not be surprised if the application crashed because of it. It might not crash during the export, but it could happen later on. I would strongly advise against doing this and it's certainly not something that is supported.
but it's working correctly...and the export on the UI thread for more 4000 rows to pdf is very very very very too long...
Thank for your response
Hi,
It's really not a good idea to call Export on a seperate thread like this. You are essentially passing in a reference to the grid on the UI Thread into a new thread. If the new thread tries to refererence any properties or method of the grid you passed in, it could cause problems. This is not something that the exporters can support. If the Excel exporter works, then it's just pure luck that it does so, and I would not depend on it, nor assume that just because it appears to be working that it's working correctly.