BlockImportMode Enum

Wordize.Loading.BlockImportMode enum. Specifies how properties of blocklevel elements are imported from HTMLbased documents.

BlockImportMode enumeration

Specifies how properties of block-level elements are imported from HTML-based documents.

public enum BlockImportMode

Values

NameValueDescription
Merge0Properties of parent blocks are merged and stored on child elements (i.e. paragraphs or tables).
Preserve1Properties of parent blocks are imported to a special logical structure and are stored separately from document nodes.

Examples

Shows how properties of block-level elements are imported from HTML-based documents.

const string html = @"
    <html>
        <div style='border:dotted'>
            <div style='border:solid'>
                <p>paragraph 1</p>
                <p>paragraph 2</p>
            </div>
        </div>
    </html>";
MemoryStream htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html));

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
// By default, properties of parent blocks are merged and stored on child elements (i.e. paragraphs or tables).
// Change the behavior to preserve block level elements as a special logical structure in the output document.
htmlLoadOptions.BlockImportMode = BlockImportMode.Preserve;

Converter.Create()
    .From(htmlStream, htmlLoadOptions)
    .To(ArtifactsDir + "HtmlLoadOptions.BlockImportMode.docx")
    .Execute();

See Also