Search Results for

    Show / Hide Table of Contents

    Class Form

    Represents a form element within a document section, allowing users to interact with the document.

    Inheritance
    System.Object
    Form
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public class Form : Object

    Grouping the interactive controls of a Word document runs through Form, the container that holds a document's form fields together. Its one property, Elements, is a List<FormElement>, so the form is the collection point you read or build when a document carries inputs the reader is expected to fill in.

    Each entry in Elements is a concrete FormElement, such as a TextInput for a typed value or a RadioButton for a chosen option. Because Elements is a standard list, you add controls to it, iterate over the existing ones, or clear it, the same way you would any List<T>. Construct a Form, populate Elements with the field objects the document needs, and place that form on the document so the controls render in order. When you read an existing document, walk Elements to discover which inputs it contains and inspect each one by its concrete type.

    Form form = new Form();
    form.Elements.Add(new TextInput());

    The document element tutorial explains how elements compose a document, and the object tree example prints the structure a form sits within.

    Constructors

    Form()

    Initializes a new instance of the Form class.

    Declaration
    public Form()

    Properties

    Elements

    Gets or sets the list of Form elements contained within this form.

    Declaration
    public List<FormElement> Elements { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<FormElement>
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet