JSON API - addText

addText

PREMIUM TRIAL / ADVANCED

Inserts a paragraph.

Note

You are reading the JSON API documentation. For the PHP API method please go to addText.

JSON data
Key Description
text The text (if a string or an array) or a WordFragment (if an array) to be inserted.
bold If true the text will be shown in bold characters.
caps If true displays text in capital letters.
characterBorder Adds a border to the character. Keys and values: 'type' => none, single, double, dashed..., 'color' => ffffff, ff0000, 'spacing'=> 0, 1, 2..., 'width' => in eights of a point.
color Hexadecimal color value: 'FF0000', '000000'...
columnBreak Inserts a column break.
Possible values are: before, after or both.
doubleStrikeThrough If true displays text in doubleStrikeThrough.
em Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot'.
emboss Emboss style.
font
string type: font family: "Arial", "Calibri"...

object type:
  • ascii
  • hAnsi
  • eastAsia
  • cs
fontSize Font size in points.
highlightColor Highlights the run of text.
The available colors are: black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray, none.
italic If true displays the text in italics.
lang Lang options: val, eastAsia and bidi keys.
lineBreak Inserts a line break. Possible values are: before, after or both.
noProof Ignore spelling and grammar errors.
outline Outline style.
position Position value. Positive value for raised and negative value for lowered.
rStyle Character style to be used.
rtl Sets to true for right to left languages like Hebrew or Arabic.
scaling Scaling value, 100 is the default value.
shadow Shadow style.
smallCaps If true displays text in small capital letters.
spaces Number of additional leading empty spaces before the current run of text.
spacing Character spacing, positive value for expanded and negative value for condensed.
strikeThrough If true displays text in strikethrough.
subscript If true displays text in subscript.
superscript If true displays text in superscript.
tab Inserts a tab.
underline Underlines text. Possible values are: single, words, double, dotted, dash and wave.
underlineColor Underlines text with a color: 'FF0000', '000000'...
vanish Uses a vanish style.

optionsParagraph

Key Description
pStyle Paragraph style to be used.
backgroundColor Hexadecimal color value: FF0000, 000000...
bidi Sets to true for right to left languages like Hebrew or Arabic.
bold If true the text will be shown in bold characters.
border Available values are:
  • none (default)
  • double
  • dashed
  • outset
  • inset
  • threeDEmboss
  • threeDEngrave
  • ...
borderBottom Overwrites the general border type for the bottom border of the paragraph.
borderLeft Overwrites the general border type for the left border of the paragraph.
borderTop Overwrites the general border type for the top border of the paragraph.
borderRight Overwrites the general border type for the right border of the paragraph.
borderColor Hexadecimal color value: FF0000, 000000...
borderBottomColor Overwrites the general border color for the bottom border of the paragraph.
borderLeftColor Overwrites the general border color for the left border of the paragraph.
borderTopColor Overwrites the general border color for the top border of the paragraph.
borderRightColor Overwrites the general border color for the right border of the paragraph.
borderSpacing Separation between border and text in points.
borderBottomSpacing Overwrites the general border spacing for the bottom border of the paragraph.
borderLeftSpacing Overwrites the general border spacing for the left border of the paragraph.
borderTopSpacing Overwrites the general border spacing for the top border of the paragraph.
borderRightSpacing Overwrites the general border spacing for the right border of the paragraph.
borderWidth Border width in eigths of a point.
borderBottomWidth Overwrites the general border width for the bottom border of the paragraph.
borderLeftWidth Overwrites the general border width for the left border of the paragraph.
borderTopWidth Overwrites the general border width for the top border of the paragraph.
borderRightWidth Overwrites the general border width for the right border of the paragraph.
caps If true displays text in capital letters.
color Hexadecimal color value: 'FF0000', '000000'...
contextualSpacing If true ignores spacing above and below the paragraph whenever the neighbouring paragraphs use the same Word style (false by default).
doubleStrikeThrough If true displays text in doubleStrikeThrough.
em Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot'.
emboss Emboss style.
firstLineIndent First line indentation in twentieths of a point (twips).
font Font family: 'Arial', Calibri'...
fontSize Font size in points.
framePr
  • "anchorLock": lock frame anchor to paragraph
  • "dropCap": drop, margin, none
  • "h": frame height (twips)
  • "hAnchor": margin, page, text
  • "hRule": atLeast, auto, exact
  • "hSpace": horizontal frame padding (twips)
  • "lines": drop cap vertical height in lines
  • "vAnchor": margin, page, text
  • "vSpace": vertical frame padding (twips)
  • "w": frame width (twips)
  • "wrap": around, auto, none, notBeside, through, tight
  • "x": absolute horizontal position (twips)
  • "xAlign": center, inside, left, outside, right
  • "y": absolute vertical position (twips)
  • "yAlign": bottom, center, inline, inside, outside, top
hanging Paragraph hanging in twentieths of a point (twips).
headingLevel The heading level if you want this paragraph to be a heading.
italic If true displays the text in italics.
indentLeft Left margin in points.
indentRight Right margin in points.
keepLines Keeps (whenever possible) all the current paragraph lines on the same page.
keepNext Keeps (whenever possible) in the same page the current paragraph with next paragraph.
lineSpacing 120, 240 (standard), 360, 480... (in twentieths of a point).
noProof Ignore spelling and grammar errors.
outline Outline style.
pageBreakBefore If true forces a page break before the paragraph.
parseLineBreaks If true (default is false) parses the line breaks to include them in the Word document.
parseTabs If true (default is false) parses the tabs to include them in the Word document as w:tab tags.
position Position value. Positive value for raised and negative value for lowered.
rtl Sets to true for right to left languages like Hebrew or Arabic.
scaling Scaling value, 100 is the default value.
shadow Shadow style.
smallCaps If true displays text in small capital letters.
spacingBottom Bottom padding in twentieths of a point.
spacingTop Top padding in twentieths of a point.
strikeThrough If true displays text in strikethrough.
suppressAutoHyphens Suppress hyphenation.
suppressLineNumbers Suppress line numbers.
tabPositions
  • "type" can be clear, left (default), center, right, decimal, bar and num.
  • "leader" can be none (default), dot, hyphen, underscore, heavy and middleDot.
  • "position" given in twentieths of a point.
If there is a tab and the tabPositions array is not defined the standard tab position (default of 708) will be used.
textAlign Text alignment within paragraph. Possible values are: left, center, right, both and distribute.
textDirection Text flow direction within a table cell. Possible values are: lrTb, tbRl, btLr, lrTbV, tbRlV and tbLrV.
underline Underlines text. Possible values are: single, words, double, dotted, dash and wave.
underlineColor Underlines text with a color: 'FF0000', '000000'...
vanish Uses a vanish style.
widowControl Prevents Word from printing the last line of a paragraph by itself at the top of the page (widow) or the first line of a paragraph at the bottom of a page (orphan).
wordWrap Allows line breaking at character level (default value is false).
Code samples

Example #1

Example #2

Example #3

Release notes
  • phpdocx 18.0:
    • new action.