Class
WorkbookFormatProvidersManager

Manages the global registry of workbook format providers, enabling registration, discovery by extension, and import/export operations using the registered providers.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public class WorkbookFormatProvidersManager

Inheritance: objectWorkbookFormatProvidersManager

Properties

FormatProviders

Gets the collection of all format providers registered with the application-wide manager.

Declaration

cs-api-definition
public static IEnumerable<IWorkbookFormatProvider> FormatProviders { get; }

Property Value

IEnumerable<IWorkbookFormatProvider>

The format providers.

Methods

Export(Workbook, string, Stream)

Exports a workbook to a stream using the format provider registered for the specified file extension.

Declaration

cs-api-definition
[Obsolete("The method is obsolete. Please use Export(Workbook workbook, string extension, Stream output, TimeSpan? timeout) instead.")]
public static void Export(Workbook workbook, string extension, Stream output)

Parameters

workbook

Workbook

The workbook.

extension

string

The file extension.

output

Stream

The output stream.

Export(Workbook, string, Stream, IEnumerable<IWorkbookFormatProvider>)

Exports a workbook to a stream using a provider from the specified collection that supports the file extension.

Declaration

cs-api-definition
[Obsolete("The method is obsolete. Please use Export(Workbook workbook, string extension, Stream output, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout) instead.")]
public static void Export(Workbook workbook, string extension, Stream output, IEnumerable<IWorkbookFormatProvider> formatProviders)

Parameters

workbook

Workbook

The workbook.

extension

string

The file extension.

output

Stream

The output stream.

formatProviders

IEnumerable<IWorkbookFormatProvider>

The format providers to be used.

Exceptions

UnsupportedFileFormatException

Export(Workbook, string, Stream, IEnumerable<IWorkbookFormatProvider>, TimeSpan?)

Exports a workbook to a stream with an optional timeout using a provider from the specified collection that supports the file extension.

Declaration

cs-api-definition
public static void Export(Workbook workbook, string extension, Stream output, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout)

Parameters

workbook

Workbook

The workbook.

extension

string

The file extension.

output

Stream

The output stream.

formatProviders

IEnumerable<IWorkbookFormatProvider>

The format providers to be used.

timeout

TimeSpan?

The timeout after which the operation will be cancelled.

Exceptions

UnsupportedFileFormatException

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.

Export(Workbook, string, Stream, TimeSpan?)

Exports a workbook to a stream with an optional timeout using the format provider registered for the specified file extension.

Declaration

cs-api-definition
public static void Export(Workbook workbook, string extension, Stream output, TimeSpan? timeout)

Parameters

workbook

Workbook

The workbook.

extension

string

The file extension.

output

Stream

The output stream.

timeout

TimeSpan?

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.

GetProviderByExtension(string)

Retrieves the format provider that supports the specified file extension from the registered providers, or null if not found.

Declaration

cs-api-definition
public static IWorkbookFormatProvider GetProviderByExtension(string extension)

Parameters

extension

string

The extension.

Returns

IWorkbookFormatProvider

The format provider.

GetProviderByName(string)

Retrieves the format provider with the specified name from the registered providers, or null if not found.

Declaration

cs-api-definition
public static IWorkbookFormatProvider GetProviderByName(string providerName)

Parameters

providerName

string

Name of the provider.

Returns

IWorkbookFormatProvider

The format provider.

GetSupportedExtensions()

Enumerates all unique file extensions supported by registered format providers for import or export.

Declaration

cs-api-definition
public static IEnumerable<string> GetSupportedExtensions()

Returns

IEnumerable<string>

The supported file extensions.

Import(string, Stream)

Imports a workbook from a stream using the format provider registered for the specified file extension.

Declaration

cs-api-definition
[Obsolete("The method is obsolete. Please use Import(string extension, Stream input, TimeSpan? timeout) instead.")]
public static Workbook Import(string extension, Stream input)

Parameters

extension

string

The file extension.

input

Stream

The input stream.

Returns

Workbook

The workbook.

Import(string, Stream, IEnumerable<IWorkbookFormatProvider>)

Imports a workbook from a stream using a provider from the specified collection that supports the file extension.

Declaration

cs-api-definition
[Obsolete("The method is obsolete. Please use Import(string extension, Stream input, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout) instead.")]
public static Workbook Import(string extension, Stream input, IEnumerable<IWorkbookFormatProvider> formatProviders)

Parameters

extension

string

The file extension.

input

Stream

The input stream.

formatProviders

IEnumerable<IWorkbookFormatProvider>

The format providers to be used.

Returns

Workbook

The workbook.

Exceptions

UnsupportedFileFormatException

Import(string, Stream, IEnumerable<IWorkbookFormatProvider>, TimeSpan?)

Imports a workbook from a stream with an optional timeout using a provider from the specified collection that supports the file extension.

Declaration

cs-api-definition
public static Workbook Import(string extension, Stream input, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout)

Parameters

extension

string

The file extension.

input

Stream

The input stream.

formatProviders

IEnumerable<IWorkbookFormatProvider>

The format providers to be used.

timeout

TimeSpan?

The timeout after which the operation will be cancelled.

Returns

Workbook

The workbook.

Exceptions

UnsupportedFileFormatException

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.

Import(string, Stream, TimeSpan?)

Imports a workbook from a stream with an optional timeout using the format provider registered for the specified file extension.

Declaration

cs-api-definition
public static Workbook Import(string extension, Stream input, TimeSpan? timeout)

Parameters

extension

string

The file extension.

input

Stream

The input stream.

timeout

TimeSpan?

The timeout after which the operation will be cancelled.

Returns

Workbook

The 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.

RegisterFormatProvider(IWorkbookFormatProvider)

Registers a format provider with the global manager, replacing any existing provider with the same name.

Declaration

cs-api-definition
public static void RegisterFormatProvider(IWorkbookFormatProvider provider)

Parameters

provider

IWorkbookFormatProvider

The provider.

UnregisterFormatProvider(IWorkbookFormatProvider)

Removes the specified format provider from the global manager's registry.

Declaration

cs-api-definition
public static void UnregisterFormatProvider(IWorkbookFormatProvider provider)

Parameters

provider

IWorkbookFormatProvider

The provider.