Class TextParagraph

TextParagraph class

Represents the text paragraph setting.

public class TextParagraph : FontSetting

Properties

NameDescription
AlignmentType { get; set; }Gets and sets the text horizontal alignment type of the paragraph.
Bullet { get; }Gets the bullet.
Children { get; }Gets all text runs in this paragraph. If this paragraph is empty, return paragraph itself.
DefaultTabSize { get; set; }Gets and sets the default size for a tab character within this paragraph.
FirstLineIndent { get; set; }Specifies the indent size that will be applied to the first line of text in the paragraph.
Font { get; }Returns the font of this object.(Inherited from FontSetting.)
FontAlignType { get; set; }Determines where vertically on a line of text the actual words are positioned. This deals with vertical placement of the characters with respect to the baselines.
IsEastAsianLineBreak { get; set; }Specifies whether an East Asian word can be broken in half and wrapped onto the next line without a hyphen being added.
IsHangingPunctuation { get; set; }Specifies whether punctuation is to be forcefully laid out on a line of text or put on a different line of text.
IsLatinLineBreak { get; set; }Specifies whether a Latin word can be broken in half and wrapped onto the next line without a hyphen being added.
LeftMargin { get; set; }Specifies the left margin of the paragraph.
Length { get; }Gets the length of the characters.(Inherited from FontSetting.)
LineSpace { get; set; }Gets and sets the amount of vertical white space that will be used within a paragraph.
LineSpaceSizeType { get; set; }Gets and sets the amount of vertical white space that will be used within a paragraph.
RightMargin { get; set; }Specifies the right margin of the paragraph.
SpaceAfter { get; set; }Gets and sets the amount of vertical white space that will be present after a paragraph.
SpaceAfterSizeType { get; set; }Gets and sets the amount of vertical white space that will be present after a paragraph.
SpaceBefore { get; set; }Gets and sets the amount of vertical white space that will be present before a paragraph.
SpaceBeforeSizeType { get; set; }Gets and sets the amount of vertical white space that will be present before a paragraph.
StartIndex { get; }Gets the start index of the characters.(Inherited from FontSetting.)
Stops { get; }Gets tab stop list.
TextOptions { get; }Returns the text options.(Inherited from FontSetting.)
override Type { get; }Gets the type of text node.

Methods

NameDescription
SetWordArtStyle(PresetWordArtStyle)Sets the preset WordArt style.(Inherited from FontSetting.)

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Drawing.Texts;

namespace AsposeCellsExamples
{
    public class TextsClassTextParagraphDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Add a text box to the worksheet
            int textBoxIndex = sheet.TextBoxes.Add(10, 10, 200, 100);
            Aspose.Cells.Drawing.TextBox textBox = sheet.TextBoxes[textBoxIndex];
            
            // Set text content with multiple paragraphs
            textBox.Text = "First paragraph\nSecond paragraph\nThird paragraph";

            // Access and modify text paragraphs
            foreach (TextParagraph paragraph in textBox.TextBody.TextParagraphs)
            {
                // Set paragraph properties
                paragraph.LineSpaceSizeType = LineSpaceSizeType.Points;
                paragraph.LineSpace = 20;
                paragraph.AlignmentType = TextAlignmentType.Center;
            }

            // Save the workbook
            workbook.Save("TextParagraphDemo.xlsx");
        }
    }
}

See Also