Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.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