The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRLabel.AllowMarkupText Property

Gets or sets whether the you can use HTML-style markup tags to format the control's text.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

[SRCategory(ReportStringId.CatBehavior)]
[DefaultValue(false)]
public virtual bool AllowMarkupText { get; set; }
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(False)>
Public Overridable Property AllowMarkupText As Boolean

Property Value

Type Default Description
Boolean

false

true. if the control allows markup text; otherwise, false.

Remarks

report-label-allowmarkuptext

If the AllowMarkupText property is set to true, you can use markup tags to format the XRLabel.Text property.

XRLabel supports the following tags:

Tag

End Tag

Description

<br>

-

Inserts a single line break. Enable the WordWrap property to use this tag.

<nbsp>

-

Inserts a space.

<color=value>
Examples:
<color=red>
<color=0,255,0>
<color=255,0,255,0>
<color=#0000FF>

</color>

Specifies the text color.

<backcolor=value>
Examples:
<backcolor=red>
<backcolor=0,255,0>
<backcolor=255,0,255,0>
<backcolor=#0000FF>

</backcolor>

Specifies the background color.

<size=value>
Examples:
<size=10>
<size=+4>
<size=-4>

</size>

Specifies the font size.

<b>

</b>

Defines bold text.

<i>

</i>

Defines italic text.

<s>

</s>

Defines strikethrough text.

<u>

</u>

Defines underlined text.

<image=value>
Examples:
<image=UpArrow.png>
<image=DownArrow.png;size=20,20>

-

Inserts an image from the report's named image collection. Supports both raster images and SVG images.
Use the report's ImageResources property to provide images and reference them by their Id.

The image tag's size attribute sets the image display pixel size. If the specified width/height exceeds the label's width/height, it is reduced to display the entire image.

Specify the size attribute after the tag's value followed by the ";" character.

<href=value>
Example:
<href=www.devexpress.com>Our web site</href>

</href>

Displays a hyperlink. The value string specifies the hyperlink source, and the string between the opening and closing tags is the text to display.

Note

XRCharacterComb controls do not support HTML-style markup tags. The AllowMarkupText property is not in effect.

Example

The code sample below illustrates how to create a label, format its text and insert an image.

using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
using System.Drawing;

//...

XtraReport report = new XtraReport();
Image image = Image.FromFile("testImage.png");
ImageItem imageItem = new ImageItem("img1", new ImageSource(image));
report.ImageResources.Add(imageItem);

XRLabel label = new XRLabel() {
    AllowMarkupText = true,
    WordWrap = true,
    Text = "Test<br>" + 
        "<size=14>Size = 14<br>" +
        "<b>Bold</b> <i>Italic</i> <u>Underline</u></size><br>" +
        "<size=11>Size = 11<br>" +
        "<color=255,0,0>Sample Text</color></size><br>" +
        "<href=www.devexpress.com>Hyperlink</href><br>" +
        "<image=img1>"
};

DetailBand detailBand = new DetailBand();
detailBand.Controls.Add(label);
report.Bands.Add(detailBand);
See Also