Modifies the general settings of an existing Word document.

public modifyDocxSettings (string $source, string $target, [, array $options])

With the help of this method you can set, among many others:

  • The way the Word document will print.
  • The view mode and zoom of the Word document at opening.
  • To hide or show grammatical and/or spelling errors.
  • To track or not revisions.
  • The document type.
  • Hyphenation settings.
  • Default table style and tab positioning.
  • Etcetera.


The path to the source Word document.


The path to the Word document resulting after changing it.


The possible keys and values of this array are:

Key Type Description
autoHyphenation bool
bookFoldPrinting bool
bookFoldPrintingSheets int Number of pages per booklet.
bookFoldRevPrinting bool
bordersDoNotSurroundFooter bool
bordersDoNotSurroundHeader bool
consecutiveHyphenLimit int Maximum number of consecutively hyphenated lines.
defaultTabStop int In twips (twentieths of a point).
defaultTableStyle string The table style to be used by default.
documentType string notSpecified (default), letter, eMail
doNotHyphenateCaps bool Do not hyphenate capital letters.
doNotShadeFormData bool
gutterAtTop bool
hideSpellingErrors bool
hideGrammaticalErrors bool
hyphenationZone int Distance in twips (twentieths of a point).
mirrorMargins bool If true interchanges inside and outside margins in odd and even pages.
noPunctuationKerning bool Never kern punctuation characters.
printTwoOnOne bool Print two pages per sheet.
savePreviewPicture bool Generate thumbnail for document on save.
trackRevisions bool
updateFields bool Automatically recalculate fields on open.
view string none (default), print, outline, masterPages, normal (draft view), web.
writeProtection bool Enable readonly.
zoom mixed A percentage or none, fullPage (display one full page), bestFit (display page width), textFit (display text width).

Error while trying to open the (base) template as a zip file.

Release notes
  • phpdocx 14.0:
    • writeProtection option.
    • return DOCXStructure.
  • phpdocx 13.5:
    • DOCXStructure and in-memory DOCX documents.