protectDocx
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createDocx
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importHeadersAndFooters
- importStyles
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addTable
- addTableContents
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteTemplateBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- tickCheckbox
protectDocx
PREMIUM
BASIC / ADVANCED
Password protects the contents of a Word document.
Description
public protectDocx (string $source, string $target, array $options)
This method allows to password protect a Word document. One may protect in read only mode or allow the final user to modify comments or form elements.
Notice that this method does not encrypt the contents of the Word document, only protects them from unauthorized modifications. This method is not secure and can be easily overriden by an experienced user.
You may find a detailed description of this package in the cryptophpdocx section of the API documentation.
Parameters
source
Path to the word document you want to protect.
target
Path to the resulting protected document.
options
The possible keys and values are (required options are shown with yellow background):
Key | Type | Description |
---|---|---|
password | string | The password should be a string of 15 or less characters. If you introduce a password with more than 15 characters it will be automatically truncated. |
type | string | Available protection types:
|
overwrite | bool | True or false. If true (default value) overwrites the existing protection if it exists. |
Return values
Void.