XRControl.Padding Property

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

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[SRCategory(ReportStringId.CatAppearance)]
public virtual PaddingInfo Padding { get; set; }
<SRCategory(ReportStringId.CatAppearance)>
Public Overridable Property Padding As PaddingInfo

Property Value

Type Description
PaddingInfo

A PaddingInfo object that specifies the padding values.

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).

By default, all report controls that can display text information (XRLabel, XRTableCell, XRPageInfo, XRRichText and XRCheckBox) have right and left padding values set to 2. For the XRBarCode control, these values are 10.

At design time, you can change control paddings using the Properties window.

label-padding-property

You can also specify the control's padding values in code as shown below.

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

If the Padding property's value is not set for the current report control, its value is obtained from its parent, or a parent of its parent and so on. Similarly, the Padding value of the current control is applied 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 Appearance Properties for more information on this concept.

Note

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

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 XRControl.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

See Also