InterfaceIWorksheetExporter
Streams rows, columns, merged ranges, and view/page settings for a single worksheet.
Definition
Namespace:Telerik.Documents.SpreadsheetStreaming
Assembly:Telerik.Documents.SpreadsheetStreaming.dll
Syntax:
public interface IWorksheetExporter : IDisposable
Inherited Members
Methods
BeginFiltering(SpreadAutoFilter)
Begin auto-filtering data rows. Rows written between this call and EndFiltering() are evaluated against the filter criteria and automatically hidden when they do not match.
Declaration
void BeginFiltering(SpreadAutoFilter autoFilter)
Parameters
autoFilter
The auto-filter model containing range and filter column definitions.
Exceptions
Thrown when an auto-filter has already been set, when BeginFiltering(SpreadAutoFilter) has already been called without a matching EndFiltering(), when the header row has not been written yet, or when data rows beyond the header have already been written.
Thrown when autoFilter is null.
Remarks
Call this method immediately after writing the header row. The header row itself is not
filtered. Mutually exclusive with SetAutoFilter(SpreadAutoFilter).
Rows already written before this call cannot be filtered; the internal row index must
equal autoFilter.FromRowIndex + 1 at call time.
The "today" date used for dynamic date filters is captured once via Today at the time this method is called. No timezone conversion is performed. The captured date is held constant for the entire filtering block to ensure consistency even if the block spans midnight.
Streaming-mode limitations:
- SpreadTop10Filter and SpreadDynamicFilter with AboveAverage or BelowAverage emit rules but do not hide rows (all rows remain visible).
- Formula cells without a cached value (single-arg SetFormula(string)) are always visible.
- String-typed cells containing date-formatted text are NOT auto-parsed as dates. Pass DateTime via SetValue(DateTime) for date filters.
Example
using (var row = ws.CreateRowExporter()) { /* write header */ }
ws.BeginFiltering(filter);
for (int i = 0; i < dataCount; i++)
{
using (var row = ws.CreateRowExporter()) { /* write data */ }
}
ws.EndFiltering();
CreateColumnExporter()
Create a column exporter for defining column widths and grouping before writing rows.
Declaration
IColumnExporter CreateColumnExporter()
Returns
The column exporter.
CreatePageSetupExporter()
Create a page setup exporter to configure print layout settings for the sheet.
Declaration
IPageSetupExporter CreatePageSetupExporter()
Returns
The page setup exporter.
CreateRowExporter()
Create a row exporter positioned at the next row for writing cells.
Declaration
IRowExporter CreateRowExporter()
Returns
The row exporter.
CreateWorksheetViewExporter()
Create a view exporter to configure viewport state (freeze panes, zoom, selection, visibility).
Declaration
IWorksheetViewExporter CreateWorksheetViewExporter()
Returns
The worksheet view exporter.
EndFiltering()
End the active filtering block started by BeginFiltering(SpreadAutoFilter). The auto-filter range is finalized and the filter rules are emitted to the output.
Declaration
void EndFiltering()
Exceptions
Thrown when BeginFiltering(SpreadAutoFilter) was not called before this method, or when EndFiltering() has already been called.
Remarks
Must be called after BeginFiltering(SpreadAutoFilter). Rows written after this call bypass filtering and are never hidden. Explicit EndFiltering() is required for deterministic output, but disposal of the worksheet exporter will auto-complete as a safety net.
MergeCells(int, int, int, int)
Merge a rectangular region of cells defined by its start and end row/column indices.
Declaration
void MergeCells(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)
Parameters
fromRowIndex
The start row index of the area.
fromColumnIndex
The start column index of the area.
toRowIndex
The end row index of the area.
toColumnIndex
The end column index of the area.
SetAutoFilter(SpreadAutoFilter)
Set an auto-filter on the worksheet with a fully configured filter model including filter column definitions. Can only be called once per worksheet and must be called after all rows have been exported.
Declaration
void SetAutoFilter(SpreadAutoFilter autoFilter)
Parameters
autoFilter
The auto-filter model containing range and optional filter column definitions.
Exceptions
Thrown when an auto-filter has already been set on this worksheet or when BeginFiltering(SpreadAutoFilter) is currently active.
Thrown when autoFilter is null.
SetAutoFilter(int, int, int, int)
Set an auto-filter on the worksheet for the specified cell range. The filter dropdown buttons will appear on the header row columns of the range. Can only be called once per worksheet and must be called after all rows have been exported.
Declaration
void SetAutoFilter(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)
Parameters
fromRowIndex
The start row index of the auto-filter range.
fromColumnIndex
The start column index of the auto-filter range.
toRowIndex
The end row index of the auto-filter range.
toColumnIndex
The end column index of the auto-filter range.
Exceptions
Thrown when an auto-filter has already been set on this worksheet or when BeginFiltering(SpreadAutoFilter) is currently active.
SkipColumns(int)
Advance the internal column position by a given number without writing cells.
Declaration
void SkipColumns(int count)
Parameters
count
The count of the columns to skip.
SkipRows(int)
Advance the internal row index by the specified number without emitting row elements.
Declaration
void SkipRows(int count)
Parameters
count
The count of the rows to skip.