Class CheckBoxState
Represents a checked state or unchecked state in the checkbox content control.
Inheritance
System.Object
CheckBoxState
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class CheckBoxState : Object
Examples
The following example illustrates how to apply checkbox state properties.
//Create a new Word document
WordDocument document = new WordDocument();
//Add one section and one paragraph to the document
document.EnsureMinimal();
//Get the last paragraph.
WParagraph paragraph = document.LastParagraph;
//Add text to the paragraph
paragraph.AppendText("A new text is added to the paragraph. ");
//Append checkbox content control to the paragraph
InlineContentControl checkBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox) as InlineContentControl;
//Get checked state of checkbox
CheckBoxState checkBoxCheckedState = checkBox.ContentControlProperties.CheckedState;
//Set font for checked state value
checkBoxCheckedState.Font = "Calibri";
//Set symbol for checked state value
checkBoxCheckedState.Value = "C";
//Get unchecked state of checkbox
CheckBoxState checkBoxUncheckedState = checkBox.ContentControlProperties.UncheckedState;
//Set font for unchecked state value
checkBoxUncheckedState.Font = "Calibri";
//Set symbol for unchecked state value
checkBoxUncheckedState.Value = "U";
//Set the state for checkbox
checkBox.ContentControlProperties.IsChecked = true;
//Save the Word document
document.Save("Sample.docx", FormatType.Docx);
//Close the document
document.Close();
'Create a new Word document
Dim document As WordDocument = New WordDocument
'Add one section and one paragraph to the document
document.EnsureMinimal
'Get the last paragraph.
Dim paragraph As WParagraph = document.LastParagraph
'Add text to the paragraph
paragraph.AppendText("A new text is added to the paragraph. ")
'Append checkbox content control to the paragraph
Dim checkBox As InlineContentControl = CType(paragraph.AppendInlineContentControl(ContentControlType.CheckBox), InlineContentControl)
'Get checked state of checkbox
Dim checkBoxCheckedState As CheckBoxState = checkBox.ContentControlProperties.CheckedState
'Set font for checked state value
checkBoxCheckedState.Font = "Calibri"
'Set symbol for checked state value
checkBoxCheckedState.Value = "C"
'Get unchecked state of checkbox
Dim checkBoxUncheckedState As CheckBoxState = checkBox.ContentControlProperties.UncheckedState
'Set font for unchecked state value
checkBoxUncheckedState.Font = "Calibri"
'Set symbol for unchecked state value
checkBoxUncheckedState.Value = "U"
'Set the state for checkbox
checkBox.ContentControlProperties.IsChecked = true
'Save the Word document
document.Save("Sample.docx", FormatType.Docx)
'Close the document
document.Close
Constructors
CheckBoxState()
Declaration
public CheckBoxState()
Properties
Font
Gets or sets a font name for the checked state or unchecked state of the checkbox content control.
Declaration
public string Font { get; set; }
Property Value
Type |
---|
System.String |
Value
Gets or sets a value represents symbol for the checked state or unchecked state of the checkbox content control.
Declaration
public string Value { get; set; }
Property Value
Type |
---|
System.String |