Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

HtmlWordExportOptions

OfficeIMO.Word.Html

Namespace
OfficeIMO.Word.Html
Assembly
OfficeIMO.Word.Html
Source revision
e163ccb36643 with working tree changes

Options controlling HTML to Word conversion.

Inheritance

  • object
  • HtmlWordExportOptions

Usage

Explore 10 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 6

Constructors

public HtmlWordExportOptions() #

Methods

public HtmlWordExportOptions Clone() #

Creates a copy of the current options instance so callers can reuse option templates safely.

Returns

HtmlWordExportOptions A new HtmlWordExportOptions with the same configuration values.
public static HtmlWordExportOptions CreateOfficeIMOProfile() #

Creates the default OfficeIMO HTML import profile.

Returns

HtmlWordExportOptions A new HtmlWordExportOptions instance with the default compatibility-oriented settings.
public static HtmlWordExportOptions CreateTrustedDocumentProfile() #

Creates a profile for trusted HTML documents whose own linked stylesheets may be loaded.

Returns

HtmlWordExportOptions A new HtmlWordExportOptions instance configured for trusted document links.

Properties

public bool FailOnLoss { get; set; } #

Rejects a converted target when completed stages report fidelity loss.

public static HtmlWordExportOptions UntrustedDefaults { get; } #

Creates a bounded offline profile for untrusted HTML ingestion.

Value

A new HtmlWordExportOptions instance configured for untrusted HTML.

public string? FontFamily { get; set; } #

Optional font family applied to created runs during conversion.

public string QuotePrefix { get; set; } #

Character inserted before inline quoted text. Defaults to left double quotation mark.

public string QuoteSuffix { get; set; } #

Character inserted after inline quoted text. Defaults to right double quotation mark.

public WordPageSize? DefaultPageSize { get; set; } #

Optional default page size applied when creating new documents.

public OfficePageOrientation? DefaultOrientation { get; set; } #

Optional default page orientation applied when creating new documents.

public Dictionary<string, WordParagraphStyles> ClassStyles { get; } #

Maps HTML class names to paragraph styles. Example: ClassStyles["title"] = WordParagraphStyles.Heading1;

public bool IncludeListStyles { get; set; } #

When true, attempts to include list styling information during conversion.

public bool ContinueNumbering { get; set; } #

When true, numbered lists will continue numbering across separate lists.

public bool SupportsHeadingNumbering { get; set; } #

When true, heading elements are converted into a numbered list using WordListStyle.Headings111 so headings receive automatic numbering.

public string? BasePath { get; set; } #

Base directory used to resolve relative resource paths like images.

public WordHtmlNoteReferenceType NoteReferenceType { get; set; } #

Controls whether HTML-generated notes are inserted as footnotes or endnotes.

public bool LinkNoteUrls { get; set; } #

When true, URLs used as note text are emitted as hyperlinks inside the note.

public HtmlUrlPolicy HyperlinkUrlPolicy { get; set; } #

Shared URL policy applied before imported HTML anchors are materialized as Word hyperlinks.

public HtmlUrlPolicy ResourceUrlPolicy { get; set; } #

Shared URL policy applied before imported image resources are resolved or materialized.

public WordHtmlImageProcessingMode ImageProcessing { get; set; } #

Controls how images are processed during conversion.

public HttpClient? HttpClient { get; set; } #

Optional HtmlWordExportOptions.HttpClient used to download remote resources (images, SVG). If not provided, a shared client instance is used.

public TimeSpan? ResourceTimeout { get; set; } #

Optional timeout applied when downloading remote resources.

public int MaxConcurrentResourceLoads { get; set; } #

Maximum number of remote image requests that may be in flight during asynchronous import. Defaults to 8. Imports with a total image byte budget remain sequential so the converter can reject a response before reading its body when the remaining budget is too small.

public WordHtmlTextBackgroundMode TextBackgroundMode { get; set; } #

Controls how CSS text background colors are represented in Word. Exact run shading is used by default so arbitrary CSS colors round-trip without palette loss.

public long? MaxImageBytes { get; set; } #

Optional maximum number of bytes allowed for a single image resource, including SVG images. When exceeded, the image is skipped, alt text is inserted when available, and a diagnostic is emitted.

public long? MaxDecodedImagePixels { get; set; } #

Maximum pixels in raster images normalized during import, including WebP. Images embedded without pixel decoding retain their existing byte limits. Null uses the shared decoder limit; the untrusted profile uses four million pixels.

public long? MaxTotalImageBytes { get; set; } #

Optional maximum number of image bytes allowed across a single HTML import operation, including SVG images. When exceeded, the image that crosses the budget is skipped, alt text is inserted when available, and a diagnostic is emitted.

public int? MaxRemoteImageCandidateProbes { get; set; } #

Optional maximum number of remote image candidates probed while selecting a source for one HTML image element. Defaults to one probe to avoid request fan-out from large srcset or picture candidate lists. Set to null to restore unbounded probing for trusted HTML.

public int? MaxImageSourceCandidates { get; set; } #

Optional maximum number of responsive image candidates considered from picture and srcset inputs per image element. The direct img src fallback is still considered after this limit. Defaults to 32 candidates. Set to null to restore unbounded candidate expansion for trusted HTML.

public bool ValidateImageContentTypes { get; set; } #

When true, validates declared image content types for remote image resources and data URI images. Images with rejected content types are skipped, alt text is inserted when available, and a diagnostic is emitted.

public HashSet<string> AllowedImageContentTypes { get; } #

Declared image media types allowed when HtmlWordExportOptions.ValidateImageContentTypes is enabled. Add image/* to allow any declared image media type.

public HashSet<string> AllowedImageUriSchemes { get; } #

Image URI schemes allowed during import. Defaults allow HTTP, HTTPS, and data URI images. Remote image embedding still requires WordHtmlImageProcessingMode.Embed through an explicit option or compatibility profile. Add Uri.UriSchemeFile or use HtmlWordExportOptions.CreateTrustedDocumentProfile for trusted local-file images. Remove entries to reject matching image sources before they are loaded or linked.

public HashSet<string> AllowedImageHosts { get; } #

Optional host allow-list for absolute non-file image URIs. When empty, all hosts are allowed.

public HashSet<string> AllowedStylesheetUriSchemes { get; } #

Stylesheet URI schemes allowed during import. Defaults allow HTTP, HTTPS, and file-based stylesheets. Remove entries to reject matching stylesheet sources before they are loaded.

public HashSet<string> AllowedStylesheetHosts { get; } #

Optional host allow-list for absolute non-file stylesheet URIs. When empty, all hosts are allowed.

public bool ValidateStylesheetContentTypes { get; set; } #

When true, validates declared content types for remote stylesheet resources. Stylesheets with rejected content types are skipped and a diagnostic is emitted.

public HashSet<string> AllowedStylesheetContentTypes { get; } #

Declared stylesheet media types allowed when HtmlWordExportOptions.ValidateStylesheetContentTypes is enabled.

public int? MaxHtmlNodes { get; set; } #

Optional maximum number of parsed HTML nodes allowed for a conversion operation. When exceeded, conversion stops with HtmlConversionLimitException and an error diagnostic.

public int? MaxHtmlDepth { get; set; } #

Optional maximum parsed HTML tree depth allowed for a conversion operation. When exceeded, conversion stops with HtmlConversionLimitException and an error diagnostic.

public long? MaxCssBytes { get; set; } #

Optional maximum UTF-8 byte count allowed for each stylesheet before parsing. When exceeded, conversion stops with HtmlConversionLimitException and an error diagnostic.

public long? MaxTotalCssBytes { get; set; } #

Optional maximum UTF-8 byte count allowed across all stylesheets in a single import operation. When exceeded, conversion stops with HtmlConversionLimitException and an error diagnostic.

public HtmlConversionLimits Limits { get; set; } #

Shared HTML parsing and CSS limits used by the core engine and Word adapter.

public long? MaxTableCells { get; set; } #

Optional maximum number of Word table cells allowed for a single imported HTML table. Defaults to 50,000 cells. Spans are resolved before the limit is checked. When exceeded, conversion stops with HtmlConversionLimitException and an error diagnostic.

public Action<WordHtmlStyleMissingEventArgs>? StyleMissingHandler { get; set; } #

Optional conversion-scoped resolver for CSS classes without a built-in Word style mapping. This avoids global event state when conversions run concurrently.

public bool EnableAccessibilityDiagnostics { get; set; } #

When true, emits advisory accessibility diagnostics for imported HTML patterns that can reduce document usability, such as missing image alternate text, weak link text, skipped heading levels, and data tables without header cells.

public bool ImportHtmlComments { get; set; } #

When true, raw HTML comment nodes are imported as native Word comments anchored at their DOM position. Empty comments are skipped. Existing exported OfficeIMO comment sections are always imported through their linked comment references.

public bool ImportEditableLayoutRegions { get; set; } #

When true, bounded positioned and floating HTML regions are retained as editable page-anchored text boxes. Browser-only layouts that do not have one stable native box remain in semantic flow with diagnostics.

public string HtmlCommentAuthor { get; set; } #

Author name used for native Word comments created from raw HTML comment nodes.

public string HtmlCommentInitials { get; set; } #

Author initials used for native Word comments created from raw HTML comment nodes.

public WordHtmlUnsupportedCssHandling UnsupportedCssHandling { get; set; } #

Controls how unsupported CSS properties and values are handled during import. Defaults to warning diagnostics while preserving best-effort conversion.

public List<string> StylesheetPaths { get; } #

File paths pointing to external stylesheets that should be applied during conversion.

public List<string> StylesheetContents { get; } #

Raw CSS stylesheet contents that should be applied during conversion.

public bool RenderPreAsTable { get; set; } #

When true, <pre> elements are rendered inside a single-cell table.

public WordHtmlTableCaptionPosition TableCaptionPosition { get; set; } #

Specifies where table captions should be inserted relative to the table.

public WordHtmlSectionTagHandling SectionTagHandling { get; set; } #

Controls how the <section> tag is mapped into Word.