javaxmldocx4j

How to remove "Click here to enter text" for empty contents in docx4j


I am using docx4j 3.1.0 to convert data from xml into word. If there's no content (null) in one field, then it will generate "Click here to enter text" in the exported file. How can I get rid of it?


Solution

  • You can add a file OpenDoPE/placeholder.xml to your classpath, containing for example:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <w:r xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
      <w:rPr>
        <w:rStyle w:val="PlaceholderText"/>
      </w:rPr>
      <w:t> </w:t>
    </w:r>