Interface IXlsxToHtmlConverter
- Namespace
- DocToolkit.Extensions.DependencyInjection
- Assembly
- DocToolkit.Extensions.DependencyInjection.dll
Exports one sheet of a workbook as an HTML table. Registered by AddDocToolkit(IServiceCollection, Action<DocToolkitOptions>?).
public interface IXlsxToHtmlConverter
Remarks
A fragment, not a document - a bare <table> with no <html>
wrapper, deliberately the opposite of IDocxToHtmlConverter. A sheet is a component
of a page rather than a page.
Cell text is culture-invariant, matching IXlsxToCsvConverter so the two exporters cannot disagree about what a cell says. Every cell is escaped - a workbook is untrusted input.
Methods
Convert(byte[], string)
Exports sheetName as an HTML <table> fragment.
string Convert(byte[] xlsx, string sheetName)
Parameters
Returns
Exceptions
- ArgumentNullException
xlsxis null.- ArgumentException
xlsxis empty, or the sheet name is blank.- DocumentConversionException
The workbook could not be opened, or the sheet does not exist.
ConvertAsync(Stream, string, CancellationToken)
Reads a workbook from source and exports sheetName as
an HTML <table> fragment. source is read to its end and is
not disposed, closed or sought.
Task<string> ConvertAsync(Stream source, string sheetName, CancellationToken ct = default)
Parameters
sourceStreamsheetNamestringctCancellationToken
Returns
Exceptions
- ArgumentNullException
sourceis null.- ArgumentException
sourceis not readable or held no bytes, or the sheet name is blank.- OperationCanceledException
ctwas cancelled.- DocumentConversionException
The workbook could not be opened, or the sheet does not exist.