Class WCheckBox
Represents the check box in the Word document.
Inheritance
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class WCheckBox : WFormField, IXDLSSerializable, IOfficeRun, IStringWidget, ISplitLeafWidget, ITextMeasurable, IWField, IWTextRange, IParagraphItem, IEntity, ILeafWidget, IWidget
Examples
The following code illustrates how to add a new checkbox.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Create a new Word document
WordDocument document = new WordDocument();
//Add new section to the document
IWSection section = document.AddSection();
//Add new paragraph to the section
WParagraph paragraph = section.AddParagraph() as WParagraph;
paragraph.AppendText("Gender\t");
//Append new Checkbox
WCheckBox checkbox = paragraph.AppendCheckBox();
checkbox.Checked = false;
//Set Checkbox size
checkbox.CheckBoxSize = 10;
checkbox.CalculateOnExit = true;
//Set help text
checkbox.Help = "Help text";
paragraph.AppendText("Male\t");
checkbox = paragraph.AppendCheckBox();
checkbox.Checked = false;
checkbox.CheckBoxSize = 10;
checkbox.CalculateOnExit = true;
paragraph.AppendText("Female");
//Save the Word document
document.Save("Checkbox.docx", FormatType.Docx);
//Close the document
document.Close();
}
Constructors
WCheckBox(IWordDocument)
Initializes a new instance of the WCheckBox class with the specified IWordDocument instance.
Declaration
public WCheckBox(IWordDocument doc)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | doc | The IWordDocument instance. |
Properties
CheckBoxSize
Gets or sets the size of the checkbox.
Declaration
public int CheckBoxSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The integer that specifies the size of checkbox. |
Checked
Gets or sets a value indicating whether the the checkbox is checked.
Declaration
public bool Checked { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the checked box is checked; otherwise, false. |
DefaultCheckBoxValue
Gets or sets value indicating whether by default the checkbox is checked or not.
Declaration
public bool DefaultCheckBoxValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the checked box is checked by default; otherwise, false. |
EntityType
Gets the type of the entity.
Declaration
public override EntityType EntityType { get; }
Property Value
Type | Description |
---|---|
EntityType | The EntityType of the current item. |
Overrides
SizeType
Gets or sets the type of the checkbox size.
Declaration
public CheckBoxSizeType SizeType { get; set; }
Property Value
Type | Description |
---|---|
CheckBoxSizeType | The CheckBoxSizeType member that specifies the checkbox size type. |
Methods
CloneImpl()
Creates a duplicate copy of the entity.
Declaration
protected override object CloneImpl()
Returns
Type | Description |
---|---|
System.Object | A reference to the newly created instance. |
Overrides
CreateLayoutInfo()
Creates layout information.
Declaration
protected override void CreateLayoutInfo()
Overrides
ReadXmlAttributes(IXDLSAttributeReader)
Reads object data from xml attributes.
Declaration
protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeReader | reader | The IXDLSAttributeReader object. |
Overrides
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |