Table of Contents

Interface IDocxToHtmlConverter

Namespace
DocToolkit.Extensions.DependencyInjection
Assembly
DocToolkit.Extensions.DependencyInjection.dll

Converts a Word (.docx) package to a complete HTML document, keeping the structure ExtractText(byte[]) throws away. Registered by AddDocToolkit(IServiceCollection, Action<DocToolkitOptions>?).

The result is a complete HTML document, not a fragment, and is self-contained - images come back as data: URIs.

public interface IDocxToHtmlConverter

Methods

Convert(byte[])

Converts the .docx in docx.

string Convert(byte[] docx)

Parameters

docx byte[]

Returns

string

Exceptions

ArgumentNullException

docx is null.

ArgumentException

docx is empty.

DocumentConversionException

It could not be converted.

ConvertAsync(Stream, CancellationToken)

Reads a .docx from source and returns the converted text. source is read to its end and is not disposed, closed or sought, so it may be forward-only.

Task<string> ConvertAsync(Stream source, CancellationToken ct = default)

Parameters

source Stream
ct CancellationToken

Returns

Task<string>

Exceptions

ArgumentNullException

source is null.

ArgumentException

source is not readable or held no bytes.

OperationCanceledException

ct was cancelled.

DocumentConversionException

It could not be converted.