DocumentBuilderInsertTextInput Method
Inserts a text form field at the current position.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
Syntax
public FormField InsertTextInput(
	string name,
	TextFormFieldType type,
	string format,
	string fieldValue,
	int maxLength
)

Parameters

name
Type: SystemString
The name of the form field. Can be an empty string.
type
Type: Aspose.Words.FieldsTextFormFieldType
Specifies the type of the text form field.
format
Type: SystemString
Format string used to format the value of the form field.
fieldValue
Type: SystemString
Text that will be shown in the field.
maxLength
Type: SystemInt32
Maximum length the user can enter into the form field. Set to zero for unlimited length.

Return Value

Type: FormField
The form field node that was just inserted.
Remarks

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Examples
Shows how to insert a text input form field into a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertTextInput("TextInput", TextFormFieldType.Regular, "", "Hello", 0);
Examples
Shows how to insert form fields, set options and gather them back in for use
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a text input field. The unique name of this field is "TextInput1", the other parameters define
// what type of FormField it is, the format of the text, the field result and the maximum text length (0 = no limit)
builder.InsertTextInput("TextInput1", TextFormFieldType.Regular, "", "", 0);
Examples
Builds a sample form to fill.
DocumentBuilder builder = new DocumentBuilder();

// Insert a text form field for input a name.
builder.InsertTextInput("", TextFormFieldType.Regular, "", "Enter your name here", 30);

// Insert two blank lines.
builder.Writeln("");
builder.Writeln("");

string[] items =
{
    "-- Select your favorite footwear --", "Sneakers", "Oxfords", "Flip-flops", "Other",
    "I prefer to be barefoot"
};

// Insert a combo box to select a footwear type.
builder.InsertComboBox("", items, 0);

// Insert 2 blank lines.
builder.Writeln("");
builder.Writeln("");

builder.Document.Save(ArtifactsDir + "DocumentBuilder.CreateForm.doc");
See Also