Represents a single form field.
Microsoft Word provides the following form fields: checkbox, text input and dropdown (combobox).
FormField is an inline-node and can only be a child of Paragraph.
FormField is represented in a document by a special character and positioned as a character within a line of text.
A complete form field in a Word document is a complex structure represented by several nodes: field start, field code such as FORMTEXT, form field data, field separator, field result, field end and a bookmark. To programmatically create form fields in a Word document use DocumentBuilder.InsertCheckBox, DocumentBuilder.InsertTextInput and DocumentBuilder.InsertComboBox which make sure all of the form field nodes are created in a correct order and in a suitable state.
Shows how to insert a combo box.
Shows how to formatting the entire FormField, including the field value.
#include <Aspose.Words.Cpp/Fields/FormField.h>
Public Member Functions | |
bool | Accept (SharedPtr< DocumentVisitor > visitor) override |
Accepts a visitor. More... | |
bool | get_CalculateOnExit () |
True if references to the specified form field are automatically updated whenever the field is exited. More... | |
double | get_CheckBoxSize () |
Gets or sets the size of the checkbox in points. Has effect only when IsCheckBoxExactSize is true. More... | |
bool | get_Checked () |
Gets or sets the checked status of the check box form field. Default value for this property is false. More... | |
bool | get_Default () |
Gets or sets the default value of the check box form field. Default value for this property is false. More... | |
SharedPtr< DropDownItemCollection > | get_DropDownItems () |
Provides access to the items of a dropdown form field. More... | |
int32_t | get_DropDownSelectedIndex () |
Gets or sets the index specifying the currently selected item in a dropdown form field. More... | |
bool | get_Enabled () |
True if a form field is enabled. More... | |
String | get_EntryMacro () |
Returns or sets an entry macro name for the form field. More... | |
String | get_ExitMacro () |
Returns or sets an exit macro name for the form field. More... | |
String | get_HelpText () |
Returns or sets the text that's displayed in a message box when the form field has the focus and the user presses F1. More... | |
bool | get_IsCheckBoxExactSize () |
Gets or sets the boolean value that indicates whether the size of the textbox is automatic or specified explicitly. More... | |
int32_t | get_MaxLength () |
Maximum length for the text field. Zero when the length is not limited. More... | |
String | get_Name () |
Gets or sets the form field name. More... | |
NodeType | get_NodeType () const override |
Returns NodeType.FormField. More... | |
bool | get_OwnHelp () |
Specifies the source of the text that's displayed in a message box when a form field has the focus and the user presses F1. More... | |
bool | get_OwnStatus () |
Specifies the source of the text that's displayed in the status bar when a form field has the focus. More... | |
String | get_Result () |
Gets or sets a string that represents the result of this form field. More... | |
String | get_StatusText () |
Returns or sets the text that's displayed in the status bar when a form field has the focus. More... | |
String | get_TextInputDefault () |
Gets or sets the default string or a calculation expression of a text form field. More... | |
String | get_TextInputFormat () |
Returns or sets the text formatting for a text form field. More... | |
TextFormFieldType | get_TextInputType () |
Gets or sets the type of a text form field. More... | |
FieldType | get_Type () |
Returns the form field type. More... | |
virtual const TypeInfo & | GetType () const override |
virtual bool | Is (const TypeInfo &target) const override |
void | RemoveField () |
Removes the complete form field, not just the form field special character. More... | |
void | set_CalculateOnExit (bool value) |
Setter for get_CalculateOnExit. More... | |
void | set_CheckBoxSize (double value) |
Setter for get_CheckBoxSize. More... | |
void | set_Checked (bool value) |
Setter for get_Checked. More... | |
void | set_Default (bool value) |
Setter for get_Default. More... | |
void | set_DropDownSelectedIndex (int32_t value) |
Setter for get_DropDownSelectedIndex. More... | |
void | set_Enabled (bool value) |
Setter for get_Enabled. More... | |
void | set_EntryMacro (const String &value) |
Setter for get_EntryMacro. More... | |
void | set_ExitMacro (const String &value) |
Setter for get_ExitMacro. More... | |
void | set_HelpText (const String &value) |
Setter for get_HelpText. More... | |
void | set_IsCheckBoxExactSize (bool value) |
Setter for get_IsCheckBoxExactSize. More... | |
void | set_MaxLength (int32_t value) |
Setter for get_MaxLength. More... | |
void | set_Name (const String &value) |
Setter for get_Name. More... | |
void | set_OwnHelp (bool value) |
Setter for get_OwnHelp. More... | |
void | set_OwnStatus (bool value) |
Setter for get_OwnStatus. More... | |
void | set_Result (const String &value) |
Setter for get_Result. More... | |
void | set_StatusText (const String &value) |
Setter for get_StatusText. More... | |
void | set_TextInputDefault (const String &value) |
Setter for get_TextInputDefault. More... | |
void | set_TextInputFormat (const String &value) |
Setter for get_TextInputFormat. More... | |
void | set_TextInputType (TextFormFieldType value) |
Setter for get_TextInputType. More... | |
void | SetTextInputValue (const SharedPtr< Object > &newValue) |
Applies the text format specified in TextInputFormat and stores the value in Result. More... | |
![]() | |
bool | Accept (SharedPtr< DocumentVisitor > visitor) override |
Accepts a visitor. More... | |
NodeType | get_NodeType () const override |
Returns NodeType.SpecialChar. More... | |
String | GetText () override |
Gets the special character that this node represents. More... | |
![]() | |
SharedPtr< Font > | get_Font () |
Provides access to the font formatting of this object. More... | |
bool | get_IsDeleteRevision () |
Returns true if this object was deleted in Microsoft Word while change tracking was enabled. More... | |
bool | get_IsFormatRevision () |
Returns true if formatting of the object was changed in Microsoft Word while change tracking was enabled. More... | |
bool | get_IsInsertRevision () |
Returns true if this object was inserted in Microsoft Word while change tracking was enabled. More... | |
bool | get_IsMoveFromRevision () |
Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled. More... | |
bool | get_IsMoveToRevision () |
Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled. More... | |
SharedPtr< Paragraph > | get_ParentParagraph () |
Retrieves the parent Paragraph of this node. More... | |
![]() | |
SharedPtr< Node > | Clone (bool isCloneChildren) |
Creates a duplicate of the node. More... | |
int32_t | get_CustomNodeId () const |
Specifies custom node identifier. More... | |
virtual SharedPtr< DocumentBase > | get_Document () const |
Gets the document to which this node belongs. More... | |
virtual bool | get_IsComposite () |
Returns true if this node can contain other nodes. More... | |
SharedPtr< Node > | get_NextSibling () |
Gets the node immediately following this node. More... | |
SharedPtr< CompositeNode > | get_ParentNode () |
Gets the immediate parent of this node. More... | |
SharedPtr< Node > | get_PreviousSibling () |
Gets the node immediately preceding this node. More... | |
SharedPtr< Range > | get_Range () |
Returns a Range object that represents the portion of a document that is contained in this node. More... | |
SharedPtr< CompositeNode > | GetAncestor (NodeType ancestorType) |
Gets the first ancestor of the specified NodeType. More... | |
template<typename T > | |
T | GetAncestorOf () |
SharedPtr< Node > | NextPreOrder (const SharedPtr< Node > &rootNode) |
Gets next node according to the pre-order tree traversal algorithm. More... | |
SharedPtr< Node > | PreviousPreOrder (const SharedPtr< Node > &rootNode) |
Gets the previous node according to the pre-order tree traversal algorithm. More... | |
void | Remove () |
Removes itself from the parent. More... | |
void | set_CustomNodeId (int32_t value) |
Setter for get_CustomNodeId. More... | |
String | ToString (SaveFormat saveFormat) |
Exports the content of the node into a string in the specified format. More... | |
String | ToString (const SharedPtr< SaveOptions > &saveOptions) |
Exports the content of the node into a string using the specified save options. More... | |
Static Public Member Functions | |
static const TypeInfo & | Type () |
![]() | |
static const TypeInfo & | Type () |
![]() | |
static const TypeInfo & | Type () |
![]() | |
static String | NodeTypeToString (NodeType nodeType) |
A utility method that converts a node type enum value into a user friendly string. More... | |
static const TypeInfo & | Type () |
|
overridevirtual |
Accepts a visitor.
Calls DocumentVisitor.VisitFormField.
For more info see the Visitor design pattern.
visitor | The visitor that will visit the node. |
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
Implements Aspose::Words::Node.
bool Aspose::Words::Fields::FormField::get_CalculateOnExit | ( | ) |
True if references to the specified form field are automatically updated whenever the field is exited.
Setting CalculateOnExit only affects the behavior of the form field when the document is opened in Microsoft Word. Aspose.Words never updates references to the form field.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
double Aspose::Words::Fields::FormField::get_CheckBoxSize | ( | ) |
Gets or sets the size of the checkbox in points. Has effect only when IsCheckBoxExactSize is true.
Applicable for a check box form field only.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
bool Aspose::Words::Fields::FormField::get_Checked | ( | ) |
Gets or sets the checked status of the check box form field. Default value for this property is false.
Applicable for a check box form field only.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
bool Aspose::Words::Fields::FormField::get_Default | ( | ) |
Gets or sets the default value of the check box form field. Default value for this property is false.
Applicable for a check box form field only.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::SharedPtr<Aspose::Words::Fields::DropDownItemCollection> Aspose::Words::Fields::FormField::get_DropDownItems | ( | ) |
Provides access to the items of a dropdown form field.
Microsoft Word allows maximum 25 items in a dropdown form field.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
int32_t Aspose::Words::Fields::FormField::get_DropDownSelectedIndex | ( | ) |
Gets or sets the index specifying the currently selected item in a dropdown form field.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
bool Aspose::Words::Fields::FormField::get_Enabled | ( | ) |
True if a form field is enabled.
If a form field is enabled, its contents can be changed as the form is filled in.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_EntryMacro | ( | ) |
Returns or sets an entry macro name for the form field.
The entry macro runs when the form field gets the focus in Microsoft Word.
Microsoft Word allows strings with at most 32 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_ExitMacro | ( | ) |
Returns or sets an exit macro name for the form field.
The exit macro runs when the form field loses the focus in Microsoft Word.
Microsoft Word allows strings with at most 32 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_HelpText | ( | ) |
Returns or sets the text that's displayed in a message box when the form field has the focus and the user presses F1.
If the OwnHelp property is set to True, HelpText specifies the text string value. If OwnHelp is set to False, HelpText specifies the name of an AutoText entry that contains help text for the form field.
Microsoft Word allows strings with at most 255 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
bool Aspose::Words::Fields::FormField::get_IsCheckBoxExactSize | ( | ) |
Gets or sets the boolean value that indicates whether the size of the textbox is automatic or specified explicitly.
Applicable for a check box form field only.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
int32_t Aspose::Words::Fields::FormField::get_MaxLength | ( | ) |
Maximum length for the text field. Zero when the length is not limited.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_Name | ( | ) |
Gets or sets the form field name.
Shows how to insert a combo box.
|
overridevirtual |
Returns NodeType.FormField.
Shows how to traverse a composite node's tree of child nodes.
Implements Aspose::Words::Node.
bool Aspose::Words::Fields::FormField::get_OwnHelp | ( | ) |
Specifies the source of the text that's displayed in a message box when a form field has the focus and the user presses F1.
If True, the text specified by the HelpText property is displayed. If False, the text in the AutoText entry specified by the HelpText property is displayed.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
bool Aspose::Words::Fields::FormField::get_OwnStatus | ( | ) |
Specifies the source of the text that's displayed in the status bar when a form field has the focus.
If true, the text specified by the StatusText property is displayed. If false, the text of the AutoText entry specified by the StatusText property is displayed.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_Result | ( | ) |
Gets or sets a string that represents the result of this form field.
For a text form field the result is the text that is in the field.
For a checkbox form field the result can be "1" or "0" to indicate checked or unchecked.
For a dropdown form field the result is the string selected in the dropdown.
Setting Result for a text form field does not apply the text format specified in TextInputFormat. If you want to set a value and apply the format, use the SetTextInputValue() method.
For a text form field the TextInputDefault value is applied if value is null
.
Shows how to insert a combo box.
System::String Aspose::Words::Fields::FormField::get_StatusText | ( | ) |
Returns or sets the text that's displayed in the status bar when a form field has the focus.
If the OwnStatus property is set to true, the StatusText property specifies the status bar text. If the OwnStatus property is set to false, the StatusText property specifies the name of an AutoText entry that contains status bar text for the form field.
Microsoft Word allows strings with at most 138 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_TextInputDefault | ( | ) |
Gets or sets the default string or a calculation expression of a text form field.
The meaning of this property depends on the value of the TextInputType property.
When TextInputType is Regular or Number, this string specifies the default string for the text form field. This string is the content that Microsoft Word will display in the document when the form field is empty.
When TextInputType is Calculated, then this string holds the expression to be calculated. The expression needs to be a formula valid according to Microsoft Word formula field requirements. When you set a new expression using this property, Aspose.Words calculates the formula result automatically and inserts it into the form field.
Microsoft Word allows strings with at most 255 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
System::String Aspose::Words::Fields::FormField::get_TextInputFormat | ( | ) |
Returns or sets the text formatting for a text form field.
If the text form field contains regular text, then valid format strings are "", "UPPERCASE", "LOWERCASE", "FIRST CAPITAL" and "TITLE CASE". The strings are case-insensitive.
If the text form field contains a number or a date/time value, then valid format strings are number or date and time format strings.
Microsoft Word allows strings with at most 64 characters.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
Aspose::Words::Fields::TextFormFieldType Aspose::Words::Fields::FormField::get_TextInputType | ( | ) |
Gets or sets the type of a text form field.
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
Aspose::Words::Fields::FieldType Aspose::Words::Fields::FormField::get_Type | ( | ) |
Returns the form field type.
Shows how to insert a combo box.
|
overridevirtual |
Reimplemented from Aspose::Words::SpecialChar.
|
overridevirtual |
Reimplemented from Aspose::Words::SpecialChar.
void Aspose::Words::Fields::FormField::RemoveField | ( | ) |
Removes the complete form field, not just the form field special character.
Shows how to delete a form field.
void Aspose::Words::Fields::FormField::set_CalculateOnExit | ( | bool | value | ) |
void Aspose::Words::Fields::FormField::set_CheckBoxSize | ( | double | value | ) |
void Aspose::Words::Fields::FormField::set_Checked | ( | bool | value | ) |
Setter for Aspose::Words::Fields::FormField::get_Checked.
void Aspose::Words::Fields::FormField::set_Default | ( | bool | value | ) |
Setter for Aspose::Words::Fields::FormField::get_Default.
void Aspose::Words::Fields::FormField::set_DropDownSelectedIndex | ( | int32_t | value | ) |
void Aspose::Words::Fields::FormField::set_Enabled | ( | bool | value | ) |
Setter for Aspose::Words::Fields::FormField::get_Enabled.
void Aspose::Words::Fields::FormField::set_EntryMacro | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_EntryMacro.
void Aspose::Words::Fields::FormField::set_ExitMacro | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_ExitMacro.
void Aspose::Words::Fields::FormField::set_HelpText | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_HelpText.
void Aspose::Words::Fields::FormField::set_IsCheckBoxExactSize | ( | bool | value | ) |
void Aspose::Words::Fields::FormField::set_MaxLength | ( | int32_t | value | ) |
Setter for Aspose::Words::Fields::FormField::get_MaxLength.
void Aspose::Words::Fields::FormField::set_Name | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_Name.
void Aspose::Words::Fields::FormField::set_OwnHelp | ( | bool | value | ) |
Setter for Aspose::Words::Fields::FormField::get_OwnHelp.
void Aspose::Words::Fields::FormField::set_OwnStatus | ( | bool | value | ) |
Setter for Aspose::Words::Fields::FormField::get_OwnStatus.
void Aspose::Words::Fields::FormField::set_Result | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_Result.
void Aspose::Words::Fields::FormField::set_StatusText | ( | const System::String & | value | ) |
Setter for Aspose::Words::Fields::FormField::get_StatusText.
void Aspose::Words::Fields::FormField::set_TextInputDefault | ( | const System::String & | value | ) |
void Aspose::Words::Fields::FormField::set_TextInputFormat | ( | const System::String & | value | ) |
void Aspose::Words::Fields::FormField::set_TextInputType | ( | Aspose::Words::Fields::TextFormFieldType | value | ) |
void Aspose::Words::Fields::FormField::SetTextInputValue | ( | const System::SharedPtr< System::Object > & | newValue | ) |
Applies the text format specified in TextInputFormat and stores the value in Result.
newValue | Can be a string, number or a DateTime object. |
Shows how insert different kinds of form fields into a document, and process them with using a document visitor implementation.
|
static |