none
tallies and percents for checkboxes RRS feed

  • Question

  • I was given some completed forms that have checkboxes that were created in Word Developer. There are two columns of checkboxes one for "Yes" and one for "No". I was asked to provide a percentage of yes responses. Is there a way I can do this with code without having to add up the checkboxes for each document manually? 

    Wednesday, June 1, 2011 6:09 PM

Answers

  • <<The only programming language I have used is with statistical packages (ie SAS, STATA), but I took a look at vbscript, and I think I can figure that out. Will that work>>

    Given the difference with the Office version, and since you're not going to be interacting with any users, I don't think you should attempt "interop" (automation).

    The way I envision it, I think your best bet would be a Visual Studio .NET language, such as VB.NET or C#, possibly in combination with the Open XML SDK for Office 2010. That should let you access the relevant information fairly efficiently - without needing to even have the Office application(s) installed on the machine.

    OpenXMLDeveloper.org is where you should find "intro" information and the Open XML SDK forum on MSDN is where you'd go for assistance.


    Cindy Meister, VSTO/Word MVP
    Friday, June 3, 2011 3:31 PM
    Moderator

All replies

  • What kind of checkboxes are they? Content Control or Form Field? I'm guessing they're not ActiveX. Also what version of Word and the coding language you'd be using?
    Kind Regards, Rich ... http://greatcirclelearning.com
    Wednesday, June 1, 2011 10:18 PM
  • I have never worked with Word this way before, so I am not sure. I think the checkboxes are Content Control, but I am not sure how to check. This is Word 2007. As far as programming, could I use visual basic? I haven't used it before, so any instruction is much appreciated.  Thanks so much for your help.
    Thursday, June 2, 2011 12:39 PM
  • If this is Word 2007 then the checkboxes are either ActiveX or Form fields. Checkboxes as content controls were introduced in Word 2010...

    If you press Alt+F9 to toggle-on the field codes, what do you see where the checkboxes should be?


    Cindy Meister, VSTO/Word MVP
    Thursday, June 2, 2011 3:10 PM
    Moderator
  • The forms were created in Word 2010, but I am working on Word 2007. Is this going to be a problem? Nothing happens when I press Alt+F9.
    Thursday, June 2, 2011 7:23 PM
  • <<The forms were created in Word 2010, but I am working on Word 2007. Is this going to be a problem? Nothing happens when I press Alt+F9. >>

    It could be a problem, yes.

    So, when you click on this checkbox in Word 2007, do you see the usual "content control frame" around it? If yes, then this was, indeed a Word 2010 checkbox content control. But Word 2007 can't work with that, so it's been changed into a static symbol: Unicode hex 2610, MS Gothic font if it's unchecked, 2612 if it's checked. Perhaps you can use that to do the analysis you require...

    But note that, if the document is saved again in Word 2007 the checkbox functionality will be gone completely.

    The other possibility would be to not open the document at all in Word 2007, but to analyze the Word Open XML (the document.xml file within the docx "zip package").

    Which programming language do you favor, and what's supposed to happen with the percentages you glean from the information in the document?


    Cindy Meister, VSTO/Word MVP
    Friday, June 3, 2011 8:41 AM
    Moderator
  • I do see a frame around the checkbox when I click on it. I will be creating averaging the percents over time and creating bar graphs in excel or SAS when I get the percentages. The only programming language I have used is with statistical packages (ie SAS, STATA), but I took a look at vbscript, and I think I can figure that out. Will that work?

    Thank you


    l_and_j
    Friday, June 3, 2011 1:09 PM
  • <<The only programming language I have used is with statistical packages (ie SAS, STATA), but I took a look at vbscript, and I think I can figure that out. Will that work>>

    Given the difference with the Office version, and since you're not going to be interacting with any users, I don't think you should attempt "interop" (automation).

    The way I envision it, I think your best bet would be a Visual Studio .NET language, such as VB.NET or C#, possibly in combination with the Open XML SDK for Office 2010. That should let you access the relevant information fairly efficiently - without needing to even have the Office application(s) installed on the machine.

    OpenXMLDeveloper.org is where you should find "intro" information and the Open XML SDK forum on MSDN is where you'd go for assistance.


    Cindy Meister, VSTO/Word MVP
    Friday, June 3, 2011 3:31 PM
    Moderator