addStructuredDocumentTag
- addBibliography
- addBookmark
- addBreak
- addCaption
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addIndex
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addRuby
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableAuthorities
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- markEntry
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- importTheme
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
addStructuredDocumentTag
TRIAL / ADVANCED / PREMIUM
Inserts different types of Structured Document Tags into the Word document.
Description
public addStructuredDocumentTag (string $type [, array $options ] )
This method allows to insert structured document tags (sdt) of various kinds into the Word document:
- checkboxes
- combo boxes
- date pickers
- dropdown lists
- rich text
- text
Parameters
type
Possible values are:
- checkbox
- comboBox
- date
- dropdownList
- richText
- text
For a detailed description of the available date formats for the date picker structured document tag, please, check the documentation of the addDateAndHour method.
options
Specific options for structured document tags:
| Key | Type | Description |
|---|---|---|
| alias | string | The label that will be shown in the structured document tag. |
| calendar | string | Calendar type. Default type is gregorian. Possible values include: gregorian, hijri, hebrew, taiwan, japan, thai, korea, saka, gregorianXlitEnglish, gregorianXlitFrench. |
| checked | bool | Set checkboxes as checked or unchecked. |
| checkedState | array |
|
| dateFormat | string | The default date format is M/d/yyyy. See addDateAndHour for available date formats. |
| listItems | array | An array of arrays each one of them containing the text to show and value. |
| local | string | ISO code. The default value is en-US. |
| lock | string | Locking properties:
|
| placeholderText | string | Text to be shown by default. |
| sym | array | Custom symbol used with checkbox. Use with checkedState and uncheckedState options.
|
| tag | string | A programmatic tag. |
| temporary | bool | If true the structured tag is removed after editing. |
| uncheckedState | array |
|
Specific run-of-text styles:
| Key | Type | Description |
|---|---|---|
| bold | bool | If true the text will be shown in bold characters. |
| characterBorder | array |
Adds a border to the character
|
| color | string | Hexadecimal color value: 'FF0000', '000000'... |
| font | string |
string type: font family: 'Arial', Calibri'...
|
| fontSize | int | Text size in half-points: 8, 9, 10... Multiply by 2 to get the same size as using the fontSize property with addText and other methods. |
| italic | bool | If true displays the text in italics. |
| rStyle | string | Character style. |
| underline | string | Underlines text. Possible values are: 'single', 'words', 'double', 'dotted', 'dash' and 'wave'. |
The possible keys and values are:
| Key | Type | Description |
|---|---|---|
| pStyle | string | Paragraph style to be used. |
| backgroundColor | string | Hexadecimal color value: FF0000, 000000... |
| bidi | bool | Sets to true for right to left languages like Hebrew or Arabic. |
| bold | bool | If true the text will be shown in bold characters. |
| border | string | Available values are:
|
| borderBottom | string | Overwrites the general border type for the bottom border of the paragraph. |
| borderLeft | string | Overwrites the general border type for the left border of the paragraph. |
| borderTop | string | Overwrites the general border type for the top border of the paragraph. |
| borderRight | string | Overwrites the general border type for the right border of the paragraph. |
| borderColor | string | Hexadecimal color value: FF0000, 000000... |
| borderBottomColor | string | Overwrites the general border color for the bottom border of the paragraph. |
| borderLeftColor | string | Overwrites the general border color for the left border of the paragraph. |
| borderTopColor | string | Overwrites the general border color for the top border of the paragraph. |
| borderRightColor | string | Overwrites the general border color for the right border of the paragraph. |
| borderSpacing | int | Separation between border and text in points. |
| borderBottomSpacing | int | Overwrites the general border spacing for the bottom border of the paragraph. |
| borderLeftSpacing | int | Overwrites the general border spacing for the left border of the paragraph. |
| borderTopSpacing | int | Overwrites the general border spacing for the top border of the paragraph. |
| borderRightSpacing | int | Overwrites the general border spacing for the right border of the paragraph. |
| borderWidth | int | Border width in eigths of a point. |
| borderBottomWidth | int | Overwrites the general border width for the bottom border of the paragraph. |
| borderLeftWidth | int | Overwrites the general border width for the left border of the paragraph. |
| borderTopWidth | int | Overwrites the general border width for the top border of the paragraph. |
| borderRightWidth | int | Overwrites the general border width for the right border of the paragraph. |
| caps | bool | If true displays text in capital letters. |
| color | string | Hexadecimal color value: 'FF0000', '000000'... |
| contextualSpacing | bool | If true ignores spacing above and below the paragraph whenever the neighbouring paragraphs use the same Word style (false by default). |
| doubleStrikeThrough | bool | If true displays text in doubleStrikeThrough. |
| em | string | Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot'. |
| emboss | bool | Emboss style. |
| firstLineIndent | int | First line indentation in twentieths of a point (twips). |
| font | string | Font family: 'Arial', Calibri'... |
| fontSize | int | Font size in points. |
| hanging | int | Paragraph hanging in twentieths of a point (twips). |
| headingLevel | int | The heading level if you want this paragraph to be a heading. |
| italic | bool | If true displays the text in italics. |
| indentLeft | int | Left margin in points. |
| indentRight | int | Right margin in points. |
| keepLines | bool | Keeps (whenever possible) all the current paragraph lines on the same page. |
| keepNext | bool | Keeps (whenever possible) in the same page the current paragraph with next paragraph. |
| lineSpacing | int | 120, 240 (standard), 360, 480... (in twentieths of a point). |
| noProof | bool | Ignore spelling and grammar errors. |
| outline | bool | Outline style. |
| parseLineBreaks | bool | If true (default is false) parses the line breaks to include them in the Word document. |
| parseTabs | bool | If true (default is false) parses the tabs to include them in the Word document as w:tab tags. |
| position | int | Position value. Positive value for raised and negative value for lowered. |
| rtl | bool | Sets to true for right to left languages like Hebrew or Arabic. |
| scaling | int | Scaling value, 100 is the default value. |
| shadow | bool | Shadow style. |
| smallCaps | bool | If true displays text in small capital letters. |
| spacingBottom | int | Bottom padding in twentieths of a point. |
| spacingTop | int | Top padding in twentieths of a point. |
| strikeThrough | bool | If true displays text in strikethrough. |
| suppressAutoHyphens | bool | Suppress hyphenation. |
| suppressLineNumbers | bool | Suppress line numbers. |
| tabPositions | array | Each entry is an associative array with the following keys and values:
|
| textAlign | string | Text alignment within paragraph. Possible values are: left, center, right, both and distribute. |
| textDirection | string | Text flow direction within a table cell. Possible values are: lrTb, tbRl, btLr, lrTbV, tbRlV and tbLrV. |
| underline | string | Underlines text. Possible values are: single, words, double, dotted, dash and wave. |
| underlineColor | string | Underlines text with a color: 'FF0000', '000000'... |
| vanish | bool | Uses a vanish style. |
| widowControl | bool | 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 | bool | Allows line breaking at character level (default value is false). |
Theme options (Available in Premium licenses):
| Key | Type | Description |
|---|---|---|
| color | string |
|
Exceptions
Structured document tag type is not available.
Release notes
- phpdocx 16.0:
- text type.
- characterBorder, rStyle styles.
- phpdocx 15.0:
- checkedState, uncheckedState and sym options.
- phpdocx 13.5:
- supported working as inline WordFragment.
- phpdocx 12.0:
- htmlspecialchars applied in placeholderText and alias options.
