xtrareports-devexpress-dot-xtrareports-dot-ui-dot-editoptions-efd2133d.md
Specifies whether an editor for customizing a control’s content in Print Preview is enabled.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultValue(false)]
public bool ReadOnly { get; set; }
<DefaultValue(False)>
Public Property [ReadOnly] As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | false |
true , to prohibit editing a control’s content in Print Preview; otherwise, false.
|
You can enable content editing for a report control by setting the EditOptions.Enabled property to true. This results in one or more corresponding editing fields being added to the PrintingSystemBase.EditingFields collection.
When the ReadOnly property is enabled, a corresponding field cannot be edited in Print Preview and is not highlighted as an editing field. The following code illustrates how to use this property to disable content editing for a specific user.
using DevExpress.XtraPrinting;
// ...
private void XtraReport1_BeforePrint(object sender, System.ComponentModel.EventArgs e) {
PrintingSystem.AfterBuildPages += PrintingSystem_AfterBuildPages;
}
private static string userName = System.Environment.UserName;
void PrintingSystem_AfterBuildPages(object sender, System.EventArgs e) {
if (userName == "fuller.andrew")
foreach (EditingField field in PrintingSystem.EditingFields)
field.ReadOnly = true;
}
Imports DevExpress.XtraPrinting
' ...
Private Sub XtraReport1_BeforePrint(sender As Object, e As System.ComponentModel.EventArgs)
AddHandler PrintingSystem.AfterBuildPages, AddressOf PrintingSystem_AfterBuildPages
End Sub
Private Shared userName As String = System.Environment.UserName
Private Sub PrintingSystem_AfterBuildPages(sender As Object, e As System.EventArgs)
If userName = "fuller.andrew" Then
For Each field As EditingField In PrintingSystem.EditingFields
field.[ReadOnly] = True
Next
End If
End Sub
For more information, see Content Editing in Print Preview.
See Also