Class PdfXfaComboBoxField
Represents the combo box field of the XFA form.
Inherited Members
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfXfaComboBoxField : PdfXfaStyledField
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Add items.
field.Items.Add("One");
field.Items.Add("Two");
field.Items.Add("Three");
field.Items.Add("Four");
field.Items.Add("Five");
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Add items.
field.Items.Add("One")
field.Items.Add("Two")
field.Items.Add("Three")
field.Items.Add("Four")
field.Items.Add("Five")
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Constructors
PdfXfaComboBoxField(String, SizeF)
Initialize a new instance of the PdfXfaComboBoxField class.
Declaration
public PdfXfaComboBoxField(string name, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the field. |
SizeF | size | The size of the field. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Add items.
field.Items.Add("One");
field.Items.Add("Two");
field.Items.Add("Three");
field.Items.Add("Four");
field.Items.Add("Five");
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Add items.
field.Items.Add("One")
field.Items.Add("Two")
field.Items.Add("Three")
field.Items.Add("Four")
field.Items.Add("Five")
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
PdfXfaComboBoxField(String, SizeF, List<String>)
Initialize a new instance of the PdfXfaComboBoxField class.
Declaration
public PdfXfaComboBoxField(string name, SizeF size, List<string> items)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the field. |
SizeF | size | Size of the field. |
System.Collections.Generic.List<System.String> | items | Field items. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30), items);
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30), items)
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
PdfXfaComboBoxField(String, Single, Single)
Initialize a new instance of the PdfXfaComboBoxField class.
Declaration
public PdfXfaComboBoxField(string name, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the field. |
System.Single | width | Width of the field. |
System.Single | height | Height of the field. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", 100, 30);
//Add items.
field.Items.Add("One");
field.Items.Add("Two");
field.Items.Add("Three");
field.Items.Add("Four");
field.Items.Add("Five");
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", 100, 30)
'Add items.
field.Items.Add("One")
field.Items.Add("Two")
field.Items.Add("Three")
field.Items.Add("Four")
field.Items.Add("Five")
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
PdfXfaComboBoxField(String, Single, Single, List<String>)
Initialize a new instance of the PdfXfaComboBoxField class.
Declaration
public PdfXfaComboBoxField(string name, float width, float height, List<string> items)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the field. |
System.Single | width | Width of the field. |
System.Single | height | Height of the field. |
System.Collections.Generic.List<System.String> | items | Field items. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", 100, 30, items);
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", 100, 30, items)
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Properties
AllowTextEntry
Gets or sets the text entry
Declaration
public bool AllowTextEntry { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set items.
field.Items = items;
//Set text entry.
field.AllowTextEntry = true;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set items.
field.Items = items
'Set text entry.
field.AllowTextEntry = True
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Caption
Gets or sets the caption of the field
Declaration
public PdfXfaCaption Caption { get; set; }
Property Value
Type |
---|
PdfXfaCaption |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set paddings.
field.Padding.All = 2;
//Set data source.
field.DataSource = items;
//Set caption.
field.Caption.Text = "Combo Box";
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set paddings.
field.Padding.All = 2
'Set data source.
field.DataSource = items
'Set caption.
field.Caption.Text = "Combo Box"
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
DataSource
Gets or set the combo box items.
Declaration
public object DataSource { get; set; }
Property Value
Type |
---|
System.Object |
Remarks
It only supports the list of string or array of string values.
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set paddings.
field.Padding.All = 2;
//Set data source.
field.DataSource = items;
//Set caption.
field.Caption.Text = "Combo Box";
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set paddings.
field.Padding.All = 2
'Set data source.
field.DataSource = items
'Set caption.
field.Caption.Text = "Combo Box"
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Items
Gets or sets the field items
Declaration
public List<string> Items { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<System.String> |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "Combo Box";
//Set items.
field.Items = items;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "Combo Box"
'Set items.
field.Items = items
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Padding
Gets or sets the padding
Declaration
public PdfPaddings Padding { get; set; }
Property Value
Type |
---|
PdfPaddings |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set paddings.
field.Padding.All = 2;
//Set data source.
field.DataSource = items;
//Set caption.
field.Caption.Text = "Combo Box";
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set paddings.
field.Padding.All = 2
'Set data source.
field.DataSource = items
'Set caption.
field.Caption.Text = "Combo Box"
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
SelectedIndex
Gets or sets the selected index
Declaration
public int SelectedIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set items.
field.Items = items;
//Set selected index.
field.SelectedIndex = 1;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set items.
field.Items = items
'Set selected index.
field.SelectedIndex = 1
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
SelectedValue
Gets or sets the selected value
Declaration
public string SelectedValue { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
List<string> items = new List<string>() { "One", "Two", "Three", "Four", "Five" };
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Set items.
field.Items = items;
//Set selected value
field.SelectedValue = "Three";
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
Dim items As New List(Of String)()
items.Add("One")
items.Add("Two")
items.Add("Three")
items.Add("Four")
items.Add("Five")
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Set items.
field.Items = items
'Set selected value
field.SelectedValue = "Three"
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | The copy of the new object for this instance. |
Examples
//Create a new XFA document
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA combo box field
PdfXfaComboBoxField field = new PdfXfaComboBoxField("combo1", new SizeF(100, 30));
//Add items.
field.Items.Add("One");
field.Items.Add("Two");
field.Items.Add("Three");
field.Items.Add("Four");
field.Items.Add("Five");
//Add the field to the form
form.Fields.Add(field);
//Clone the combo box field.
form.Fields.Add(field.Clone() as PdfXfaComboBoxField);
document.XfaForm = form;
//Save the document
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA combo box field
Dim field As New PdfXfaComboBoxField("combo1", New SizeF(100, 30))
'Add items.
field.Items.Add("One")
field.Items.Add("Two")
field.Items.Add("Three")
field.Items.Add("Four")
field.Items.Add("Five")
'Add the field to the form
form.Fields.Add(field)
'Clone the combo box field.
xfaForm.Fields.Add( TryCast(field.Clone(), PdfXfaComboBoxField))
document.XfaForm = form
'Save the document
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()