BlockImportMode

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 stream = new MemoryStream(Encoding.UTF8.GetBytes(html));

HtmlLoadOptions loadOptions = new HtmlLoadOptions();
// Set the new mode of import HTML block-level elements.
loadOptions.BlockImportMode = blockImportMode;

Document doc = new Document(stream, loadOptions);
doc.Save(ArtifactsDir + "HtmlLoadOptions.BlockImport.docx");

See Also