getWordStyles
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- 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
getWordStyles
ADVANCED / PREMIUM
TRIAL
Return the styles used by contents of a DOCXPath query.
Description
public getWordStyles (array $referenceNode)
Parameters
referenceNode
An array to get the refence node.
The possible keys and values of this array are:
Key | Type | Description |
---|---|---|
type | string | chart, image, default, list, math, paragraph (also for links and lists), run, style, table, table-row, table-cell, table-cell-paragraph. |
contains | string | Contains a text string. |
occurrence | int or string | Exact occurrence (int) or range of contents (e.g.: 2..9, 2.., ..9) (string) or first() or last(). If empty iterate all elements. |
attributes | array | Contains a specific attribute key and value. |
parent | string | Main document body as default, allows to set any parent or a specific one. w:body (default), '/' (any parent) or any other specific parent (/w:tbl/, /w:tc/, /w:r/...). |
styleType | string | Query styles by specific type: paragraph, heading, character, table. To be used when the type option is set as style. |
customQuery | string | Custom xpath query, overwrites any other reference. |
Return values
array
Code samples
Example #1
Example #2
Release notes
- phpdocx 15.5:
- math type.
- phpdocx 15.0:
- table-row, table-cell and table-cell-paragraph types.
- phpdocx 14.0:
- stylesType option.
- phpdocx 12.0:
- avoid null Exceptions if some DOCX styles are missing.
- improved working with multiple sections that contain multiple headers and footers.
- phpdocx 9.0:
- new method.