Click or drag to resize

Paragraph Class

Represents a paragraph of content in the document.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version: 3.7.4.3 (3.7.4.3)
Syntax
public sealed class Paragraph : Block, 
	IContentElement

The Paragraph type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCharacterFormatForParagraphMark
Gets or sets the character format for the paragraph mark.
Public propertyContent
Gets the ContentRange of the current element.
(Inherited from Element.)
Public propertyDocument
Gets the owner document.
(Inherited from Element.)
Public propertyElementType
Gets the ElementType of this element instance.
(Overrides ElementElementType.)
Public propertyFrameFormat
Gets the text frame format.
Public propertyCode exampleInlines
Gets the paragraph's inlines.
Public propertyCode exampleListFormat
Gets or sets the list format.
Public propertyCode exampleListItem
Gets the list item or null if paragraph doesn't have list item.
Public propertyNextSibling
Gets the next Element sibling.
(Inherited from Element.)
Public propertyCode exampleParagraphFormat
Gets or sets the paragraph format.
Public propertyParent
Gets the parent of this element instance.
(Inherited from Element.)
Public propertyParentCollection
Gets the BlockCollection that contains this Block instance.
(Inherited from Block.)
Public propertyPreviuosSibling
Gets the previous Element sibling.
(Inherited from Element.)
Top
Methods
  NameDescription
Public methodCode exampleClone
Clones this element instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodCode exampleGetChildElements(Boolean)
Gets the child elements.
(Inherited from Element.)
Public methodCode exampleGetChildElements(Boolean, ElementType)
Gets the child elements filtered by ElementType.
(Inherited from Element.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Explicit Interface Implementations
Examples
Creates a new document with a one paragraph in C#
using SautinSoft.Document;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            Paragraph();
        }
        /// <summary>
        /// Creates a new document with a paragraph.
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/examples/paragraph.php
        /// </remarks>
        static void Paragraph()
        {
            DocumentCore dc = new DocumentCore();

            string filePath = @"Result-file.docx";

            dc.Sections.Add(
                new Section(dc,
                    new Paragraph(dc, "Text is right aligned.")
                    {
                        ParagraphFormat = new ParagraphFormat
                        {
                            Alignment = HorizontalAlignment.Right
                        }
                    },
                    new Paragraph(dc, "This paragraph has the following properties: Left indentation is 15 points, right indentation is 5 centimeters, hanging indentation is 10 points, line spacing is exactly 14 points, space before and space after are 10 points.")
                    {
                        ParagraphFormat = new ParagraphFormat
                        {
                            LeftIndentation = 15,
                            RightIndentation = LengthUnitConverter.Convert(5, LengthUnit.Centimeter, LengthUnit.Point),
                            SpecialIndentation = 10,
                            LineSpacing = 14,
                            LineSpacingRule = LineSpacingRule.Exactly,
                            SpaceBefore = 10,
                            SpaceAfter = 10
                        }
                    }));

            dc.Save(filePath);
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
        }
    }
}
Creates a new document with a one paragraph in VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document

Module Sample
    Sub Main()
        Paragraph()
    End Sub

    ''' <summary>
    ''' Creates a new document with a paragraph.
    ''' </summary>
    ''' <remarks>
    ''' Details: https://sautinsoft.com/products/document/examples/paragraph.php
    ''' </remarks>
    Public Sub Paragraph()
        Dim dc As New DocumentCore()

        Dim filePath As String = "Result-file.docx"

        dc.Sections.Add(New Section(dc, New Paragraph(dc, "Text is right aligned.") With {
                .ParagraphFormat = New ParagraphFormat With {.Alignment = HorizontalAlignment.Right}
            },
            New Paragraph(dc, "This paragraph has the following properties: Left indentation is 15 points, right indentation is 5 centimeters, hanging indentation is 10 points, line spacing is exactly 14 points, space before and space after are 10 points.") With {
                .ParagraphFormat = New ParagraphFormat With {
                    .LeftIndentation = 15,
                    .RightIndentation = LengthUnitConverter.Convert(5, LengthUnit.Centimeter, LengthUnit.Point),
                    .SpecialIndentation = 10,
                    .LineSpacing = 14,
                    .LineSpacingRule = LineSpacingRule.Exactly,
                    .SpaceBefore = 10,
                    .SpaceAfter = 10
                }
            }))

        dc.Save(filePath)
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
    End Sub
End Module
See Also