[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Expand]Use Report Controls
  [Expand]Shape Report Data
   Lay out Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Collapse]Provide Interactivity
    Create Drill-Down Reports
    Sort a Report in Print Preview
    Content Editing in Print Preview
    Print Preview Mouse Events
    Create Drill-Through Reports
    Obtain a Label's Text in Print Preview
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Content Editing in Print Preview

This document describes how to allow end users to customize field values in a previewed document.

Expanded Content Editing Overview

Set a report control's EditOptions | Enabled (see EditOptions.Enabled) property to true and leave the EditOptions | ReadOnly (see EditOptions.ReadOnly) property disabled to make the control's content editable in Print Preview.

Print Preview provides the Editing Fields toolbar button if content editing is enabled for at least one control in the displayed report. Click this button to highlight all editable fields available in the document.

Use the TAB and SHIFT+TAB keys to navigate between editable fields forward and back.

Click an editable field to invoke an editor and specify a value.

You can enable content editing for data-aware and unbound report controls.

The following report controls support content editing in Print Preview:

Text

Boolean

Image

Label<br/> Table Cell<br/> Character Comb<br/>

Check Box

Picture Box

The sections below provide information about options these controls expose. You can use these options to set up content editing.

Expanded Content Editing Limitations

  • Changes made to a control's content in Print Preview does not effect the document's other parts (for example, summary results, grouping, sorting, bookmarks and other settings that were processed before the document was generated).
  • The XRControl.CanGrow setting is ignored for editable fields. The edited area cannot exceed the control's original dimensions.
  • Multi-line values can only be entered when no mask is applied to an editable field.
  • Values entered into editable fields are reset after the document is refreshed (for example, when end users submit report parameter values or expand/collapse data in a drill-down report).
  • It is not possible to edit content in bands if their DrillDownControl (see DetailBand.DrillDownControl) property is specified.
  • The entered values are not preserved in the Top Margin and Bottom Margin bands when the report is exported as a single file to the following formats:

    • TXT
    • CSV
    • HTML
    • MHT
    • RTF
    • XLS
    • XLSX
    • image
Tip

Enable the PdfExportOptions.ExportEditingFieldsToAcroForms option to automatically convert a report's editable fields to AcroForms on PDF export.

Expanded Text Editors

Text editors are used to customize the Label, Table Cell and Character Comb report controls' content in Print Preview.

The default text editor is a memo edit.

Specify the TextEditOptions.EditorName property to use one of the following text editors:

Numeric

Date-Time

Letters

  • Integer
  • Positive Integer
  • Fixed-Point
  • Positive Fixed-Point
  • Date
  • Only Letters
  • Only Uppercase Letters
  • Only Lowercase Letters
  • Only Latin Letters

Each editor has a specific mask.

You can implement custom editors and add them to an existing or custom category. The following online examples demonstrate how to do this:

Note

If a table cell contains other controls, end users cannot edit this cell (they can edit the cell's controls). The following image illustrates this:

Expanded Check Box Editor

The check box editor is used to customize the Check Box report control's content in Print Preview.

You can combine several check box editors into a radio group so that end users can select only one option within a group at a time. For this, set the Check Box report controls' CheckEditOptions.GroupID property to the same value.

Expanded Image Editors

Image editors are used to customize the XRPictureBox report control's content in Print Preview.

Use the control's DevExpress.XtraReports.UI.ImageEditOptions.EditorName property to assign one of the following image editors.

  • Image Editor
    Allows end users to load an image and specify the image's size options.

  • Signature Editor
    Allows end users to specify brush options and draw a signature.

  • Image and Signature Editor (default)
    Allows end users to load an image and draw a signature. The image's size options and brush options are available.

  • Editor with an Embedded Image Collection (custom)
    You can extend the EditorName property's editor list. Refer to the Create an Interactive E-Form topic for information on how to do this.

All these image editors include the button. This button allows end users to restore the initial image.

Expanded Specify Edit Options in Code

The following example illustrates how to specify a report control's edit options in code:

After you call the method that sets edit options (like the EnableDocumentEditing method in the code above), call the XtraReport.CreateDocument method to apply these options to the document.

Expanded Access Editable Fields in Code

When you set a report control's EditOptions.Enabled property to true, one or more editable fields are added to the PrintingSystem's EditingFields (see PrintingSystemBase.EditingFields) collection. If the control is bound to data, an editable field is created for each data record this control displays within the document.

The following classes define editable fields:

An editable field's options correspond to the control's edit options as follows:

Editable Field's Options Control's Edit Options
EditingField.ID EditOptions.ID
EditingField.ReadOnly EditOptions.ReadOnly
TextEditingField.EditorName TextEditOptions.EditorName
ImageEditingField.EditorName DevExpress.XtraReports.UI.ImageEditOptions.EditorName
CheckEditingField.GroupID CheckEditOptions.GroupID

You can access editable fields after a document is generated. The following code illustrates how to disable content editing for a specific user in the PrintingSystemBase.AfterBuildPages event handler.

Expanded Access an Editable Field's Value

Use the following properties to access an editable field's value:

Editable Field Type Field Value
TextEditingField (see TextEditingField) EditValue (see EditingField.EditValue)
CheckEditingField (see CheckEditingField) CheckState (see CheckEditingField.CheckState)
ImageEditingField (see ImageEditingField) ImageSource (see ImageEditingField.ImageSource) and InitialImageSource (see ImageEditingField.InitialImageSource)

Each time an editable field's value changes, the PrintingSystemBase.EditingFieldChanged event occurs. You can handle this event to validate or format the user input.

Expanded Format Edit Values

Handle the EditingFieldChanged (see PrintingSystemBase.EditingFieldChanged) event to apply a format to an editable field's value. In the event handler, access the visual brick (a placeholder for the control's content in the rendered document) and specify its TextBrick.TextValueFormatString and TextBrickBase.Text properties:

Tip

Specify both the TextBrickBase.Text and TextBrick.TextValueFormatString properties so that end-users can export the editable field's value to Excel in any TextExport mode (see XlExportOptionsBase.TextExportMode).

Note

If a report control is unbound, its content is obtained from the XRControl.Text property value and the brick's TextValue (see TextBrick.TextValue) property is set to null. So you can specify the brick's Text (see TextBrickBase.Text) property only.

The following code illustrates how to apply a currency format to unbound and data-aware controls in the EditingFieldChanged (see PrintingSystemBase.EditingFieldChanged) event handler.

Expanded See Also

Is this topic helpful?​​​​​​​