Is there a validation hook in POIXMLDocument that will allow a document to
validate itself before it writes itself to disk? Here is the use case. An
XWPFDocument header or footer must contain at least an empty paragraph. If
a header or footer is created without a paragraph, this hook would let me
determine this, and just put one in there rather than generating a corrupt
document. I also know that this requirement exists for table cells as well.
I would like this to happen automatically on doc.save(). Currently the XWPF
API just puts an empty paragraph inall newly created table cells (and
headers and footers, though I am removing that). Presumable to avoid
generating an invalid document. This causes extra work when the first
element should be something other than a paragraph, and also requires the
user code around the existence of that initial blank paragraph when
creating a document from scratch when they should be able to always add
elements to newly created constructs. My thought is that creating documents
should be simple and surprise free to new users. If I am adding a header, I
have to add a paragraph, and then text.

Reply via email to