Version

Export WinGrid Asynchronously

The WinGridDocumentExporter™ component enables you to asynchronously export your entire WinGrid™ directly into a PDF or XML Paper Specification (XPS) document (depending on the GridExportFileFormat enumeration used). You do this by calling the ExportAsync method of the UltraGridDocumentExporter object.

Introduction

Asynchronous exporting, as opposed to synchronous, allows users to interact with the user interface of the application while the export process is executing. You must ensure that neither the WinGrid, nor its data source is accessed by your application in any way while the asynchronous export is in progress. The IsExportAsyncInProgress property of the WinGrid can be used to determine whether or not the asynchronous export is still in progress to avoid any access conflicts.

Requirements

  • A Microsoft Visual Studio solution using .NET Framework 3.0 or higher

  • A Windows Forms Application Solution using the WinGrid and bound to data

  • A WinGridDocumentExporter control on the form

Steps

  1. Export the WinGrid Asynchronously

In C#:

this.ultraGridDocumentExporter1.ExportAsync(this.ultraGrid1,    "C:\\Reports\\WinGrid_Report.pdf", Infragistics.Win.UltraWinGrid.DocumentExport.GridExportFileFormat.PDF);

In Visual Basic:

Me.UltraGridDocumentExporter1.ExportAsync(Me.UltraGrid1, _   "C:\Reports\WinGrid_Report.pdf", Infragistics.Win.UltraWinGrid.DocumentExport.GridExportFileFormat.PDF)
  1. (Optional) Verify the resultsTo verify the result, run your application and perform the export (Figure 1).

WinGridDocumentExporter Export WinGrid Asynchronously 01.png

Figure 1: WinGrid asynchronously exporting to a PDF document