checkSpelling
- 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
checkSpelling
PREMIUM
TRIAL / ADVANCED
Checks spelling in a DOCX document.
Description
public checkSpelling ( $source [, array $options = array()] )
Checks spelling in a DOCX and corrects misspelled words.
Supported AI integrations:
- phpdocx AI
This method requires the Pspell PHP Extension.
Parameters
source
DOCX document.
options
An array with the available options.
The possible keys and values are:
key | Type | Description |
---|---|---|
language | string | Set two letter ISO 639 language and an optional two letter ISO 3166 country code after a dash or underscore: pspell_new language option. |
referenceNode | array |
Default all paragraphs. DOCXPath options for custom queries:
|
regExprCleanWords | string | Regular expression to clean contents to remove extra symbols. Default as '/[^\p{L}\p{N}\s]/u'. |
spelling | string | Specific spelling: pspell_new spelling option. Default as empty. |
target | array |
Extract specific targets:
|
saveAs | string | If set, generates a new DOCX replacing the misspelled words by the first suggestion from pspell. Default as null. |
Return values
array with the misspelled words
Exceptions
PHP pspell is not available.
The language option is not set.
Not valid DOCX source.
Code samples
Release notes
- phpdocx 14.0:
- new method.