Search code examples
ms-worddocxdocx4j

set case of content bound via content controls in docx


I have a docx file that contains a custom part and a web page that collects input from the user to populate that custom part. One of my "variables" is used multiple times in the document. In some cases, I need it to appear in ALL CAPS. In most cases, it should appear as the user entered it in the web form. We're using docx4j version 3.2.1.

Previously we used "mail merge" fields which allowed for instructions like /* UPPER */ and /* CAPS */.

is there a way to get that same behavior using content controls?


Solution

  • You should be able to set the rPr property on a plain text content control to include:

    http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/caps.html

    Failing that, its not elegant, but you could always include a second element in your XML with the caps form.