Back to Devexpress

Create(string) Constructor

vcl-dxspreadsheetprotection-dot-tdxspreadsheetcustomprotectioninfo-dot-create-x28-system-dot-string-x29.md

latest2.9 KB
Original Source

Create(string) Constructor

Creates a new instance of a spreadsheet protection provider.

Declaration

delphi
constructor Create(const APassword: string); overload;

Parameters

NameType
APasswordstring

Remarks

Call this constructor to create an instance of the standard or strong spreadsheet protection provider, initializing the Password property with the value passed as the APassword parameter.

To enforce the spreadsheet document structure or worksheet password protection, assign the newly created protection provider to the OptionsProtection.ProtectionInfo property provided by the Spreadsheet/Report Designer control or a Table View worksheet, respectively:

delphi
var
  AProtectionInfo: IdxSpreadSheetProtectionInfo;
//...
  AProtectionInfo := TdxSpreadSheetStandardProtectionInfo.Create('Password'); // Create a standard protection provider with the required password
  dxSpreadSheet1.OptionsProtection.ProtectionInfo := AProtectionInfo;
  dxSpreadSheet1.OptionsProtection.&Protected := True; // Enable the document structure's protection
cpp
_di_IdxSpreadSheetProtectionInfo *AProtectionInfo;
  TdxSpreadSheetStandardProtectionInfo *AStandardProtectionInfo;
//...
  AStandardProtectionInfo = new TdxSpreadSheetStandardProtectionInfo("Password"); // Create a standard protection provider with the required password
  AProtectionInfo = new _di_IdxSpreadSheetProtectionInfo(*AStandardProtectionInfo);
  dxSpreadSheet1->OptionsProtection->ProtectionInfo = *AProtectionInfo;
  dxSpreadSheet1->OptionsProtection->Protected = true; // Enable the document structure's protection

For more information, refer to the Spreadsheet Document Structure Protection and Worksheet Protection sections of the Password Protection topics.

See Also

TdxSpreadSheetCustomProtectionInfo Class

TdxSpreadSheetCustomProtectionInfo Members

dxSpreadSheetProtection Unit