docxSettings

docxSettings

TRIAL / ADVANCED / PREMIUM

Modifies the general Word settings.

Description
public docxSettings ( array $settingParameters )

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.

If you need to alter the setting of pre-existing Word documents you may use the modifyDocxSettings method available in the DocxUtilities package.

Parameters

settingParameters

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
compat array Compatibility setting tags.
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).
customSetting array Custom settings.
Code samples

Example #1

The resulting Word document looks like:

Release notes
  • phpdocx 14.0:
    • writeProtection option.
  • phpdocx 9.5:
    • compat option.
  • phpdocx 7.5:
    • customSetting option.