getStatistics
- 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
getStatistics


Counts and prints the number of pages, words, characters, paragraphs, lines, tables and images of a DOCX.
Description
public getStatistics (string $source)
This method uses the conversion plugins (LibreOffice, MS Word or PHP native) to count and print the number of:
- pages (LibreOffice and MS Word)
- words (LibreOffice, MS Word and PHP native)
- characters (LibreOffice, MS Word and PHP native)
- paragraphs (LibreOffice, MS Word and PHP native)
- lines (LibreOffice and MS Word)
- tables (LibreOffice and PHP native)
- images (LibreOffice and PHP native)
Indexer can extract additional information from the document.
Parameters
source
Path to the DOCX to get its statistics.
Return values
array
Code samples
Example #1
Example #2
Example #3
Release notes
- phpdocx 17.0:
- supported PHP native conversion plugin.
- phpdocx 10.0:
- supported MS Word conversion plugin.
- return an Exception if the stats file can't be created.
- phpdocx 5.5:
- new method.