Posts Tagged “form fields”

As described in earlier posts, Word 2007 and Word 2010 don’t properly save number formats to number-type form fields. So I decided to try my hand at my first serious manipulation of Office Open XML files. As I felt more comfortable with old-fashioned XML coding, the tool presented in that post only leveraged the Open XML SDK for opening the file “package” and obtaining the required Part from the package.

Once it was clear that my approach did work, it was time to see if I could do the same using the full capabilities of the Open XML SDK. Read the rest of this entry »

Comments No Comments »

Having overcome the obstacle mentioned in my last post, I continued work on a small tool to manage the number formatting of number form fields in Word documents. While becoming acquainted with the principles of Open XML I’ve always felt there are too few samples demonstrating how to work with the various Office applications. So I plan to share some of my code in this blog. Read the rest of this entry »

Comments No Comments »

One of the most frustrating things for Word power users and developers is the accumulation of “bugs” in the product. If a problem is not caught early in the beta stage, it’s often around to stay. When pressed, the product team will often say that changing “expected behavior” will break backwards compatibility. Another reason we hear is that available resources are being used to “improve the product” (add new things). So when someone discovers a bug has actually been fixed, it’s a reason to ring the bells!

A few days ago a colleague asked me to check whether there really is no work-around for a problem that cropped up when Word moved from the binary *.doc to the Open XML *.docx file format in Word 2007. When a file containing form fields is saved as a template in Word 2007 and in Word 2010 any Number Formatting applied to a textbox form field is lost.

Before confirming the issue, I decided to test it in Word 2013, even though I was pessimistic, given Microsoft’s track record. But lo and behold: The problem has been fixed! Templates saved in Word 2013 retain the number formatting. What’s more, when used in Word 2007 and Word 2010, the templates function as they should.

So not only is a bug fixed, but at the same time a work-around for the problem in Word 2007 and Word 2010 is now available.

Technical details:
The problem can be seen and even corrected in the Word Open XML file. Locate a form field by searching in document.xml for the element (denotes a textbox form field). Below that look for the child element . If there is no child element then you’ve found a potential problem spot. Here’s a sample of correct Open XML for a form field with a number format:

  <w:type w:val=”number” />
  <w:format w:val=”#’##0.00″ />

Comments No Comments »