Skip to main content

XRControl.Padding Property

Gets or sets the control’s padding values (measured in report units).

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatAppearance)]
public virtual PaddingInfo Padding { get; set; }

Property Value

Type Description
PaddingInfo

A PaddingInfo object that specifies the padding values.

Remarks

The Padding property specifies indent values which are used to render the control’s contents (for example, an XRLabel‘s text or an XRPictureBox‘s image).

Initial Values

Report controls that display text information (XRLabel, XRTableCell, XRPageInfo, XRRichText and XRCheckBox) have initial right and left padding values set to 2. The XRBarCode control’s paddings are initially set to 10.

How to Specify the Padding

At design time, you can use the Properties window to change the control’s paddings.

label-padding-property

The following code snippet specifies the paddings for the XRLabel control:

xrlabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(20, 2, 2, 0);

If the Padding property is not set for a report control, the Padding value is obtained from the control’s parent. That means that Padding value of the current control applies to all its child report controls (if there are any in its XRControl.Controls collection) if their Padding property value is not set. Refer to the following topic for more information: Appearance Properties.

Note

Not all descendants of the XRControl class use the Padding property. For example, the XRPageBreak class and Band class descendants ignore the Padding property.

Export to Different Formats

The Padding property is ignored when a report is exported to RTF and DOCX formats.

When exporting a report document to XLS or XLSX, control paddings are automatically converted to Excel’s indents (since Excel does not support the concept of paddings). Indents specify the horizontal space between the cell border and the cell data itself. Only one padding value (PaddingInfo.Left or PaddingInfo.Right) is taken into account, depending on whether the control’s content is left-aligned or right-aligned, which is specified by the XRControl.TextAlignment and the control’s RightToLeft properties.

1 indent usually takes 3 spaces of the current font size, which is approximately equal to 9 pixels under the default settings. For this reason, when exporting documents, each 9 pixels of the corresponding Padding property value is converted to 1 Excel cell indent.

label-padding-export-to-excel

The following code snippets (auto-collected from DevExpress Examples) contain references to the Padding property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also