xtrareports-devexpress-dot-xtrareports-dot-ui-656ab017.md
A Character Comb control that displays text so that each character is printed in an individual cell.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultBindableProperty("Text")]
public class XRCharacterComb :
XRLabel
<DefaultBindableProperty("Text")>
Public Class XRCharacterComb
Inherits XRLabel
The XRCharacterComb control displays text so that each character is printed in an individual cell.
To add this control to the report, drag the XRCharacterComb item from the DX:25.2: Report Controls Toolbox tab and drop it onto the report.
The number of cells displayed by the control in Print Preview depends on the CanShrink and AutoWidth settings.
See the Content Layout and Position section to learn more on using these properties.
You can also adjust the character comb’s size to match its characters at design time by right-clicking the control and using the Fit Bounds To Text command in the context menu:
If the XRControl.WordWrap option is enabled, the command keeps control content displayed in multiple lines. It decreases the control’s height and adjusts the width to fit this content.
If the XRControl.WordWrap option is disabled, the command adjusts the control’s height and width to completely display the control’s content in a single line. As a result, the number of cells corresponds to the number of characters.
When exporting this control to third-party formats, consider the following
In most aspects, the Character Comb is similar to the XRLabel control from which it inherits most of its properties and its basic behavior. For general information about binding these controls to data and display summary function results, see the following topic: Label.
The following properties are specific to the XRCharacterComb control.
This section describes the XRCharacterComb properties that affect the control’s position on a page and content layout.
The following image illustrates the behavior of the XRLabel.AutoWidth property that specifies whether or not the width of a control depends on its text.
| AutoWidth = true | AutoWidth = false |
|---|---|
The following image illustrates the behavior of the XRLabel.CanShrink property that specifies whether or not the height of a control depends on its text.
| CanShrink = true | CanShrink = false |
|---|---|
The XRCharacterComb.TextAlignment property specifies the alignment of text within a control.
| TextAlignment = TopLeft | TextAlignment = MiddleCenter | TextAlignment = BottomRight |
|---|---|---|
This example illustrates how to create a Character Comb and specify its main options in code.
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
public XRCharacterComb CreateCharacterComb() {
// Create a Character Comb instance.
XRCharacterComb characterComb = new XRCharacterComb();
// Make every cell have borders on each side.
characterComb.Borders = BorderSide.All;
// Specify the spacing between cells (measured in report units).
characterComb.CellHorizontalSpacing = 2;
characterComb.CellVerticalSpacing = 2;
// Make the cell height depend on the current font size,
// and the cell width having a fixed value (measured in report units).
characterComb.CellSizeMode = SizeMode.AutoHeight;
characterComb.CellWidth = 25;
// Adjust the control's dimensions to its content.
characterComb.AutoWidth = true;
characterComb.CanShrink = true;
// Set its Multiline property to true.
characterComb.Multiline = true;
// Set its static text. This property is bindable,
// meaning that this text can be supplied from a data source.
characterComb.Text = "Line1\r\nLine2";
return characterComb;
}
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateCharacterComb() As XRCharacterComb
' Create a Character Comb instance.
Dim characterComb As New XRCharacterComb()
' Make every cell have borders on each side.
characterComb.Borders = BorderSide.All
' Specify the spacing between cells (measured in report units).
characterComb.CellHorizontalSpacing = 2
characterComb.CellVerticalSpacing = 2
' Make the cell height depend on the current font size,
' and the cell width having a fixed value (measured in report units).
characterComb.CellSizeMode = SizeMode.AutoHeight
characterComb.CellWidth = 25
' Adjust the control's dimensions to its content.
characterComb.AutoWidth = True
characterComb.CanShrink = True
' Set its Multiline property to true.
characterComb.Multiline = True
' Set its static text. This property is bindable,
' meaning that this text can be supplied from a data source.
characterComb.Text = "Line1" & Microsoft.VisualBasic.ChrW(13) &
Microsoft.VisualBasic.ChrW(10) & "Line2"
Return characterComb
End Function
Object MarshalByRefObject Component XRControl XRFieldEmbeddableControl XRLabel XRCharacterComb
See Also