All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

PreviewOptions.SyncWithReportPageSettings Property

Specifies how to synchronize document preview options with report page settings.

Namespace: DevExpress.XtraReports.Configuration

Assembly: DevExpress.XtraReports.v20.2.dll

Declaration

public SynchronizationMode SyncWithReportPageSettings { get; set; }
Public Property SyncWithReportPageSettings As SynchronizationMode

Property Value

Type Default Description
SynchronizationMode

Auto

Always, to synchronize settings; Never, to never synchronize; Auto, to synchronize only if horizontal anchoring is enabled for one of the report's or subreport's controls.

Property Paths

You can access this nested property as listed below:

Object Type Path to SyncWithReportPageSettings
Settings
.PreviewOptions.SyncWithReportPageSettings

Remarks

When the SyncWithReportPageSettings property is set to Always, the document page settings that you change in WinForms Print Preview or WPF Print Preview are synchronized with the report page settings. For example, if you use horizontal anchoring for a control and change the document's margins in Print Preview, the control's size changes to fit the new margin size. Each change in Print Preview invokes the XtraReport.CreateDocument method. This method recreates the document to apply the new settings. If you then print or export the document, it will include all the changes made in Print Preview.

When the SyncWithReportPageSettings property is set to Auto, the settings are synchronized only if horizontal anchoring is enabled for one of the report's or subreport's controls.

If you do not need to synchronize settings between reports and their Print Preview, set the SyncWithReportPageSettings property to Never.

Example

The code example below demonstrates how to create a simple report and set the SyncWithReportPageSettings property for the application.

using DevExpress.XtraReports.Configuration;
using DevExpress.XtraReports.UI;
using System.Drawing;
// ...
// Create a label and set its "AnchorHorizontal" property to "Both".
XRLabel label = new XRLabel() {
    AnchorHorizontal = HorizontalAnchorStyles.Both,
    Text = "Some content goes here...",
    Font = new Font("Tahoma", 20f),
    Borders = DevExpress.XtraPrinting.BorderSide.All,
    LocationF = new DevExpress.Utils.PointFloat(150F, 20F),
    WidthF = 350F
};

// Create a report with the label.
XtraReport report = new XtraReport() {
    Name = "XtraReport",
    Bands = {
        new DetailBand() {
        HeightF = 15,
        Controls = {label}
        }
    }
};

// The value of the "SyncWithReportPageSettings" property is set to "Auto" (the default value).
// Uncomment the line below to set it to "Never".
// Settings.Default.PreviewOptions.SyncWithReportPageSettings = SynchronizationMode.Never;

The image below shows the initial report layout in Print Preview.

The report's detail band contains the XRLabel control whose AnchorHorizontal property is set to Both.

The following examples demonstrate how different values of the SyncWithReportPageSettings property affect the horizontal anchoring of the XRLabel control when the report's right margin is changed in Print Preview.

Limitations

The property has no effect if you use auto fit in Print Preview.

See Also