Aspose::Words::Fields::FormField::set_Name method
Contents
[
Hide
]FormField::set_Name method
Sets the form field name.
void Aspose::Words::Fields::FormField::set_Name(const System::String & value)
Remarks
Microsoft Word allows strings with at most 20 characters.
Examples
Shows how to insert a combo box.
auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
builder->Write(u"Please select a fruit: ");
// Insert a combo box which will allow a user to choose an option from a collection of strings.
System::SharedPtr<Aspose::Words::Fields::FormField> comboBox = builder->InsertComboBox(u"MyComboBox", System::MakeArray<System::String>({
u"Apple", u"Banana", u"Cherry"}), 0);
ASSERT_EQ(comboBox->get_Name(), u"MyComboBox");
ASSERT_EQ(comboBox->get_Type(), FieldType::FieldFormDropDown);
ASSERT_EQ(comboBox->get_Result(), u"Apple");
// The form field will appear in the form of a "select" html tag.
doc->Save(get_ArtifactsDir() + u"FormFields.Create.html");
See Also
- Class FormField
- Namespace Aspose::Words::Fields
- Library Aspose.Words for C++