HtmlLoadOptions.PreferredControlType

HtmlLoadOptions PreferredControlType property. Gets or sets preferred type of document nodes that will represent imported input and select elements. Default value is FormField.

HtmlLoadOptions.PreferredControlType property

Gets or sets preferred type of document nodes that will represent imported <input> and <select> elements. Default value is FormField.

public HtmlControlType PreferredControlType { get; set; }

Remarks

Please note that setting this property does not guarantee that all imported controls will be of the specified type. If an HTML control is not representable with document nodes of the preferred type, Wordize will use a compatible HtmlControlType for that control.

Examples

Shows how to set preferred type of document nodes that will represent imported input and select elements.

const string html = @"
    <html>
        <select name='ComboBox' size='1'>
            <option value='val1'>item1</option>
            <option value='val2'></option>
        </select>
    </html>";
MemoryStream htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html));

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PreferredControlType = HtmlControlType.StructuredDocumentTag;

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

See Also