Skip to main content
Row

WriteProtectionOptions.ReadOnlyRecommended Property

Returns or specifies whether the author of the workbook recommended that it be opened as read-only.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v23.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

bool ReadOnlyRecommended { get; set; }

Property Value

Type Description
Boolean

true if the author recommended the document to be opened as read-only; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to ReadOnlyRecommended
DocumentSettings
.WriteProtection .ReadOnlyRecommended

Remarks

The following example demonstrates how to make a workbook read-only:

using(var workbook = new Workbook())
{
    var wpOptions = workbook.DocumentSettings.WriteProtection;
    wpOptions.ReadOnlyRecommended = true;
    workbook.SaveDocument("WriteProtectedDocument.xlsx");
}

When users open this workbook in Microsoft® Excel®, it prompts them to open the document as read-only.

Read-only workbook

The WriteProtectionOptions.SetPassword method allows you to specify a password to prevent modifications from unauthorized users.

Note

Write-protection options are ignored when you open a document in the WinForms or WPF Spreadsheet control. Handle the SpreadsheetControl.DocumentLoaded event to check the document’s ReadOnlyRecommended value and to make the control read-only when needed.

See Also