Skip to main content
All docs
V25.2
  • TextArea Class

    Allows you to access and manipulate text.

    Namespace: DevExpress.Docs.Presentation

    Assembly: DevExpress.Docs.Presentation.v25.2.dll

    NuGet Package: DevExpress.Docs.Presentation

    Declaration

    public class TextArea :
        TextAreaBase

    The following members return TextArea objects:

    Remarks

    To specify the text area content, add TextParagraph objects to the TextArea.Paragraphs collection. To split a paragraph into runs (spans of text that share the same formatting), add TextRun objects to the TextParagraph.Runs collection.

    A new shape’s text area initially contains one default empty paragraph to keep the presentation document valid. This paragraph goes first in the TextArea.Paragraphs collection.

    You can also use TextArea.Text, TextParagraph.Text, and TextRun.Text properties to specify text content. Use the “\r\n” character sequence to split the string value into paragraphs or runs.

    Example

    The following example adds a shape with two paragraphs and configures text settings:

    DevExpress Presentation API - Format shape text

    using DevExpress.Docs.Presentation;
    
    namespace PresentationApiSample;
    
    public class Program {
        public static void Main(string[] _) {
            //...
    
            Shape shape = new Shape(ShapeType.Rectangle);
            shape.Outline = new OutlineStyle { Fill = new SolidFill(Color.RoyalBlue), Width = 4 };
    
            TextArea textArea = new TextArea();
            textArea.Paragraphs.Clear(); // Removes the default paragraph.
            TextParagraph paragraph1 = new TextParagraph();
            paragraph1.Runs.Add(new TextRun ("5 "));
            paragraph1.Runs.Add(new TextRun {
                Text = "successful",
                TextProperties = new TextProperties {
                    Fill = new SolidFill(Color.Green),
                    FontSize = 22,
                    UnderlineFill = new SolidFill(Color.Black),
                    UnderlineType = TextUnderlineType.HeavyDotDotDash,
                    UnderlineStyle = new UnderlineStyle(new OutlineStyle { Fill = new SolidFill(Color.Red), Width = 2 }),
    
                }
            });
            paragraph1.Runs.Add(new TextRun (" builds"));
            textArea.Paragraphs.Add(paragraph1);
    
            TextParagraph paragraph2 = new TextParagraph();
            paragraph2.Runs.Add(new TextRun ("2 failed builds"));
            paragraph2.Properties = new ParagraphProperties() {
                SpacingBefore = new TextSpacing(TextSpacingType.Point, 30),
                ListBulletColor = new TextBulletColor(new OfficeColor(Color.Red)),
                ListBullet = new CharListBullet('■'),
                ListBulletSize = new TextBulletSize(TextBulletSizeType.Point, 30)
            };
            textArea.Paragraphs.Add(paragraph2);
            shape.TextArea = textArea;
    
            shape.X = 30;
            shape.Y = 30;
            shape.Width = 800;
            shape.Height = 400;
    
            slide.Shapes.Add(shape);
        }
    }
    

    Implements

    See Also