ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Task-Based Help / Exporting Grid Data / Exporting To All Available File Types
In This Topic
    Exporting To All Available File Types
    In This Topic

    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: TrueDBGrid's export and printing features uses the C1.Win.Printing NuGet package, which provides three libraries: C1.PrintDocument, C1.Win.PrintPreview and C1.Win.RibbonPreview. Each library provides a set of previewing controls or components. The PrintDocument library provides the PrintDocument and MultiDocument components, the PrintPreview library provides the PreviewOutlineView, PreviewPane, PreviewTextSearchPanel, Thumbnail, PrintPreviewControl and PrintPreviewDialog components, and RibbonPreview  provides the RibbonPreview and RibbonPreviewDialog components. Since C1Report is now obsolete, make sure that the references for C1Report libraries is replaced by  individual library references in the C1.Win.Printing nuget.

    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: