Type | Description | |||
Destination as Variant |
A Variant expression that defines the destination, either as a file or format to be created, or as an object for exporting data. The Destination parameter specifies the format to be created as follows:
No error occurs, if the Export method can not create the file. | |||
Options as Variant |
A String expression that defines the options for exporting data, separated by the | character in the format "items|columns|separator|unicode", where items can be:
|
Return | Description | |||
Variant | The
result of the Export method is a:
|
For instance:
Let's say we have the following control's DATA:
The following screen shot shows the control's DATA in CSV format:
The following screen shot shows the control's DATA in HTML format:
The Options parameter consists a list of fields separated by | character, in the following order:
Syntax:
only[byindex](type1,type2,!type3,...)
Supported scopes:
- locked, includes items that are locked to the top or bottom of the control, meaning they remain fixed in place and are not scrollable
- selected, includes items that are currently selected
- visible, includes items that are included in the current filter (i.e., items that are not hidden due to filtering)
- checked, includes items that are checked. a column index can be specified using brackets, e.g., "checked[1]" exports items checked in column 1
- sortable, includes items that can be reordered (sortable items)
- selectable, includes items that can be selected
- divider, includes divider items, which are typically non-interactive items used for separation
- leaf, includes items that do not have child elements (leaf nodes in a tree structure)
- expanded, includes items that are currently expanded, showing their child elements
The "byindex" flag can be specified inside square brackets ([]) to indicate that the items should be listed by their original index order rather than their current display order.
Negating a scope (!scope)
Prefixing a scope with ! excludes items of that type.
Examples:
"only(selected)", exports only selected items
"only(!leaf,selected)", exports only selected parent items (excluding leaf items)
"only(sortable,selectable,!divider)", exports sortable and selectable items, but not dividers
"only(checked[1])", exports only items that are checked in column index 1
"only(locked)", exports only items that are locked to the top or bottom (not scrollable)
"only(visible)", exports only items that match the current filter criteria
"only[byindex](selected)", exports selected items in their original dataset order rather than their current display order
The Destination parameter indicates the file to be created where exported date should be saved. For instance, Export( "c:\temp\export.html") exports the control's DATA to export.html file in HTML format, or Export( "","sel|0,1|;") returns the cells from columns 0, 1 from the selected items, to a CSV format using the ; character as a field separator.
The "CSV" refers to any file that:
The "HTML" refers to any file that:
You can use the Copy/CopyTo to export the control's view to clipboard/EMF/BMP/JPG/PNG/GIF or PDF format.