Interface
IWorksheetExporter

Streams rows, columns, merged ranges, and view/page settings for a single worksheet.

Definition

Namespace:Telerik.Documents.SpreadsheetStreaming

Assembly:Telerik.Documents.SpreadsheetStreaming.dll

Syntax:

cs-api-definition
public interface IWorksheetExporter : IDisposable

Inherited Members IDisposable.Dispose()

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

cs-api-definition
void BeginFiltering(SpreadAutoFilter autoFilter)

Parameters

autoFilter

SpreadAutoFilter

The auto-filter model containing range and filter column definitions.

Exceptions

InvalidOperationException

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.

ArgumentNullException

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:

Example

csharp
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

cs-api-definition
IColumnExporter CreateColumnExporter()

Returns

IColumnExporter

The column exporter.

CreatePageSetupExporter()

Create a page setup exporter to configure print layout settings for the sheet.

Declaration

cs-api-definition
IPageSetupExporter CreatePageSetupExporter()

Returns

IPageSetupExporter

The page setup exporter.

CreateRowExporter()

Create a row exporter positioned at the next row for writing cells.

Declaration

cs-api-definition
IRowExporter CreateRowExporter()

Returns

IRowExporter

The row exporter.

CreateWorksheetViewExporter()

Create a view exporter to configure viewport state (freeze panes, zoom, selection, visibility).

Declaration

cs-api-definition
IWorksheetViewExporter CreateWorksheetViewExporter()

Returns

IWorksheetViewExporter

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

cs-api-definition
void EndFiltering()

Exceptions

InvalidOperationException

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

cs-api-definition
void MergeCells(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)

Parameters

fromRowIndex

int

The start row index of the area.

fromColumnIndex

int

The start column index of the area.

toRowIndex

int

The end row index of the area.

toColumnIndex

int

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

cs-api-definition
void SetAutoFilter(SpreadAutoFilter autoFilter)

Parameters

autoFilter

SpreadAutoFilter

The auto-filter model containing range and optional filter column definitions.

Exceptions

InvalidOperationException

Thrown when an auto-filter has already been set on this worksheet or when BeginFiltering(SpreadAutoFilter) is currently active.

ArgumentNullException

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

cs-api-definition
void SetAutoFilter(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)

Parameters

fromRowIndex

int

The start row index of the auto-filter range.

fromColumnIndex

int

The start column index of the auto-filter range.

toRowIndex

int

The end row index of the auto-filter range.

toColumnIndex

int

The end column index of the auto-filter range.

Exceptions

InvalidOperationException

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

cs-api-definition
void SkipColumns(int count)

Parameters

count

int

The count of the columns to skip.

SkipRows(int)

Advance the internal row index by the specified number without emitting row elements.

Declaration

cs-api-definition
void SkipRows(int count)

Parameters

count

int

The count of the rows to skip.