API documentation
- Learn phpdocx in 5 minutes
- Tutorial
- API quick guide
- HTML to Word
- HTML Extended
- Conversion plugin
- Word to HTML
- DOCXPath
- Bulk processing
- DOCXCustomizer
- Digital signature
- Cryptophpdocx
- Right to left languages
- phpdocx CLI command
- Tracking
- Artificial Intelligence
- Blockchain for documents
- JavaScript API
- Compiled mode
API documentation
You will find in this section a complete list of the methods included in the latest version of the phpdocx library.
Here we include a brief description of each method for your convenience:
-
addBibliography
Inserts a bibliography into the Word document
-
addBookmark
Inserts a bookmarks into the Word document
-
addBreak
Inserts a line/column/page break into the Word document
-
addChart
Inserts a chart into the Word document
-
addCitation
Adds a citation into the Word document
-
addComment
Adds a Word comment to the current Word document
-
addCrossReference
Inserts a cross-reference into the Word document
-
addDateAndHour
Allows to insert the current date and/or hour in different formats
-
addEndnote
Inserts an endnote into the Word document
-
addExternalFile
Adds an external DOCX, HTML, MHT, RTF or TXT file
-
addFootnote
Inserts a footnote into the Word document
-
addFormElement
Inserts form elements into the Word document
-
addHeading
Inserts a heading into the Word document
-
addImage
Inserts an image into the Word document
-
addLink
Inserts a link into the Word document
-
addList
Inserts (nested) lists into the Word document
-
addMathEquation
Imports a math equation from another Word document or inserts a math equation in OMML or MathML format
-
addMergeField
Adds a merge field to the Word document
-
addOLE
Adds an OLE file
-
addOnlineVideo
Adds an online video to the Word document
-
addPageNumber
Inserts the current page number into the Word document
-
addShape
Inserts different types of shapes into a Word document
-
addSimpleField
Adds a simple field to the Word document
-
addSource
Adds a source into the Word document
-
addStructuredDocumentTag
Inserts different types of Structured Document Tags into the Word document
-
addSVG
Inserts a SVG into the Word document
-
addTab
Inserts a tab into a Word document
-
addTable
Inserts a table into a Word document
-
addTableContents
Inserts a Table of Contents (TOC) into the Word document
-
addTableFigures
Inserts a Table of Figures into the Word document
-
addText
Inserts a paragraph into a Word document
-
addTextBox
Inserts a Text Box in the Word document
-
addWordFragment
Inserts a WordFragment into the Word document
-
addWordML
Inserts raw WordML code into the Word document
-
embedHTML
Inserts HTML content into the Word document
-
addBackgroundImage
Inserts a background image into the Word document
-
addFooter
Inserts footers into the Word document
-
addFooterSection
Inserts footers in a specific section into the Word document
-
addHeader
Inserts headers into the Word document
-
addHeaderSection
Inserts headers in a specific section into the Word document
-
addLineNumbering
Sets the line numbering configuration of the current Word document
-
addMacroFromDoc
Imports a macro from an existing Word document into the current document
-
addPageBorders
Inserts page borders into the Word document
-
addProperties
Modifies the properties of the Word document
-
addSection
Adds a new section to the Word document
-
createDocx
Creates the DOCX document
-
createDocxAndDownload
Creates and sends to the browser the DOCX document
-
createCharacterStyle
Creates a character style to be used in combination with the addText method
-
createListStyle
Creates a custom list style to use it in combination with the addList and embedHTML methods
-
createParagraphStyle
Creates a paragraph style to be used in combination with the addText method
-
createTableStyle
Creates a table style to be used in combination with the addTable method
-
docxSettings
Overwrites the general settings of the current Word document
-
embedFont
Embeds a font in a Word document
-
importChartStyle
Imports a chart style from an external Word document
-
importHeadersAndFooters
Imports headers and footers from an external Word document
-
importListStyle
Imports a list style from an external Word document
-
importStyles
Imports Word styles from an external Word document
-
importStylesWordDefault
Imports MS Word default styles
-
modifyPageLayout
Modifies the layout properties of the Word document
-
parseStyles
Generates a Word document with all the available Word styles
-
removeFooters
Removes footers into the Word document
-
removeHeaders
Removes headers into the Word document
-
setBackgroundColor
Sets background color of the Word document
-
setDecimalSymbol
Changes the decimal symbol in the settings file
-
setDefaultFont
Sets the default font for the whole Word document
-
setDocumentDefaultStyles
Sets the default styles for the whole Word document
-
setEncodeUTF8
Enforces UTF-8 encoding of the Word document contents
-
setLanguage
Sets the default language of the Word document
-
setMarkAsFinal
Marks the resulting Word document as final
-
setRTL
Sets the global right to left language properties of the current Word document
-
clearBlocks
Removes remaining BLOCK type variables from the Word document
-
cloneBlock
Clones blocks in the document
-
deleteBlock
Deletes a block of content from the Word document
-
getTemplateVariables
Returns the template placeholder variables as an array
-
getTemplateVariablesType
Returns the template variables and their types
-
modifyInputFields
Modifies the values of the Word template input fields
-
modifyMergeFields
Modifies the values of the Word template merge fields
-
processTemplate
Processes the template to repair all listed variables
-
removeTemplateVariable
Removes a template variable with its container paragraph
-
removeTemplateVariableImage
Removes a template image variable with its container paragraph
-
replaceBlock
Replaces all content between two block variables
-
replaceListVariable
Replaces a single variable within a list by a list of items
-
replacePlaceholderImage
Replaces a placeholder image by an external image
-
replaceTableVariable
Replaces variables by a 'table set of rows'
-
replaceVariableByExternalFile
Replaces an array of variables by external files
-
replaceVariableByHTML
Replaces a template variable with WordML obtained from HTML via the embed method
-
replaceVariableByText
Replaces an array of variables by their values
-
replaceVariableByWordFragment
Replaces an array of variables by Word Fragments
-
replaceVariableByWordML
Replaces an array of variables by plain WordML
-
setTemplateSymbol
Sets a custom symbol to wrap phpdocx template variables
-
setTemplateBlockSymbol
Sets a custom string to set phpdocx block variables
-
tickCheckboxes
Ticks or unticks a Word template checkbox
-
DOCX2TXT
Extracts the text contents from a Word document
-
enableRepairMode
Enables repair features to fix common issues when working with LibreOffice
-
getStatistics
Counts and prints the number of pages, words, characters, paragraphs, lines, tables and images of a document
-
transformDocument
Transforms documents into other formats (DOCX, PDF, (X)HTML, DOC, ODT, RTF, PNG, TXT)
-
transformDocAdvHTML
Transforms DOCX documents into HTML using native PHP classes
-
transformOMMLToMathML
Transforms OMML (Office MathML) equations to MathML
-
TXT2DOCX
Transforms plain text into WordML with custom styles
-
cloneWordContent
Clones existing elements in the document
-
getDocxPathQueryInfo
Gets information from a performed DOCXPath query
-
getWordContents
Returns text contents of existing elements in the document
-
getWordFiles
Returns file contents from the document
-
getWordStyles
Return the styles used by contents of a DOCXPath query
-
importContents
Imports contents from a document
-
insertWordFragment
Inserts existing elements in the document
-
moveWordContent
Moves existing elements in the document
-
removeWordContent
Removes existing elements in the document
-
replaceWordContent
Replaces existing elements by a WordFragment
-
mergeDocx
Merges two or more Word documents
-
mergeDocxAt
Merges two or more Word documents after a specific position
-
modifyDocxSettings
Modifies the settings of an existing Word document
-
optimizeDocx
Optimizes a DOCX document
-
parseCheckboxes
Parses and ticks or unticks the checboxes included in a Word document
-
rawSearchAndReplace
Searches and replaces texts in any XML file of the document
-
removeChapter
Removes a whole chapter from a Word document
-
replaceChartData
Replaces the data associated with a given chart
-
searchAndColor
Searches for keywords within a Word document and colors them
-
searchAndHighlight
Searches for keywords within a Word document and highlights them
-
searchAndRemove
Removes the paragraphs containing a given string of text
-
searchAndReplace
Searches and replaces a given string of text in a Word document
-
setLineNumbering
Modifies the line numbering properties of an existing Word document
-
watermarkDocx
Inserts a watermark into a Word document
-
watermarkRemove
Removes watermarks from a Word document
-
changeStatusComments
Sets a comment as completed or not completed
-
removeSection
Removes a section and its contents
-
splitDocx
Splits DOCX documents per section
-
addBackgroundImage
Inserts a background image into a document
-
indexer
Returns PDF information: pages, version, annotations...
-
mergePdf
Merges two or more PDF documents
-
removePagesPdf
Removes pages in PDF documents
-
rotatePdf
Rotates PDF documents
-
splitPdf
Splits PDF documents
-
watermarkPdf
Inserts a watermark into a PDF document
-
customizeWordContent
Changes DOCX styles on the fly of new documents and templates
-
indexer
Parses DOCX documents and return their contents (body, images, links, comments, headers...)
-
generateDOCXStructure
Allows using a DOCX as template from any stream
-
optimizeTemplate
Process a DOCX to get the best performance when using the document as a template
-
parseDocx
Allows to serialize a DOCX in memory, database... to be reused later
-
zipStream
Generates a DOCX stream without saving the document to the file system
-
replaceImage
Replaces image placeholders
-
replaceList
Replaces list placeholders
-
replaceTable
Replaces table placeholders
-
replaceText
Replaces text placeholders
-
replaceWordFragment
Replaces placeholders by WordFragments
-
acceptTracking
Accepts a tracked content or tracked style
-
addPerson
Adds people to the document
-
disableTracking
Disables tracking
-
enableTracking
Enables tracking
-
rejectTracking
Rejects a tracked content or tracked style
-
addPermProtection
Adds editable regions of contents into the Word document
-
encryptDOCX
Encrypts a Word (DOCX) document
-
encryptPDF
Encrypts a PDF file
-
encryptPPTX
Encrypts a PowerPoint (PPTX) document
-
encryptXLSX
Encrypts an Excel (XLSX) document
-
protectDOCX
Password protects the contents of a Word document
-
protectPDF
Password protects the contents of a PDF document
-
removeProtection
Removes the password protection from a Word document
-
sign (DOCX)
Digitally signs a Word document
-
addLineSignature
Inserts a line signature into the Word document
-
sign (PDF)
Digitally signs a PDF document
-
sign (PPTX)
Digitally signs a PowerPoint document
-
sign (XLSX)
Digitally signs an Excel document
-
checkSpelling
Check spelling in a DOCX
-
extractKeywords
Extract keywords from a DOCX
-
generateContentFromDescription
Generate content from a description
-
grammarCorrection
Grammar correction in a DOCX
-
summarize
Summarize a DOCX
-
translate
Translate a DOCX
-
customRequest
Do a custom request
-
searchAndReplace
Searches and replaces shared strings and cell values in an Excel document
-
removeSheet
Removes sheets from an Excel document
-
splitXlsx
Splits XLSX documents per sheet
-
searchAndReplace
Searches and replaces text strings in a PowerPoint document
-
removeSlide
Removes slides from a PowerPoint document
-
splitPptx
Splits XLSX documents per slide
-
generateDigestDOCX
Generates a digest value from a DOCX
-
generateDigestPDF
Generates a digest value from a PDF
-
getAddress
Returns the document_address custom property value of a DOCX document
-
insertAddress
Inserts the address value in a DOCX document
-
checkVariant
Returns if a DOCX uses strict or transitional variant
-
generateStrictVariant
Transforms a transitional variant DOCX to a strict variant DOCX
-
generateTransitionalVariant
Transforms a strict variant DOCX to a transitional variant DOCX