HtmlFormat.CreateMarkupWriter Method

Namespace
Kampute.DocToolkit.Formatters
Assembly
  • Kampute.DocToolkit.dll

Definition

Creates an instance of MarkupWriter class that wraps the specified writer for encoding content in HTML format.
public override MarkupWriter CreateMarkupWriter(TextWriter writer, bool disposeWriter = false)

Parameters

writer TextWriter
The TextWriter to write the encoded content to.
disposeWriter bool optional
true if the wrapped writer should be disposed when the returned MarkupWriter is disposed; otherwise, false. The default is false.

Returns

MarkupWriter
A new instance of a HtmlWriter object that wraps the specified writer.

Remarks

This implementation creates an HtmlWriter instance that provides HTML-specific formatting capabilities, such as proper HTML tag generation, entity encoding, and structural elements like headings, lists, and tables with appropriate HTML markup.

The writer automatically handles HTML-specific requirements:

  • Converting special characters to HTML entities (&, <, >, etc.)
  • Generating well-formed HTML tags for semantic document structures
  • Supporting HTML-specific features like CSS classes and element attributes

It is the caller's responsibility to dispose the returned MarkupWriter instance to release any resources.