How to know whether a checkbox is checked or not using SDK RRS feed

  • Question

  • As title. I can get the checkbox control and its name but can't find the value anywhere.
    Wednesday, May 24, 2017 9:37 AM

All replies

  • Hello,

    If you insert a form control, we could use the folowing code to check or unchecked the control.

    using W14 = DocumentFormat.OpenXml.Office2010.Word;
    W14.SdtContentCheckBox sdtContentCheckBox1=sdtProperties1.GetFirstChild<W14.SdtContentCheckBox>();
    W14.Checked checked1=sdtContentCheckBox1.GetFirstChild<W14.Checked>();
    checked1.Val = W14.OnOffValues.Zero; //unchecked
    // checked1.Val =W14.OnOffValues.One //checked

    If you are inserting an ActiveX checkbox, unfortunately, we are unable to get its value.

    I would suggest you download Open XML SDK Tool to compare files and generate code.

    You could find if it is a form control, there is value property:

    If it is an ActiveX conrtol, after checking or unchecking, the control is changed into a different shape.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, May 25, 2017 6:09 AM