SdtCheckBox

Namespace: Spire.Doc
We found 10 examples in language CSharp for this search. You will see 48 fragments of code.

        internal override SdtControlProperties Clone()
        {
            SdtCheckBox box = (SdtCheckBox) base.MemberwiseClone();
            box.class67_0 = this.class67_0.method_0();
            box.class67_1 = this.class67_1.method_0();
            return box;
        }

        [Test]
        public void CheckBoxTypeContentControl()
        {
            //ExStart:CheckBoxTypeContentControl
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            builder.InsertNode(sdtCheckBox);
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.CheckBoxTypeContentControl.docx", SaveFormat.Docx);
            //ExEnd:CheckBoxTypeContentControl
        }

        [Test]
        public void CurrentStateOfCheckBox()
        {
            //ExStart:SetCurrentStateOfCheckBox
            Document doc = new Document(MyDir + "Structured document tags.docx");
            
            // Get the first content control from the document.
            StructuredDocumentTag sdtCheckBox =
                (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            if (sdtCheckBox.SdtType == SdtType.Checkbox)
                sdtCheckBox.Checked = true;

            doc.Save(ArtifactsDir + "WorkingWithSdt.CurrentStateOfCheckBox.docx");
            //ExEnd:SetCurrentStateOfCheckBox
        }

        [Test]
        public void ModifyContentControls()
        {
            //ExStart:ModifyContentControls
            Document doc = new Document(MyDir + "Structured document tags.docx");

            foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
            {
                switch (sdt.SdtType)
                {
                    case SdtType.PlainText:
                    {
                        sdt.RemoveAllChildren();
                        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
                        Run run = new Run(doc, "new text goes here");
                        para.AppendChild(run);
                        break;
                    }
                    case SdtType.DropDownList:
                    {
                        SdtListItem secondItem = sdt.ListItems[2];
                        sdt.ListItems.SelectedValue = secondItem;
                        break;
                    }
                    case SdtType.Picture:
                    {
                        Shape shape = (Shape) sdt.GetChild(NodeType.Shape, 0, true);
                        if (shape.HasImage)
                        {
                            shape.ImageData.SetImage(ImagesDir + "Watermark.png");
                        }

                        break;
                    }
                }
            }
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.ModifyContentControls.docx");
            //ExEnd:ModifyContentControls
        }

        [Test]
        public void ComboBoxContentControl()
        {
            //ExStart:ComboBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block);
            sdt.ListItems.Add(new SdtListItem("Choose an item", "-1"));
            sdt.ListItems.Add(new SdtListItem("Item 1", "1"));
            sdt.ListItems.Add(new SdtListItem("Item 2", "2"));
            doc.FirstSection.Body.AppendChild(sdt);

            doc.Save(ArtifactsDir + "WorkingWithSdt.ComboBoxContentControl.docx");
            //ExEnd:ComboBoxContentControl
        }

        [Test]
        public void RichTextBoxContentControl()
        {
            //ExStart:RichTextBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

            Paragraph para = new Paragraph(doc);
            Run run = new Run(doc);
            run.Text = "Hello World";
            run.Font.Color = Color.Green;
            para.Runs.Add(run);
            sdtRichText.ChildNodes.Add(para);
            doc.FirstSection.Body.AppendChild(sdtRichText);

            doc.Save(ArtifactsDir + "WorkingWithSdt.RichTextBoxContentControl.docx");
            //ExEnd:RichTextBoxContentControl
        }

        [Test]
        public void SetContentControlColor()
        {
            //ExStart:SetContentControlColor
            Document doc = new Document(MyDir + "Structured document tags.docx");

            StructuredDocumentTag sdt = (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            sdt.Color = Color.Red;

            doc.Save(ArtifactsDir + "WorkingWithSdt.SetContentControlColor.docx");
            //ExEnd:SetContentControlColor
        }


        private void button1_Click(object sender, EventArgs e)
        {
            //Create a document
            Document document = new Document();

            //Add a new section.
            Section section = document.AddSection();

            //Add a paragraph
            Paragraph paragraph = section.AddParagraph();

            //Append textRange for the paragraph
            TextRange txtRange = paragraph.AppendText("The following example shows how to add CheckBox content control in a Word document. \n");

            //Append textRange 
            txtRange = paragraph.AppendText("Add CheckBox Content Control:  ");

            //Set the font format
            txtRange.CharacterFormat.Italic = true;

            //Create StructureDocumentTagInline for document
            StructureDocumentTagInline sdt = new StructureDocumentTagInline(document);

            //Add sdt in paragraph
            paragraph.ChildObjects.Add(sdt);

            //Specify the type
            sdt.SDTProperties.SDTType = SdtType.CheckBox;

            //Set properties for control
            SdtCheckBox scb = new SdtCheckBox();
            sdt.SDTProperties.ControlProperties = scb;

            //Add textRange format
            TextRange tr = new TextRange(document);
            tr.CharacterFormat.FontName = "MS Gothic";
            tr.CharacterFormat.FontSize = 12;

            //Add textRange to StructureDocumentTagInline
            sdt.ChildObjects.Add(tr);

            //Set checkBox as checked
            scb.Checked = true;

            //Save the document.
            document.SaveToFile("Output.docx", FileFormat.Docx);

            //Launch the Word file.
            WordDocViewer("Output.docx");
        }

        private void WordDocViewer(string fileName)
        {
            try
            {
                System.Diagnostics.Process.Start(fileName);
            }
            catch { }
        }


        private void button1_Click(object sender, EventArgs e)
        {
            //Create a document
            Document document = new Document();

            //Load the document from disk.
            document.LoadFromFile(@"..\..\..\..\..\..\Data\CheckBoxContentControl.docx");

            //Call StructureTags
            StructureTags structureTags = GetAllTags(document);

            //Create list 
            List<StructureDocumentTagInline> tagInlines = structureTags.tagInlines;

            //Get the controls
            for (int i = 0; i < tagInlines.Count; i++)
            {
                //Get the type
                string type = tagInlines[i].SDTProperties.SDTType.ToString();

                //Update the status
                if (type == "CheckBox")
                {
                    SdtCheckBox scb = tagInlines[i].SDTProperties.ControlProperties as SdtCheckBox;
                    if (scb.Checked)
                    {
                        scb.Checked = false;
                    }
                    else
                    {
                        scb.Checked = true;
                    }
                }

            }
            //Save the document.
            document.SaveToFile("Output.docx", FileFormat.Docx);

            //Launch the Word file.
            WordDocViewer("Output.docx");

        }

        static StructureTags GetAllTags(Document document)
        {

            //Create StructureTags
            StructureTags structureTags = new StructureTags();

            //Travel document sections
            foreach (Section section in document.Sections)
            {
                foreach (DocumentObject obj in section.Body.ChildObjects)
                {
                    //Travel document paragraphs
                    if (obj.DocumentObjectType == DocumentObjectType.Paragraph)
                    {
                        foreach (DocumentObject pobj in (obj as Paragraph).ChildObjects)
                        {
                            //Get StructureDocumentTagInline
                            if (pobj.DocumentObjectType == DocumentObjectType.StructureDocumentTagInline)
                            {
                                structureTags.tagInlines.Add(pobj as StructureDocumentTagInline);
                            }
                        }
                    }

                }
            }
            return structureTags;
        }
        private void WordDocViewer(string fileName)
        {
            try
            {
                System.Diagnostics.Process.Start(fileName);
            }
            catch { }
        }

        [Test]
        public void CheckBoxTypeContentControl()
        {
            //ExStart:CheckBoxTypeContentControl
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            builder.InsertNode(sdtCheckBox);
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.CheckBoxTypeContentControl.docx", SaveFormat.Docx);
            //ExEnd:CheckBoxTypeContentControl
        }

        [Test]
        public void CurrentStateOfCheckBox()
        {
            //ExStart:SetCurrentStateOfCheckBox
            Document doc = new Document(MyDir + "Structured document tags.docx");
            
            // Get the first content control from the document.
            StructuredDocumentTag sdtCheckBox =
                (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            if (sdtCheckBox.SdtType == SdtType.Checkbox)
                sdtCheckBox.Checked = true;

            doc.Save(ArtifactsDir + "WorkingWithSdt.CurrentStateOfCheckBox.docx");
            //ExEnd:SetCurrentStateOfCheckBox
        }

        [Test]
        public void ModifyContentControls()
        {
            //ExStart:ModifyContentControls
            Document doc = new Document(MyDir + "Structured document tags.docx");

            foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
            {
                switch (sdt.SdtType)
                {
                    case SdtType.PlainText:
                    {
                        sdt.RemoveAllChildren();
                        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
                        Run run = new Run(doc, "new text goes here");
                        para.AppendChild(run);
                        break;
                    }
                    case SdtType.DropDownList:
                    {
                        SdtListItem secondItem = sdt.ListItems[2];
                        sdt.ListItems.SelectedValue = secondItem;
                        break;
                    }
                    case SdtType.Picture:
                    {
                        Shape shape = (Shape) sdt.GetChild(NodeType.Shape, 0, true);
                        if (shape.HasImage)
                        {
                            shape.ImageData.SetImage(ImagesDir + "Watermark.png");
                        }

                        break;
                    }
                }
            }
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.ModifyContentControls.docx");
            //ExEnd:ModifyContentControls
        }

        [Test]
        public void ComboBoxContentControl()
        {
            //ExStart:ComboBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block);
            sdt.ListItems.Add(new SdtListItem("Choose an item", "-1"));
            sdt.ListItems.Add(new SdtListItem("Item 1", "1"));
            sdt.ListItems.Add(new SdtListItem("Item 2", "2"));
            doc.FirstSection.Body.AppendChild(sdt);

            doc.Save(ArtifactsDir + "WorkingWithSdt.ComboBoxContentControl.docx");
            //ExEnd:ComboBoxContentControl
        }

        [Test]
        public void RichTextBoxContentControl()
        {
            //ExStart:RichTextBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

            Paragraph para = new Paragraph(doc);
            Run run = new Run(doc);
            run.Text = "Hello World";
            run.Font.Color = Color.Green;
            para.Runs.Add(run);
            sdtRichText.ChildNodes.Add(para);
            doc.FirstSection.Body.AppendChild(sdtRichText);

            doc.Save(ArtifactsDir + "WorkingWithSdt.RichTextBoxContentControl.docx");
            //ExEnd:RichTextBoxContentControl
        }

        [Test]
        public void SetContentControlColor()
        {
            //ExStart:SetContentControlColor
            Document doc = new Document(MyDir + "Structured document tags.docx");

            StructuredDocumentTag sdt = (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            sdt.Color = Color.Red;

            doc.Save(ArtifactsDir + "WorkingWithSdt.SetContentControlColor.docx");
            //ExEnd:SetContentControlColor
        }

        [Test]
        public void CheckBoxTypeContentControl()
        {
            //ExStart:CheckBoxTypeContentControl
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            builder.InsertNode(sdtCheckBox);
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.CheckBoxTypeContentControl.docx", SaveFormat.Docx);
            //ExEnd:CheckBoxTypeContentControl
        }

        [Test]
        public void CurrentStateOfCheckBox()
        {
            //ExStart:SetCurrentStateOfCheckBox
            Document doc = new Document(MyDir + "Structured document tags.docx");
            
            // Get the first content control from the document.
            StructuredDocumentTag sdtCheckBox =
                (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            if (sdtCheckBox.SdtType == SdtType.Checkbox)
                sdtCheckBox.Checked = true;

            doc.Save(ArtifactsDir + "WorkingWithSdt.CurrentStateOfCheckBox.docx");
            //ExEnd:SetCurrentStateOfCheckBox
        }

        [Test]
        public void ModifyContentControls()
        {
            //ExStart:ModifyContentControls
            Document doc = new Document(MyDir + "Structured document tags.docx");

            foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
            {
                switch (sdt.SdtType)
                {
                    case SdtType.PlainText:
                    {
                        sdt.RemoveAllChildren();
                        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
                        Run run = new Run(doc, "new text goes here");
                        para.AppendChild(run);
                        break;
                    }
                    case SdtType.DropDownList:
                    {
                        SdtListItem secondItem = sdt.ListItems[2];
                        sdt.ListItems.SelectedValue = secondItem;
                        break;
                    }
                    case SdtType.Picture:
                    {
                        Shape shape = (Shape) sdt.GetChild(NodeType.Shape, 0, true);
                        if (shape.HasImage)
                        {
                            shape.ImageData.SetImage(ImagesDir + "Watermark.png");
                        }

                        break;
                    }
                }
            }
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.ModifyContentControls.docx");
            //ExEnd:ModifyContentControls
        }

        [Test]
        public void ComboBoxContentControl()
        {
            //ExStart:ComboBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block);
            sdt.ListItems.Add(new SdtListItem("Choose an item", "-1"));
            sdt.ListItems.Add(new SdtListItem("Item 1", "1"));
            sdt.ListItems.Add(new SdtListItem("Item 2", "2"));
            doc.FirstSection.Body.AppendChild(sdt);

            doc.Save(ArtifactsDir + "WorkingWithSdt.ComboBoxContentControl.docx");
            //ExEnd:ComboBoxContentControl
        }

        [Test]
        public void RichTextBoxContentControl()
        {
            //ExStart:RichTextBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

            Paragraph para = new Paragraph(doc);
            Run run = new Run(doc);
            run.Text = "Hello World";
            run.Font.Color = Color.Green;
            para.Runs.Add(run);
            sdtRichText.ChildNodes.Add(para);
            doc.FirstSection.Body.AppendChild(sdtRichText);

            doc.Save(ArtifactsDir + "WorkingWithSdt.RichTextBoxContentControl.docx");
            //ExEnd:RichTextBoxContentControl
        }

        [Test]
        public void SetContentControlColor()
        {
            //ExStart:SetContentControlColor
            Document doc = new Document(MyDir + "Structured document tags.docx");

            StructuredDocumentTag sdt = (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            sdt.Color = Color.Red;

            doc.Save(ArtifactsDir + "WorkingWithSdt.SetContentControlColor.docx");
            //ExEnd:SetContentControlColor
        }

        [Test]
        public void CheckBoxTypeContentControl()
        {
            //ExStart:CheckBoxTypeContentControl
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            builder.InsertNode(sdtCheckBox);
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.CheckBoxTypeContentControl.docx", SaveFormat.Docx);
            //ExEnd:CheckBoxTypeContentControl
        }

        [Test]
        public void CurrentStateOfCheckBox()
        {
            //ExStart:SetCurrentStateOfCheckBox
            Document doc = new Document(MyDir + "Structured document tags.docx");
            
            // Get the first content control from the document.
            StructuredDocumentTag sdtCheckBox =
                (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            if (sdtCheckBox.SdtType == SdtType.Checkbox)
                sdtCheckBox.Checked = true;

            doc.Save(ArtifactsDir + "WorkingWithSdt.CurrentStateOfCheckBox.docx");
            //ExEnd:SetCurrentStateOfCheckBox
        }

        [Test]
        public void ModifyContentControls()
        {
            //ExStart:ModifyContentControls
            Document doc = new Document(MyDir + "Structured document tags.docx");

            foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
            {
                switch (sdt.SdtType)
                {
                    case SdtType.PlainText:
                    {
                        sdt.RemoveAllChildren();
                        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
                        Run run = new Run(doc, "new text goes here");
                        para.AppendChild(run);
                        break;
                    }
                    case SdtType.DropDownList:
                    {
                        SdtListItem secondItem = sdt.ListItems[2];
                        sdt.ListItems.SelectedValue = secondItem;
                        break;
                    }
                    case SdtType.Picture:
                    {
                        Shape shape = (Shape) sdt.GetChild(NodeType.Shape, 0, true);
                        if (shape.HasImage)
                        {
                            shape.ImageData.SetImage(ImagesDir + "Watermark.png");
                        }

                        break;
                    }
                }
            }
            
            doc.Save(ArtifactsDir + "WorkingWithSdt.ModifyContentControls.docx");
            //ExEnd:ModifyContentControls
        }

        [Test]
        public void ComboBoxContentControl()
        {
            //ExStart:ComboBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.ComboBox, MarkupLevel.Block);
            sdt.ListItems.Add(new SdtListItem("Choose an item", "-1"));
            sdt.ListItems.Add(new SdtListItem("Item 1", "1"));
            sdt.ListItems.Add(new SdtListItem("Item 2", "2"));
            doc.FirstSection.Body.AppendChild(sdt);

            doc.Save(ArtifactsDir + "WorkingWithSdt.ComboBoxContentControl.docx");
            //ExEnd:ComboBoxContentControl
        }

        [Test]
        public void RichTextBoxContentControl()
        {
            //ExStart:RichTextBoxContentControl
            Document doc = new Document();

            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

            Paragraph para = new Paragraph(doc);
            Run run = new Run(doc);
            run.Text = "Hello World";
            run.Font.Color = Color.Green;
            para.Runs.Add(run);
            sdtRichText.ChildNodes.Add(para);
            doc.FirstSection.Body.AppendChild(sdtRichText);

            doc.Save(ArtifactsDir + "WorkingWithSdt.RichTextBoxContentControl.docx");
            //ExEnd:RichTextBoxContentControl
        }

        [Test]
        public void SetContentControlColor()
        {
            //ExStart:SetContentControlColor
            Document doc = new Document(MyDir + "Structured document tags.docx");

            StructuredDocumentTag sdt = (StructuredDocumentTag) doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            sdt.Color = Color.Red;

            doc.Save(ArtifactsDir + "WorkingWithSdt.SetContentControlColor.docx");
            //ExEnd:SetContentControlColor
        }

        [Test]
        public void RepeatingSection()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.SdtType
            //ExSummary:Shows how to get type of structured document tag.
            Document doc = new Document(MyDir + "Structured document tags.docx");

            List<StructuredDocumentTag> sdTags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true).OfType<StructuredDocumentTag>().ToList();

            Assert.AreEqual(SdtType.RepeatingSection, sdTags[0].SdtType);
            Assert.AreEqual(SdtType.RepeatingSectionItem, sdTags[1].SdtType);
            Assert.AreEqual(SdtType.RichText, sdTags[2].SdtType);
            //ExEnd
        }

        [Test]
        public void SetSpecificStyleToSdt()
        {
            //ExStart
            //ExFor:StructuredDocumentTag
            //ExFor:StructuredDocumentTag.NodeType
            //ExFor:StructuredDocumentTag.Style
            //ExFor:StructuredDocumentTag.StyleName
            //ExFor:MarkupLevel
            //ExFor:SdtType
            //ExSummary:Shows how to work with styles for content control elements.
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Get specific style from the document to apply it to an SDT
            Style quoteStyle = doc.Styles[StyleIdentifier.Quote];
            StructuredDocumentTag sdtPlainText = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);
            sdtPlainText.Style = quoteStyle;

            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Inline);
            // Second method to apply specific style to an SDT control
            sdtRichText.StyleName = "Quote";

            // Insert content controls into the document
            builder.InsertNode(sdtPlainText);
            builder.InsertNode(sdtRichText);

            // We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
            Assert.AreEqual(NodeType.StructuredDocumentTag, sdtPlainText.NodeType);

            NodeCollection tags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);

            foreach (Node node in tags)
            {
                StructuredDocumentTag sdt = (StructuredDocumentTag)node;
                // If style was not defined before, style should be "Default Paragraph Font"
                Assert.AreEqual(StyleIdentifier.Quote, sdt.Style.StyleIdentifier);
                Assert.AreEqual("Quote", sdt.StyleName);
            }
            //ExEnd
        }

        [Test]
        public void CheckBox()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.#ctor(DocumentBase, SdtType, MarkupLevel)
            //ExFor:StructuredDocumentTag.Checked
            //ExSummary:Show how to create and insert checkbox structured document tag.
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            sdtCheckBox.Checked = true;

            // Insert content control into the document
            builder.InsertNode(sdtCheckBox);
            //ExEnd

            doc = DocumentHelper.SaveOpen(doc);

            NodeCollection sdts = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);

            StructuredDocumentTag sdt = (StructuredDocumentTag) sdts[0];
            Assert.AreEqual(true, sdt.Checked);
            Assert.That(sdt.XmlMapping.StoreItemId, Is.Empty); //Assert that this sdt has no StoreItemId
        }

#if NET462 || NETCOREAPP2_1 || JAVA // because of xamarin bug with CultureInfo (https://xamarin.github.io/bugzilla-archives/59/59077/bug.html)
        [Test]
        public void Date()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.CalendarType
            //ExFor:StructuredDocumentTag.DateDisplayFormat
            //ExFor:StructuredDocumentTag.DateDisplayLocale
            //ExFor:StructuredDocumentTag.DateStorageFormat
            //ExFor:StructuredDocumentTag.FullDate
            //ExSummary:Shows how to prompt the user to enter a date with a StructuredDocumentTag.
            // Create a new document
            Document doc = new Document();

            // Insert a StructuredDocumentTag that prompts the user to enter a date
            // In Microsoft Word, this element is known as a "Date picker content control"
            // When we click on the arrow on the right end of this tag in Microsoft Word,
            // we will see a pop up in the form of a clickable calendar
            // We can use that popup to select a date that will be displayed by the tag 
            StructuredDocumentTag sdtDate = new StructuredDocumentTag(doc, SdtType.Date, MarkupLevel.Inline);

            // This attribute sets the language that the calendar will be displayed in,
            // which in this case will be Saudi Arabian Arabic
            sdtDate.DateDisplayLocale = CultureInfo.GetCultureInfo("ar-SA").LCID;

            // We can set the format with which to display the date like this
            // The locale we set above will be carried over to the displayed date
            sdtDate.DateDisplayFormat = "dd MMMM, yyyy";

            // Select how the data will be stored in the document
            sdtDate.DateStorageFormat = SdtDateStorageFormat.DateTime;

            // Set the calendar type that will be used to select and display the date
            sdtDate.CalendarType = SdtCalendarType.Hijri;

            // Before a date is chosen, the tag will display the text "Click here to enter a date."
            // We can set a default date to display by setting this variable
            // We must convert the date to the appropriate calendar ourselves
            sdtDate.FullDate = new DateTime(1440, 10, 20);

            // Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(sdtDate);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.Date.docx");
            //ExEnd
        }
#endif

        [Test]
        public void PlainText()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.Color
            //ExFor:StructuredDocumentTag.ContentsFont
            //ExFor:StructuredDocumentTag.EndCharacterFont
            //ExFor:StructuredDocumentTag.Id
            //ExFor:StructuredDocumentTag.Level
            //ExFor:StructuredDocumentTag.Multiline
            //ExFor:StructuredDocumentTag.Tag
            //ExFor:StructuredDocumentTag.Title
            //ExFor:StructuredDocumentTag.RemoveSelfOnly
            //ExSummary:Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.
            // Create a new document 
            Document doc = new Document();

            // Create a StructuredDocumentTag that will contain plain text
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // Set the title and color of the frame that appears when you mouse over it
            tag.Title = "My plain text";
            tag.Color = Color.Magenta;

            // Set a programmatic tag for this StructuredDocumentTag
            // Unlike the title, this value will not be visible in the document but will be programmatically obtainable
            // as an XML element named "tag", with the string below in its "@val" attribute
            tag.Tag = "MyPlainTextSDT";

            // Every StructuredDocumentTag gets a random unique ID
            Assert.That(tag.Id, Is.Positive);

            // Set the font for the text inside the StructuredDocumentTag
            tag.ContentsFont.Name = "Arial";

            // Set the font for the text at the end of the StructuredDocumentTag
            // Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
            tag.EndCharacterFont.Name = "Arial Black";

            // By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
            // When set to true, our StructuredDocumentTag can have multiple lines
            tag.Multiline = true;

            // Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(tag);

            // Insert a clone of our StructuredDocumentTag in a new paragraph
            StructuredDocumentTag tagClone = (StructuredDocumentTag)tag.Clone(true);
            builder.InsertParagraph();
            builder.InsertNode(tagClone);

            // We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
            tagClone.RemoveSelfOnly();

            doc.Save(ArtifactsDir + "StructuredDocumentTag.PlainText.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.PlainText.docx");
            tag = (StructuredDocumentTag)doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            Assert.AreEqual("My plain text", tag.Title);
            Assert.AreEqual(Color.Magenta.ToArgb(), tag.Color.ToArgb());
            Assert.AreEqual("MyPlainTextSDT", tag.Tag);
            Assert.That(tag.Id, Is.Positive);
            Assert.AreEqual("Arial", tag.ContentsFont.Name);
            Assert.AreEqual("Arial Black", tag.EndCharacterFont.Name);
            Assert.True(tag.Multiline);
        }

        [Test]
        public void IsTemporary()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.IsTemporary
            //ExSummary:Demonstrates the effects of making a StructuredDocumentTag temporary.
            Document doc = new Document();

            // Insert a plain text StructuredDocumentTag, which will prompt the user to enter text
            // and allow them to edit it like a text box
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // If we set its Temporary attribute to true, as soon as we start typing,
            // the tag will disappear and its contents will be assimilated into the parent Paragraph
            tag.IsTemporary = true;

            // Insert the StructuredDocumentTag with a DocumentBuilder
            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.Write("Temporary text box: ");
            builder.InsertNode(tag);

            // A StructuredDocumentTag in the form of a check box will let the user a square to check and uncheck
            // Setting it to temporary will freeze its value after the first time it is clicked
            tag = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            tag.IsTemporary = true;

            builder.Write("\nTemporary checkbox: ");
            builder.InsertNode(tag);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.IsTemporary.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.IsTemporary.docx");

            Assert.AreEqual(2, doc.GetChildNodes(NodeType.StructuredDocumentTag, true).Count(sdt => ((StructuredDocumentTag)sdt).IsTemporary));
        }

        [Test]
        public void PlaceholderBuildingBlock()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.IsShowingPlaceholderText
            //ExFor:StructuredDocumentTag.Placeholder
            //ExFor:StructuredDocumentTag.PlaceholderName
            //ExSummary:Shows how to use the contents of a BuildingBlock as a custom placeholder text for a StructuredDocumentTag. 
            Document doc = new Document();

            // Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
            // It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // We can substitute that default placeholder with a custom phrase, which will be drawn from a BuildingBlock
            // First we will need to create the BuildingBlock, give it content and add it to the GlossaryDocument
            GlossaryDocument glossaryDoc = doc.GlossaryDocument;

            BuildingBlock substituteBlock = new BuildingBlock(glossaryDoc);
            substituteBlock.Name = "Custom Placeholder";
            substituteBlock.AppendChild(new Section(glossaryDoc));
            substituteBlock.FirstSection.AppendChild(new Body(glossaryDoc));
            substituteBlock.FirstSection.Body.AppendParagraph("Custom placeholder text.");

            glossaryDoc.AppendChild(substituteBlock);

            // The substitute BuildingBlock we made can be referenced by name
            tag.PlaceholderName = "Custom Placeholder";

            // If PlaceholderName refers to an existing block in the parent document's GlossaryDocument,
            // the BuildingBlock will be automatically found and assigned to the Placeholder attribute
            Assert.AreEqual(substituteBlock, tag.Placeholder);

            // Setting this to true will register the text inside the StructuredDocumentTag as placeholder text
            // This means that, in Microsoft Word, all the text contents of the StructuredDocumentTag will be highlighted with one click,
            // so we can immediately replace the entire substitute text by typing
            // If this is false, the text will behave like an ordinary Paragraph and a cursor will be placed with nothing highlighted
            tag.IsShowingPlaceholderText = true;

            // Insert the StructuredDocumentTag into the document using a DocumentBuilder and save the document to a file
            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(tag);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.PlaceholderBuildingBlock.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.PlaceholderBuildingBlock.docx");
            tag = (StructuredDocumentTag)doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            substituteBlock = (BuildingBlock)doc.GlossaryDocument.GetChild(NodeType.BuildingBlock, 0, true);

            Assert.AreEqual("Custom Placeholder", substituteBlock.Name);
            Assert.True(tag.IsShowingPlaceholderText);
            Assert.AreEqual(substituteBlock, tag.Placeholder);
            Assert.AreEqual(substituteBlock.Name, tag.PlaceholderName);
        }


        internal void method_0(CustomXmlPartCollection A_0)
        {
            int num = 0x12;
            if ((A_0.Count > 0) && (this.DataBinding != null))
            {
                if (!this.RepeatingSection)
                {
                    XmlNode node = this.DataBinding.method_2(A_0);
                    if (node != null)
                    {
                        string str2 = this.method_6(node.InnerText);
                        this.method_4(this.Owner, str2);
                    }
                }
                else
                {
                    Regex regex = new Regex(BookmarkStart.b("搷愹ᐻ戽␿桁浃ᩅᕇ湉", num));
                    string input = this.DataBinding.method_13();
                    if (!regex.IsMatch(input))
                    {
                        DocumentObject owner = this.Owner.Owner;
                        XmlNodeList list = this.DataBinding.method_5(A_0, input);
                        if ((list != null) && (list.Count > 0))
                        {
                            if (list.Count > 1)
                            {
                                int num2 = 1;
                                int count = list.Count;
                                while (num2 < count)
                                {
                                    this.method_1(owner, list[num2], input, false);
                                    num2++;
                                }
                            }
                            this.method_1(owner, list[0], input, true);
                        }
                    }
                    regex = null;
                }
            }
        }

        private void method_1(DocumentObject A_0, XmlNode A_1, string A_2, bool A_3)
        {
            if ((A_0 != null) && (A_1 != null))
            {
                string str = this.method_3(A_1);
                if (!A_3)
                {
                    IStructureDocument entity = (this.Owner as IStructureDocument).Clone() as IStructureDocument;
                    entity.SDTProperties.DataBinding.method_1(str);
                    A_0.ChildObjects.Add(entity);
                    this.method_2(entity as DocumentObject, A_2, str);
                }
                else
                {
                    this.DataBinding.method_1(str);
                    this.method_2(this.Owner, A_2, str);
                }
            }
        }

        private void method_2(DocumentObject A_0, string A_1, string A_2)
        {
            int num = 0x11;
            if (A_0 != null)
            {
                for (int i = 0; i < A_0.ChildObjects.Count; i++)
                {
                    DocumentObject obj2 = A_0.ChildObjects[i];
                    if ((obj2 is IStructureDocument) && ((obj2 as IStructureDocument).SDTProperties.DataBinding != null))
                    {
                        string str2 = (obj2 as IStructureDocument).SDTProperties.DataBinding.method_13();
                        if (!string.IsNullOrEmpty(str2))
                        {
                            string str = string.Empty;
                            string str3 = str2.Substring(A_1.Length);
                            if (str3.StartsWith(BookmarkStart.b("氶", num)))
                            {
                                int index = str3.IndexOf(BookmarkStart.b("ᠶ", num));
                                string str4 = str3.Substring(index);
                                str = A_2 + str4;
                            }
                            else
                            {
                                str = str2.Replace(A_1, A_2);
                            }
                            (obj2 as IStructureDocument).SDTProperties.DataBinding.method_1(str);
                        }
                    }
                    if (obj2 is StructureDocumentTagInline)
                    {
                        (obj2 as StructureDocumentTagInline).IsUpdateDataBinding = false;
                    }
                    if (obj2.ChildObjects.Count > 0)
                    {
                        this.method_2(obj2, A_1, A_2);
                    }
                }
            }
        }

        private string method_3(XmlNode A_0)
        {
            int num = 6;
            if (A_0.NodeType == XmlNodeType.Attribute)
            {
                return string.Format(BookmarkStart.b("圫ḭ䴯ᴱ琳䴵ष䜹", num), this.method_3(((XmlAttribute) A_0).OwnerElement), A_0.Name);
            }
            if (A_0.ParentNode == null)
            {
                return "";
            }
            int num2 = 1;
            for (XmlNode node = A_0; node.PreviousSibling != null; node = node.PreviousSibling)
            {
                if (!(node.PreviousSibling.Name == node.Name))
                {
                    break;
                }
                num2++;
            }
            if (!string.IsNullOrEmpty(A_0.NamespaceURI))
            {
                return string.Format(BookmarkStart.b("圫ḭ䴯ᴱ伳ܵ䔷9䜻ఽ㴿᥁㽃畅㕇ᝉ", num), new object[] { this.method_3(A_0.ParentNode), this.DataBinding.method_10(A_0.NamespaceURI), A_0.Name, num2 });
            }
            return string.Format(BookmarkStart.b("圫ḭ䴯ᴱ伳ܵ䔷愹䜻ఽ㴿ὁ", num), this.method_3(A_0.ParentNode), A_0.Name, num2);
        }

        private void method_4(DocumentObject A_0, string A_1)
        {
            int num = 12;
            if (A_0 != null)
            {
                ParagraphBase base2 = null;
                switch (this.SDTType)
                {
                    case SdtType.Picture:
                    {
                        base2 = new DocPicture(A_0.Document);
                        byte[] imageBytes = Convert.FromBase64String(A_1.Replace(BookmarkStart.b("㠱", num), string.Empty).Replace(BookmarkStart.b("㤱", num), string.Empty).Replace(BookmarkStart.b("㼱", num), string.Empty));
                        (base2 as DocPicture).LoadImage(imageBytes);
                        break;
                    }
                    case SdtType.Text:
                    case SdtType.None:
                        base2 = new TextRange(A_0.Document);
                        (base2 as TextRange).Text = A_1;
                        break;

                    case SdtType.DatePicker:
                    {
                        DateTime time;
                        base2 = new TextRange(A_0.Document);
                        if (string.IsNullOrEmpty(A_1))
                        {
                            (base2 as TextRange).Text = A_1;
                            break;
                        }
                        string dateFormat = (this.ControlProperties as SdtDate).DateFormat;
                        CultureInfo provider = (this.ControlProperties as SdtDate).method_1();
                        if (!DateTime.TryParse(A_1, out time))
                        {
                            (base2 as TextRange).Text = A_1;
                            break;
                        }
                        A_1 = !string.IsNullOrEmpty(dateFormat) ? time.ToString(dateFormat, provider) : time.ToString();
                        (base2 as TextRange).Text = A_1;
                        break;
                    }
                }
                if (base2 != null)
                {
                    if (A_0 is StructureDocumentTag)
                    {
                        StructureDocumentTag tag = A_0 as StructureDocumentTag;
                        if (tag.ChildObjects.Count > 0)
                        {
                            Paragraph paragraph2 = tag.ChildObjects[0] as Paragraph;
                            this.method_5(paragraph2, base2);
                        }
                    }
                    else if (A_0 is StructureDocumentTagInline)
                    {
                        StructureDocumentTagInline inline = A_0 as StructureDocumentTagInline;
                        if (inline.ChildObjects.Count > 0)
                        {
                            base2.CharacterFormat.method_27((inline.ChildObjects[0] as ParagraphBase).CharacterFormat);
                            if (!this.IsDataBindingOfCoreProperties && base2.CharacterFormat.HasValue(9))
                            {
                                base2.CharacterFormat.Remove(9);
                            }
                        }
                        inline.ChildObjects.Clear();
                        inline.ChildObjects.Add(base2);
                    }
                    else if (!(A_0 is StructureDocumentTagRow) && (A_0 is StructureDocumentTagCell))
                    {
                        StructureDocumentTagCell cell = A_0 as StructureDocumentTagCell;
                        if (cell.ChildObjects.Count > 0)
                        {
                            Paragraph paragraph = cell.ChildObjects[0] as Paragraph;
                            this.method_5(paragraph, base2);
                        }
                    }
                }
            }
        }

        private void method_5(Paragraph A_0, ParagraphBase A_1)
        {
            if ((A_0 == null) || (A_1 == null))
            {
                return;
            }
            DocumentObject obj2 = A_0.ChildObjects.method_20(DocumentObjectType.TextRange);
            if (A_1 is DocPicture)
            {
                using (IEnumerator enumerator = A_0.ChildObjects.GetEnumerator())
                {
                    ParagraphBase current;
                    while (enumerator.MoveNext())
                    {
                        current = (ParagraphBase) enumerator.Current;
                        if (current is DocPicture)
                        {
                            goto Label_004F;
                        }
                    }
                    goto Label_00DB;
                Label_004F:
                    (current as DocPicture).method_88((A_1 as DocPicture).ImageBytes, true);
                    goto Label_00DB;
                }
            }
            if ((obj2 is TextRange) && (A_1 is TextRange))
            {
                TextRange entity = obj2.Clone() as TextRange;
                entity.Text = (A_1 as TextRange).Text;
                A_0.ChildObjects.Clear();
                A_0.ChildObjects.Add(entity);
            }
            else
            {
                A_0.ChildObjects.Clear();
                A_0.ChildObjects.Add(A_1);
            }
        Label_00DB:
            obj2 = null;
        }

        [Test]
        public void RepeatingSection()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.SdtType
            //ExSummary:Shows how to get the type of a structured document tag.
            Document doc = new Document(MyDir + "Structured document tags.docx");

            List<StructuredDocumentTag> sdTags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true).OfType<StructuredDocumentTag>().ToList();

            Assert.AreEqual(SdtType.RepeatingSection, sdTags[0].SdtType);
            Assert.AreEqual(SdtType.RepeatingSectionItem, sdTags[1].SdtType);
            Assert.AreEqual(SdtType.RichText, sdTags[2].SdtType);
            //ExEnd
        }

        [Test]
        public void ApplyStyle()
        {
            //ExStart
            //ExFor:StructuredDocumentTag
            //ExFor:StructuredDocumentTag.NodeType
            //ExFor:StructuredDocumentTag.Style
            //ExFor:StructuredDocumentTag.StyleName
            //ExFor:MarkupLevel
            //ExFor:SdtType
            //ExSummary:Shows how to work with styles for content control elements.
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Below are two ways to apply a style from the document to a structured document tag.
            // 1 -  Apply a style object from the document's style collection:
            Style quoteStyle = doc.Styles[StyleIdentifier.Quote];
            StructuredDocumentTag sdtPlainText = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);
            sdtPlainText.Style = quoteStyle;

            // 2 -  Reference a style in the document by name:
            StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Inline);
            sdtRichText.StyleName = "Quote";

            builder.InsertNode(sdtPlainText);
            builder.InsertNode(sdtRichText);

            Assert.AreEqual(NodeType.StructuredDocumentTag, sdtPlainText.NodeType);

            NodeCollection tags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);

            foreach (Node node in tags)
            {
                StructuredDocumentTag sdt = (StructuredDocumentTag)node;

                Assert.AreEqual(StyleIdentifier.Quote, sdt.Style.StyleIdentifier);
                Assert.AreEqual("Quote", sdt.StyleName);
            }
            //ExEnd
        }

        [Test]
        public void CheckBox()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.#ctor(DocumentBase, SdtType, MarkupLevel)
            //ExFor:StructuredDocumentTag.Checked
            //ExSummary:Show how to create a structured document tag in the form of a check box.
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            StructuredDocumentTag sdtCheckBox = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            sdtCheckBox.Checked = true;

            builder.InsertNode(sdtCheckBox);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.CheckBox.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.CheckBox.docx");

            StructuredDocumentTag[] sdts = doc.GetChildNodes(NodeType.StructuredDocumentTag, true).OfType<StructuredDocumentTag>().ToArray();

            Assert.AreEqual(true, sdts[0].Checked);
            Assert.That(sdts[0].XmlMapping.StoreItemId, Is.Empty);
        }

#if NET462 || NETCOREAPP2_1 || JAVA // because of a Xamarin bug with CultureInfo (https://xamarin.github.io/bugzilla-archives/59/59077/bug.html)
        [Test, Category("SkipMono")]
        public void Date()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.CalendarType
            //ExFor:StructuredDocumentTag.DateDisplayFormat
            //ExFor:StructuredDocumentTag.DateDisplayLocale
            //ExFor:StructuredDocumentTag.DateStorageFormat
            //ExFor:StructuredDocumentTag.FullDate
            //ExSummary:Shows how to prompt the user to enter a date with a structured document tag.
            Document doc = new Document();

            // Insert a structured document tag that prompts the user to enter a date.
            // In Microsoft Word, this element is known as a "Date picker content control".
            // When we click on the arrow on the right end of this tag in Microsoft Word,
            // we will see a pop up in the form of a clickable calendar.
            // We can use that popup to select a date that the tag will display.
            StructuredDocumentTag sdtDate = new StructuredDocumentTag(doc, SdtType.Date, MarkupLevel.Inline);

            // Display the date, according to the Saudi Arabian Arabic locale.
            sdtDate.DateDisplayLocale = CultureInfo.GetCultureInfo("ar-SA").LCID;

            // Set the format with which to display the date.
            sdtDate.DateDisplayFormat = "dd MMMM, yyyy";
            sdtDate.DateStorageFormat = SdtDateStorageFormat.DateTime;

            // Display the date according to the Hijri calendar.
            sdtDate.CalendarType = SdtCalendarType.Hijri;

            // Before the user chooses a date in Microsoft Word, the tag will display the text "Click here to enter a date.".
            // According to the tag's calendar, set the "FullDate" property to get the tag to display a default date.
            sdtDate.FullDate = new DateTime(1440, 10, 20);

            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(sdtDate);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.Date.docx");
            //ExEnd
        }
#endif

        [Test]
        public void PlainText()
        {
            //ExStart
            //ExFor:StructuredDocumentTag.Color
            //ExFor:StructuredDocumentTag.ContentsFont
            //ExFor:StructuredDocumentTag.EndCharacterFont
            //ExFor:StructuredDocumentTag.Id
            //ExFor:StructuredDocumentTag.Level
            //ExFor:StructuredDocumentTag.Multiline
            //ExFor:StructuredDocumentTag.Tag
            //ExFor:StructuredDocumentTag.Title
            //ExFor:StructuredDocumentTag.RemoveSelfOnly
            //ExSummary:Shows how to create a structured document tag in a plain text box and modify its appearance.
            Document doc = new Document();

            // Create a structured document tag that will contain plain text.
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // Set the title and color of the frame that appears when you mouse over the structured document tag in Microsoft Word.
            tag.Title = "My plain text";
            tag.Color = Color.Magenta;

            // Set a tag for this structured document tag, which is obtainable
            // as an XML element named "tag", with the string below in its "@val" attribute.
            tag.Tag = "MyPlainTextSDT";

            // Every structured document tag has a random unique ID.
            Assert.That(tag.Id, Is.Positive);

            // Set the font for the text inside the structured document tag.
            tag.ContentsFont.Name = "Arial";

            // Set the font for the text at the end of the structured document tag.
            // Any text that we type in the document body after moving out of the tag with arrow keys will use this font.
            tag.EndCharacterFont.Name = "Arial Black";

            // By default, this is false and pressing enter while inside a structured document tag does nothing.
            // When set to true, our structured document tag can have multiple lines.

            // Set the "Multiline" property to "false" to only allow the contents
            // of this structured document tag to span a single line.
            // Set the "Multiline" property to "true" to allow the tag to contain multiple lines of content.
            tag.Multiline = true;

            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(tag);

            // Insert a clone of our structured document tag in a new paragraph.
            StructuredDocumentTag tagClone = (StructuredDocumentTag)tag.Clone(true);
            builder.InsertParagraph();
            builder.InsertNode(tagClone);

            // Use the "RemoveSelfOnly" method to remove a structured document tag, while keeping its contents in the document.
            tagClone.RemoveSelfOnly();

            doc.Save(ArtifactsDir + "StructuredDocumentTag.PlainText.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.PlainText.docx");
            tag = (StructuredDocumentTag)doc.GetChild(NodeType.StructuredDocumentTag, 0, true);

            Assert.AreEqual("My plain text", tag.Title);
            Assert.AreEqual(Color.Magenta.ToArgb(), tag.Color.ToArgb());
            Assert.AreEqual("MyPlainTextSDT", tag.Tag);
            Assert.That(tag.Id, Is.Positive);
            Assert.AreEqual("Arial", tag.ContentsFont.Name);
            Assert.AreEqual("Arial Black", tag.EndCharacterFont.Name);
            Assert.True(tag.Multiline);
        }

        [TestCase(false)]
        [TestCase(true)]
        public void IsTemporary(bool isTemporary)
        {
            //ExStart
            //ExFor:StructuredDocumentTag.IsTemporary
            //ExSummary:Shows how to make single-use controls.
            Document doc = new Document();

            // Insert a plain text structured document tag,
            // which will act as a plain text form that the user may enter text into.
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // Set the "IsTemporary" property to "true" to make the structured document tag disappear and
            // assimilate its contents into the document after the user edits it once in Microsoft Word.
            // Set the "IsTemporary" property to "false" to allow the user to edit the contents
            // of the structured document tag any number of times.
            tag.IsTemporary = isTemporary;

            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.Write("Please enter text: ");
            builder.InsertNode(tag);

            // Insert another structured document tag in the form of a check box and set its default state to "checked".
            tag = new StructuredDocumentTag(doc, SdtType.Checkbox, MarkupLevel.Inline);
            tag.Checked = true;

            // Set the "IsTemporary" property to "true" to make the check box become a symbol
            // once the user clicks on it in Microsoft Word.
            // Set the "IsTemporary" property to "false" to allow the user to click on the check box any number of times.
            tag.IsTemporary = isTemporary;

            builder.Write("\nPlease click the check box: ");
            builder.InsertNode(tag);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.IsTemporary.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.IsTemporary.docx");

            Assert.AreEqual(2, 
                doc.GetChildNodes(NodeType.StructuredDocumentTag, true).Count(sdt => ((StructuredDocumentTag)sdt).IsTemporary == isTemporary));
        }

        [TestCase(false)]
        [TestCase(true)]
        public void PlaceholderBuildingBlock(bool isShowingPlaceholderText)
        {
            //ExStart
            //ExFor:StructuredDocumentTag.IsShowingPlaceholderText
            //ExFor:StructuredDocumentTag.Placeholder
            //ExFor:StructuredDocumentTag.PlaceholderName
            //ExSummary:Shows how to use a building block's contents as a custom placeholder text for a structured document tag. 
            Document doc = new Document();

            // Insert a plain text structured document tag of the "PlainText" type, which will function as a text box.
            // The contents that it will display by default are a "Click here to enter text." prompt.
            StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

            // We can get the tag to display the contents of a building block instead of the default text.
            // First, add a building block with contents to the glossary document.
            GlossaryDocument glossaryDoc = doc.GlossaryDocument;

            BuildingBlock substituteBlock = new BuildingBlock(glossaryDoc);
            substituteBlock.Name = "Custom Placeholder";
            substituteBlock.AppendChild(new Section(glossaryDoc));
            substituteBlock.FirstSection.AppendChild(new Body(glossaryDoc));
            substituteBlock.FirstSection.Body.AppendParagraph("Custom placeholder text.");

            glossaryDoc.AppendChild(substituteBlock);

            // Then, use the structured document tag's "PlaceholderName" property to reference that building block by name.
            tag.PlaceholderName = "Custom Placeholder";

            // If "PlaceholderName" refers to an existing block in the parent document's glossary document,
            // we will be able to verify the building block via the "Placeholder" property.
            Assert.AreEqual(substituteBlock, tag.Placeholder);

            // Set the "IsShowingPlaceholderText" property to "true" to treat the
            // structured document tag's current contents as placeholder text.
            // This means that clicking on the text box in Microsoft Word will immediately highlight all the tag's contents.
            // Set the "IsShowingPlaceholderText" property to "false" to get the
            // structured document tag to treat its contents as text that a user has already entered.
            // Clicking on this text in Microsoft Word will place the blinking cursor at the clicked location.
            tag.IsShowingPlaceholderText = isShowingPlaceholderText;

            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.InsertNode(tag);

            doc.Save(ArtifactsDir + "StructuredDocumentTag.PlaceholderBuildingBlock.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "StructuredDocumentTag.PlaceholderBuildingBlock.docx");
            tag = (StructuredDocumentTag)doc.GetChild(NodeType.StructuredDocumentTag, 0, true);
            substituteBlock = (BuildingBlock)doc.GlossaryDocument.GetChild(NodeType.BuildingBlock, 0, true);

            Assert.AreEqual("Custom Placeholder", substituteBlock.Name);
            Assert.AreEqual(isShowingPlaceholderText, tag.IsShowingPlaceholderText);
            Assert.AreEqual(substituteBlock, tag.Placeholder);
            Assert.AreEqual(substituteBlock.Name, tag.PlaceholderName);
        }

Spire.Doc.Documents.SdtCheckBox : SdtControlProperties

Fields :

public static Char DefaultCheckedState
public static Char DefaultUncheckedState
public static String DefaultFontName

Constructors :

public SdtCheckBox()

Methods :

public Boolean get_Checked()
public Void set_Checked(Boolean value = )
public String get_CheckedStateFontName()
public Void set_CheckedStateFontName(String value = )
public Int32 get_CheckedStateCharacterCode()
public Void set_CheckedStateCharacterCode(Int32 value = )
public String get_UnCheckedStateFontName()
public Void set_UnCheckedStateFontName(String value = )
public Int32 get_UnCheckedStateCharacterCode()
public Void set_UnCheckedStateCharacterCode(Int32 value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()