How do you map boolean to Word checkbox content control?

May 20, 2013 at 1:58 AM
It's been driving me batty. ColumnMapping from a Lightswitch app works as advertised with plaintext, date, image, and richtext contentcontrols ... but not with Word checkbox content controls. The data is a True/False boolean data type (have also tried 1/2 yes/no, etc) but all throw an error ("You are not allowed to edit this selection because it is protected") that implies a protected control but the control and the document are absolutely unprotected.

Given that tumbleweeds often roll through these forums, I'm likely hoping against hope that I'll get an answer, but it's gotta be worth a try. :)
Jun 26, 2013 at 3:02 AM
Still looking for an answer ...
Jul 15, 2013 at 10:12 AM
Any luck with this? I have just gotten to the stage where I need to tackle this exact problem.
Jul 15, 2013 at 12:22 PM
AlexF1980 wrote:
Any luck with this? I have just gotten to the stage where I need to tackle this exact problem.
Here's a solution that works for me:
dynamic _word = AutomationFactory.GetObject("Word.Application");
            var _doc = _word.ActiveDocument;
            //checkboxes:
            if (this.DandDProperty.ProtoTypeProduced == true)
            {
                dynamic ccs = _doc.SelectContentControlsByTitle("PrototypeProducedYes");
                if (ccs != null)
                {
                    dynamic cc = ccs[1];
                    cc.Checked = true;
                }
            }
            else
            {
                dynamic ccs = _doc.SelectContentControlsByTitle("PrototypeProducedNo");
                if (ccs != null)
                {
                    dynamic cc = ccs[1];
                    cc.Checked = true;
                }
            }
:-)
Jul 16, 2013 at 10:25 PM
Hi Alex,

Thanks for posting a helpful solution to the problem. I wound up using a similar approach once it became obvious that the OIP didn't work with checkbox controls as expected. Hope that someone will resolve this in a future release. Thought of digging into the OIP source code to implement this but quickly realized that it's over my head.