Structure of docx field
A field in docx is represented this way.
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
AAA
<w:r>
<w:instrText xml:space="preserve"> NOTEREF _Ref111111 \h </w:instrText>
</w:r>
BBB
<w:r>
<w:fldChar w:fldCharType="separate"/开发者_如何转开发>
</w:r>
CONTENT
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
The field content goes to the CONTENT placeholder. My question is: can anything go to AAA or BBB? Or they are always empty? I suspect the creators of this format had something in mind to have four separator elements instead of just two, but I haven't seen any examples of using this.
It's better to think of it as only three separator elements and two slots for content, which can be complex thanks to the separators.
<w:r><w:fldChar w:fldCharType="begin"/></w:r>
LABEL
<w:r><w:fldChar w:fldCharType="separate"/></w:r>
VALUE
<w:r><w:fldChar w:fldCharType="end"/></w:r>
So your AAA and BBB are just extra content for the LABEL.
There's an example in the spec, where LABEL is:
<w:r><w:rPr><w:b/><w:color w:val="ED1C24"/><w:u w:val="single"/></w:rPr>
<w:instrText>D</w:instrText></w:r>
<w:r><w:instrText xml:space="preserve">ATE</w:instrText></w:r>
to make the D in DATE a different style.
精彩评论