Table of Contents

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

xlsx byte[]
sheetName string

Returns

string

Exceptions

ArgumentNullException

xlsx is null.

ArgumentException

xlsx is 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

source Stream
sheetName string
ct CancellationToken

Returns

Task<string>

Exceptions

ArgumentNullException

source is null.

ArgumentException

source is not readable or held no bytes, or the sheet name is blank.

OperationCanceledException

ct was cancelled.

DocumentConversionException

The workbook could not be opened, or the sheet does not exist.