New to Telerik Document ProcessingStart a free 30-day trial

Base class for all workbook format providers, implementing common import and export logic with timeout and cancellation support.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public abstract class WorkbookFormatProviderBase : IWorkbookFormatProvider

Inheritance: objectWorkbookFormatProviderBase

Derived Classes: BinaryWorkbookFormatProviderBaseTextBasedWorkbookFormatProviderBase

Implements: IWorkbookFormatProvider

Constructors

Initializes a new instance of the WorkbookFormatProviderBase class.

C#
protected WorkbookFormatProviderBase()

Methods

Exports the specified workbook to the output stream with an optional timeout, validating export capability and workbook state.

C#
public void Export(Workbook workbook, Stream output, TimeSpan? timeout)
Parameters:workbookWorkbook

The workbook.

outputStream

The output.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Implements: IWorkbookFormatProvider.Export(Workbook, Stream, TimeSpan?)

When overridden in a derived class, performs the format-specific export logic to serialize the workbook to the output stream with cancellation support.

C#
protected virtual void ExportOverride(Workbook workbook, Stream output, CancellationToken cancellationToken)
Parameters:workbookWorkbook

The workbook.

outputStream

The output.

cancellationTokenCancellationToken

The token used to cancel the operation.

Imports a workbook from the specified stream with an optional timeout, validating import capability, and returns the deserialized workbook instance.

C#
public Workbook Import(Stream input, TimeSpan? timeout)
Parameters:inputStream

The input.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Returns:

Workbook

The imported workbook.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Implements: IWorkbookFormatProvider.Import(Stream, TimeSpan?)

When overridden in a derived class, performs the format-specific import logic to deserialize a workbook from the input stream with cancellation support.

C#
protected virtual Workbook ImportOverride(Stream input, CancellationToken cancellationToken)
Parameters:inputStream

The input.

cancellationTokenCancellationToken

The token used to cancel the operation.

Returns:

Workbook

The imported workbook.

Properties

Gets a value indicating whether this provider supports exporting workbooks to streams.

C#
public abstract bool CanExport { get; }
Property Value:

The value indicating whether can export.

Implements: IWorkbookFormatProvider.CanExport

Gets a value indicating whether this provider supports importing workbooks from streams.

C#
public abstract bool CanImport { get; }
Property Value:

The value indicating whether can import.

Implements: IWorkbookFormatProvider.CanImport

Gets the human-readable description of files supported by this provider, defaulting to the first extension in uppercase (e.g., "XLSX Files").

C#
public virtual string FilesDescription { get; }
Property Value:

The files description.

Implements: IWorkbookFormatProvider.FilesDescription

Gets the unique identifier name of this format provider.

C#
public abstract string Name { get; }
Property Value:

The name of the provider.

Implements: IWorkbookFormatProvider.Name

Gets the collection of file extensions supported by this provider, each including the leading dot.

C#
public abstract IEnumerable<string> SupportedExtensions { get; }
Property Value:

The supported extensions.

Implements: IWorkbookFormatProvider.SupportedExtensions