Skip to main content
All docs
V23.2

PreviewOptions.SyncWithReportPageSettings Property

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

Namespace: DevExpress.XtraReports.Configuration

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public SynchronizationMode SyncWithReportPageSettings { get; set; }

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.

Note

The SyncWithReportPageSettings property does not affect vertical anchoring. When you change the report’s bottom margin in Print Preview, the controls’ sizes do not adjust to the new report size even if their AnchorVertical property is set to Bottom or Both.

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