Click or drag to resize

DocumentAddFormFieldText Method

Add a form field of type text at selection

Namespace:  SOWIDocument.Word
Assembly:  SOWIDocument.Word (in SOWIDocument.Word.dll) Version: 22.2.10.1 (22.2.10.450)
Syntax
internal OpenXmlElement AddFormFieldText(
	ref OpenXmlElement pSelection,
	string pName = "",
	string pStyle = "",
	bool pNewParagraph = false
)

Parameters

pSelection
Type: OpenXmlElement
Document selection to insert form field
pName (Optional)
Type: SystemString
Form field name and bookmark name
pStyle (Optional)
Type: SystemString
Style name must exist in document
pNewParagraph (Optional)
Type: SystemBoolean
Insert a new paragraph after selection

Return Value

Type: OpenXmlElement
Gives a selection or a paragraph (on parameter pNewParagraph)
Remarks
Open Format XML example with name
<w:r>
  <w:fldChar w:fldCharType="begin">
    <w:ffData>
      <w:name w:val="TestFieldNameX" />
      <w:enabled />
      <w:calcOnExit w:val="false" />
      <w:textInput />
    </w:ffData>
  </w:fldChar>
</w:r>
<w:bookmarkStart w:name="TestFieldNameX" w:id="2053235388" />
<w:r>
  <w:instrText xml:space="preserve"> FORMTEXT </w:instrText>
</w:r>
<w:r>
  <w:fldChar w:fldCharType="separate" />
</w:r>
<w:r>
  <w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
  <w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
  <w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
  <w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
  <w:fldChar w:fldCharType="end" />
</w:r>
<w:bookmarkEnd w:id="2053235388" />
See Also