ComponentOne True DBGrid for WinForms
Exporting To All Available File Types
True DBGrid for WinForms Task-Based Help > Exporting Grid Data > Exporting To All Available File Types

To set the ExportTo method, add the following code to the Click event of the Export button:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1TrueDBGrid1.ExportTo()

To write code in C#

C#
Copy Code
this.c1TrueDBGrid1.ExportTo();
Note: C1TrueDBGrid's export feature uses Reports for WinForms' components internally, and you may need to reference Reports for WinForms' assemblies (C1.Win.C1Report and C1.C1Report) if you are receiving an error related to the assembly.

This topic illustrates the following:

Clicking the Export button opens the TrueDBGrid Print/Export Options dialog box.

  1. In the Action drop-down list, select the file type, including metafiles and image files.
  2. Click the ellipsis button next to the File name box to open the Export To dialog box. Browse to a location to save the file and enter the file name in the File name box. Click OK to close the Export To dialog box.
  3. Under Page Headers and Footers, add Header text and Footer text.
  4. Click OK to export the file.

    The final output will look similar to the following image: