New to Telerik UI for WinForms? Start a free 30-day trial

ListViewSpreadExport is a powerful exporting API, allowing to export RadListView to XLSX, PDF, CSV, and TXT format, utilizing the Document Processing Libraries.

Definition

Namespace:Telerik.WinControls.Export

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class ListViewSpreadExport

Inheritance: objectListViewSpreadExport

Constructors

Initializes a new instance of the ListViewSpreadExport class.

C#
public ListViewSpreadExport(RadListView radListView, SpreadExportFormat exportFormat)
Parameters:radListViewRadListView

The ListView to export.

exportFormatSpreadExportFormat

The export format.

Initializes a new instance of the ListViewSpreadExport class.

C#
public ListViewSpreadExport(RadListView radListView)
Parameters:radListViewRadListView

The ListView to export.

Properties

Gets or sets a value indicating how children of collapsed items are exported.

C#
public HiddenOption CollapsedItemOption { get; set; }

Gets or sets a value indicating whether to export hierarchy and group child rows grouped.

C#
public bool ExportChildItemsGrouped { get; set; }

Gets or sets the format of the exported file - XLSX, PDF, CSV, TXT or XLS.

C#
public SpreadExportFormat ExportFormat { get; set; }
Property Value:

The file extension.

Gets or sets a value indicating whether to export images.

C#
public bool ExportImages { get; set; }

Gets or sets a value indicating whether the visual settings should be exported.

C#
public bool ExportVisualSettings { get; set; }
Property Value:

true if visual settings are exported; otherwise, false.

Specifies how the file will be exported: as a new file, a new sheet in existing file or will override a sheet with given name.

C#
public FileExportMode FileExportMode { get; set; }
Property Value:

NewSheetInExistingFile - will add a new sheet to the specified file, if it exists CreateOrOverrideFile - will create/override the specified file CreateOrOverrideSheet - will create/override the specified sheet

Gets or sets the maximum number of rows per sheet.

C#
[CLSCompliant(false)]
public ExcelMaxRows SheetMaxRows { get; set; }
Property Value:

The sheet max rows.

Gets or sets the name of the sheet.

C#
public string SheetName { get; set; }
Property Value:

The name of the sheet.

Methods

Cancels an asynchronous export operation.

C#
public void CancelExportAsync()

Writes the cell image and its style information to the current worksheet position.

C#
protected virtual void CreateImageOverCell(ListViewSpreadExportCell cell, int currentRowIndex, int currentColumnIndex)
Parameters:cellListViewSpreadExportCell

The export cell containing image and formatting data.

currentRowIndexint

The zero-based worksheet row index.

currentColumnIndexint

The zero-based worksheet column index.

Creates an export cell from an item's text, size, alignment, and optionally its image.

C#
protected virtual ListViewSpreadExportCell CreateSpreadExportCell(ListViewDataItem listViewDataItem, bool exportAsHidden)
Parameters:listViewDataItemListViewDataItem

The item whose content is exported.

exportAsHiddenbool

Whether the cell should have zero height because its item is hidden.

Returns:

ListViewSpreadExportCell

The export-cell representation of the item.

Writes the cell's typed value or text, format, and style information to the current worksheet position.

C#
protected virtual void CreateTextCell(ListViewSpreadExportCell cell, int currentRowIndex, int currentColumnIndex)
Parameters:cellListViewSpreadExportCell

The export cell containing value and formatting data.

currentRowIndexint

The zero-based worksheet row index.

currentColumnIndexint

The zero-based worksheet column index.

Creates and attaches a temporary visual item when visual settings are included in the export.

C#
protected virtual BaseListViewVisualItem CreateVisualItem(ListViewDataItem listViewDataItem)
Parameters:listViewDataItemListViewDataItem

The data item represented by the visual item.

Returns:

BaseListViewVisualItem

The attached visual item, or null when visual settings are not exported.

Copies typography, alignment, fill, and border settings from a visual cell into an export cell.

C#
protected virtual void GetStylesFromVisualCell(ListViewSpreadExportCell cell, LightVisualElement visualCell)
Parameters:cellListViewSpreadExportCell

The export cell that receives the styles.

visualCellLightVisualElement

The visual cell whose styles are copied.

Raises the event.

C#
protected virtual void OnAsyncExportCompleted(AsyncCompletedEventArgs e)
Parameters:eAsyncCompletedEventArgs

The AsyncCompletedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnAsyncExportProgressChanged(ProgressChangedEventArgs e)
Parameters:eProgressChangedEventArgs

The ProgressChangedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnCellFormatting(ListViewSpreadExportCellFormattingEventArgs e)
Parameters:eListViewSpreadExportCellFormattingEventArgs

The ListViewSpreadExportCellFormattingEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnExportCompleted(EventArgs e)
Parameters:eEventArgs

The EventArgs instance containing the event data.

Detaches the temporary visual item, returns it to the element provider cache, and removes it from the view tree.

C#
protected virtual void ReleaseVisualItem(BaseListViewVisualItem visualItem)
Parameters:visualItemBaseListViewVisualItem

The temporary visual item to release.

Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation.

C#
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation.

C#
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created. Note that if ExportVisualSettings is true, collecting the visual styles from the RadListView will still execute on the UI thread.

C#
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation that runs in a background thread. Note that if ExportVisualSettings is true, collecting the visual styles from the RadListView will still execute on the UI thread.

C#
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created. Note that if ExportVisualSettings is true, collecting the visual styles from the RadListView will still execute on the UI thread.

C#
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation that runs in a background thread. Note that if ExportVisualSettings is true, collecting the visual styles from the RadListView will still execute on the UI thread.

C#
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Events

Occurs when an async export operation is completed.

C#
public event AsyncCompletedEventHandler AsyncExportCompleted

Occurs when the progress of an async export operation changes.

C#
public event ProgressChangedEventHandler AsyncExportProgressChanged

Occurs for every cell that is being exported.

C#
public event ListViewSpreadExportCellFormattingEventHandler CellFormatting

Occurs when the export process completes.

C#
public event EventHandler ExportCompleted