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.UserName Property

Returns or specifies the name of the user who write-protected the workbook.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

string UserName { get; set; }

#Property Value

Type Description
String

The user’s name.

#Property Paths

You can access this nested property as listed below:

Object Type Path to UserName
DocumentSettings
.WriteProtection .UserName

#Remarks

The following example demonstrates how to write-protect a workbook:

using(var workbook = new Workbook())
{
    var wpOptions = workbook.DocumentSettings.WriteProtection;
    wpOptions.SetPassword("Password");
    wpOptions.UserName = "John Smith";
    workbook.SaveDocument("WriteProtectedDocument.xlsx");
}

When users open this workbook in Microsoft® Excel®, it prompts them to enter a password to modify the document.

Write-protection options for a workbook

See Also