6 putdocx paragraph — Add text or images to an Office Open XML (.docx) file
hyperlink(link) adds the text as a hyperlink to the webpage address specified in link.
bookmark(bmname) adds the text as a bookmark named bmname. You can link to this book-
mark from other text within a paragraph or from an expression in a table cell by using the
bookmarklink(bmname) option.
bookmarklink(bmname) adds the text as a link to the bookmark named bmname. Note that bookmark
links can point only to bookmarks in the current document. Additionally, these links cannot point
to bookmarks in documents to which you will be appending.
trim removes the leading and trailing spaces in the text.
Options for putdocx textblock begin
style(pstyle) specifies that the text in the paragraphs be formatted with style pstyle. Common values
for pstyle are Title, Subtitle, and Heading1. See the complete list of paragraph styles in
Paragraph styles of [RPT] Appendix for putdocx.
font(fontname
, size
, color
) sets the font, font size, and font color for the text within the
paragraphs. The font size and font color may be specified individually without specifying fontname.
Use font("", size) to specify font size only. Use font("", "", color) to specify font color
only. For both cases, the default font will be used.
Specifying font() with putdocx textblock begin overrides font properties specified with
putdocx begin.
halign(hvalue) sets the horizontal alignment of the text within the paragraphs. hvalue may be left,
right, center, both, or distribute. distribute and both justify text between the left and
right margins equally, but distribute also changes the spacing between words and characters.
The default is halign(left).
valign(vvalue) sets the vertical alignment of the characters on each line when the paragraphs contain
characters of varying size. vvalue may be auto, baseline, bottom, center, or top. The default
is valign(baseline).
indent(indenttype, #
unit
) specifies that the paragraphs be indented by # units. indenttype may
be left, right, hanging, or para. left and right indent # units from the left or the right,
respectively. hanging uses hanging indentation and indents lines after the first line by # inches
unless another unit is specified. para uses standard paragraph indentation and indents the first
line by # inches unless another unit is specified. This option may be specified multiple times in
a single command to accommodate different indentation settings. If both indent(hanging) and
indent(para) are specified, only indent(hanging) is used.
spacing(position, #
unit
) sets the spacing between lines of text. position may be before, after,
or line. before specifies the space before the first line of each paragraph in the text block, after
specifies the space after the last line of each paragraph, and line specifies the space between
lines within each paragraph. This option may be specified multiple times in a single command to
accommodate different spacing settings.
shading(bgcolor
, fgcolor
, fpattern
) sets the background color, foreground color, and fill
pattern for the paragraphs.
toheader(hname) specifies that the first paragraph in a text block be added to the header hname.
The first paragraph will not be added to the body of the document.
When you specify the paramode option with toheader(), all paragraphs after the first will be
added to the body of the document, not the header.