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
docxbyte[]
Returns
Exceptions
- ArgumentNullException
docxis null.- ArgumentException
docxis 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
sourceStreamctCancellationToken
Returns
Exceptions
- ArgumentNullException
sourceis null.- ArgumentException
sourceis not readable or held no bytes.- OperationCanceledException
ctwas cancelled.- DocumentConversionException
It could not be converted.