addCrossReference
- 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
addCrossReference
TRIAL / ADVANCED / PREMIUM
Inserts a cross-reference into the Word document.
Description
public addCrossReference (string $text, [array $options = array()] )
This method allows the insertion of cross-references into a Word document.
Parameters
Key | Type | Description |
---|---|---|
text | string | Text of the reference |
options
The options array includes the following keys and values:
Key | Type | Description |
---|---|---|
type | string | The bookmark type. Possible values are 'bookmark' and 'heading'. |
modifiers | string | Custom modifiers: \r \h, \n \h.... |
referenceName | string | The name of the element to be referred. |
referenceTo | string | Content to display when the field is updated PAGEREF (default, page number), REF (bookmark text content), ABOVE_BELOW (above/below text). |
Other styles from addText can also be used.
Release notes
- phpdocx 10.0:
- modifiers and referenceTo options.
- phpdocx 8.0:
- new styles.
- phpdocx 6.0:
- new method.