| |
 |
Export Methods and Settings
The Grid Control provides a set of methods that allow you to export data in various formats. These methods export data using routines implemented in the XtraPrinting Library.
For information on exporting data to MS Excel format, see Export to XLS and XLSX Formats.

Export Methods and Settings
The following table lists available methods for exporting data.
Note
Custom painting, alpha blending and color gradient features are not supported when the grid's data is exported.
Note
In Large Data Sources: Server and Instant Feedback Modes, a print/export document is not regenerated each time it is sent to the print/export output. This means that if a print/export document has been generated and it's not empty, subsequent changes to the grid's layout (changing filter, sort and group settings, modifying cell values, etc.) are not applied when you send the grid's data to the print/export output the next time. To apply the changes made, call the BaseView.CreateDocument method before sending the grid's data to the print/export output.

Export Detail Views
A detail View can be exported as follows:

Export Settings of a Column/Field
Option |
Description |
RepositoryItem.ExportMode |
Specifies whether the editor's value or display text is exported when data is exported to XLS and CSV formats. |
OptionsColumn.Printable |
Gets or sets whether a column is included in the print/export output. |

Export Settings Specific to GridViews and Descendants
These options are available via the GridView.OptionsPrint property.

Export Settings Specific to BandedGridViews and Descendants
These options (available via the BandedGridView.OptionsPrint object) are the same as those provided by the GridView.OptionsPrint object, plus the following:

Export Settings Specific to LayoutViews
These options are available via the LayoutView.OptionsPrint object.
Option
|
Description
|
---|
LayoutViewOptionsPrint.MaxCardColumns
|
Gets or sets the maximum number of columns in the print/export output. This option is in effect when cards are arranged in multiple columns (the PrintMode property is set to MultiColumn).
The default is 0, which means that the number of columns is not limited.
|
LayoutViewOptionsPrint.MaxCardRows
|
Gets or sets the maximum number of rows in the print/export output. This option is in effect when cards are arranged in multiple rows (the PrintMode property is set to MultiRow).
The default is 0, which means that the number of rows is not limited.
|
LayoutViewOptionsPrint.PrintCardCaption
|
Gets or sets a value specifying whether card captions are displayed in the print/export output.
The default is true.
|
LayoutViewOptionsPrint.PrintFilterInfo
|
Gets or sets a value specifying whether the filter panel is displayed in the print/export output.
The default is false.
|
LayoutViewOptionsPrint.PrintMode
|
Gets or sets the card layout when the View is printed/exported.
The default is LayoutViewPrintMode.Default, which means that cards are arranged in multiple columns.
|
LayoutViewOptionsPrint.PrintSelectedCardsOnly
|
Gets or sets whether only the focused/selected cards are printed/exported.
The default is false.
|
LayoutViewOptionsPrint.UsePrintStyles
|
Gets or sets whether print styles or the View's appearance settings are used when printing/exporting the View.
The default is false.
|

Export Settings Specific to CardViews
These options are available via the CardView.OptionsPrint object.

Common Appearance Export Settings
By default, any View's appearance settings in the export output are specified by the View's Appearance property. To use different appearance settings when the View is exported, set the View's OptionsPrint.UsePrintStyles property to true. In this instance, the View will be exported using a predefined grayscale paint scheme by default. To specify different print appearance settings use the View's AppearancePrint property (GridView.AppearancePrint, BandedGridView.AppearancePrint, LayoutView.AppearancePrint and CardView.AppearancePrint).

Advanced Export Settings
Each of the ExportToHtml, ExportToMht and ExportToText methods mentioned at the top of the document provides an overload allowing you to customize advanced export options (encoding type, separators, range of pages, title, etc.). These overloads take additional parameters, represented by the HtmlExportOptions, MhtExportOptions and TextExportOptions class objects. See these links to learn more.

Exporting to Other Formats and Customizing Export Output
The Grid Control doesn't provide direct methods for exporting data in some additional formats (for instance, BMP and PNG), although the XtraPrinting Library may support them.
You can export grid data in any format that is supported by the XtraPrinting Library using the methods provided by the library. See Export a Control in Various Formats (PDF, HTML, BMP, etc.) Using the XtraPrinting Library for more details.
You may also find it useful to export grid data using the methods provided by the XtraPrinting Library if you need to customize the report (add a report header, footer, etc.). See How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control for more information.

See Also
Is this topic helpful?
Additional Feedback
Close
|