TX Text Control .NET for WPF

MasterPassword Property

Property|Introduced in 11.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Specifies a password for the document's access permissions. If the password is an empty string, accessing the document is not restricted. If a password is specified, the access permissions are given through the SaveSettings.DocumentAccessPermissions property.

Syntax

public string MasterPassword { get; set; }

Examples

The following example supplies an owner password obtained from secure application configuration. The configured base settings are then used by the appropriate load or save operation.

loadSaveSettingsBase.MasterPassword = documentPassword;
if (loadSaveSettingsBase is LoadSettings loadSettings)
{
    textControl.Load("template.docx", StreamType.WordprocessingML, loadSettings);
}
else if (loadSaveSettingsBase is SaveSettings saveSettings)
{
    textControl.Save("configured-document.docx", StreamType.WordprocessingML, saveSettings);
}

Limitations

PDF only. The encryption key length is 128 bits.