ClassWorkbookFormatProvidersManager
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:
public class WorkbookFormatProvidersManager
Inheritance: objectWorkbookFormatProvidersManager
Properties
FormatProviders
Gets the collection of all format providers registered with the application-wide manager.
Declaration
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
[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
The workbook.
extension
The file extension.
output
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
[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
The workbook.
extension
The file extension.
output
The output stream.
formatProviders
IEnumerable<IWorkbookFormatProvider>
The format providers to be used.
Exceptions
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
public static void Export(Workbook workbook, string extension, Stream output, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout)
Parameters
workbook
The workbook.
extension
The file extension.
output
The output stream.
formatProviders
IEnumerable<IWorkbookFormatProvider>
The format providers to be used.
timeout
The timeout after which the operation will be cancelled.
Exceptions
UnsupportedFileFormatException
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
public static void Export(Workbook workbook, string extension, Stream output, TimeSpan? timeout)
Parameters
workbook
The workbook.
extension
The file extension.
output
The output stream.
timeout
The timeout after which the operation will be cancelled.
Exceptions
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
public static IWorkbookFormatProvider GetProviderByExtension(string extension)
Parameters
extension
The extension.
Returns
The format provider.
GetProviderByName(string)
Retrieves the format provider with the specified name from the registered providers, or null if not found.
Declaration
public static IWorkbookFormatProvider GetProviderByName(string providerName)
Parameters
providerName
Name of the provider.
Returns
The format provider.
GetSupportedExtensions()
Enumerates all unique file extensions supported by registered format providers for import or export.
Declaration
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
[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
The file extension.
input
The input stream.
Returns
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
[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
The file extension.
input
The input stream.
formatProviders
IEnumerable<IWorkbookFormatProvider>
The format providers to be used.
Returns
The workbook.
Exceptions
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
public static Workbook Import(string extension, Stream input, IEnumerable<IWorkbookFormatProvider> formatProviders, TimeSpan? timeout)
Parameters
extension
The file extension.
input
The input stream.
formatProviders
IEnumerable<IWorkbookFormatProvider>
The format providers to be used.
timeout
The timeout after which the operation will be cancelled.
Returns
The workbook.
Exceptions
UnsupportedFileFormatException
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
public static Workbook Import(string extension, Stream input, TimeSpan? timeout)
Parameters
extension
The file extension.
input
The input stream.
timeout
The timeout after which the operation will be cancelled.
Returns
The workbook.
Exceptions
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
public static void RegisterFormatProvider(IWorkbookFormatProvider provider)
Parameters
provider
The provider.
UnregisterFormatProvider(IWorkbookFormatProvider)
Removes the specified format provider from the global manager's registry.
Declaration
public static void UnregisterFormatProvider(IWorkbookFormatProvider provider)
Parameters
provider
The provider.