xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrlabel-4edb87f1.md
Specifies whether or not the width of a label depends on its text.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultValue(false)]
[SRCategory(ReportStringId.CatBehavior)]
public bool AutoWidth { get; set; }
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(False)>
Public Property AutoWidth As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | false |
true to automatically adjust the width to accommodate the label text; otherwise, false.
|
Use the AutoWidth property to always print an XRLabel‘s text in full, without limiting it by control dimensions. This is often required if a label’s text is supplied from a data source and is not immediately available at Visual Studio design time (for example, if a label has been assigned a summary function).
When using this feature, consider the following.
The result of using this option depends on the XRControl.WordWrap property value.
This option has no effect on the width or position of other report controls.
This option depends on the current horizontal alignment setting of a label (the XRControl.TextAlignment property value).
Report controls are converted to bricks in the printed document layout, and we cannot change the brick’s size after document creation. If you have an editable control, it is not possible to automatically change the control’s size according to new text in the printed document layout. The editable area cannot exceed the control’s original dimensions.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AutoWidth 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.
reporting-winforms-group-at-runtime/VB/DataGrouping/Form1.vb#L45
labelDetail.WordWrap = False
labelDetail.AutoWidth = True
' Specify labels' bindings depending on the report's data binding mode.
See Also