Back to Devexpress

ParagraphStyleCollection.Add(ParagraphStyle) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraphstylecollection-dot-add-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraphstyle-x29.md

latest5.9 KB
Original Source

ParagraphStyleCollection.Add(ParagraphStyle) Method

Add a style to the collection of styles in the current document.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void Add(
    ParagraphStyle style
)
vb
Sub Add(
    style As ParagraphStyle
)

Parameters

NameTypeDescription
styleParagraphStyle

A ParagraphStyle class instance representing a paragraph style.

|

Remarks

A collection of styles in the document can be accessed via the Document.ParagraphStyles property. To create a new style, use the ParagraphStyleCollection.CreateNew method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(ParagraphStyle) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-rich-edit-text-formatting/CS/Text Formatting Example/Form1.cs#L107

csharp
//Add the object to the document collection
document.ParagraphStyles.Add(chapterStyle);

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Styles.cs#L46

csharp
pstyle.Alignment = ParagraphAlignment.Center;
    document.ParagraphStyles.Add(pstyle);
}

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/StylesActions.cs#L46

csharp
pstyle.Alignment = ParagraphAlignment.Center;
    document.ParagraphStyles.Add(pstyle);
}

winforms-richedit-table-of-contents-practical-guide/CS/Form1.cs#L122

csharp
paragraphStyle.OutlineLevel = level;
    Document.ParagraphStyles.Add(paragraphStyle);
}

word-document-api-examples/CS/CodeExamples/StylesActions.cs#L79

csharp
// Add the style to the collection of paragraph styles.
    document.ParagraphStyles.Add(pstyle);
}

winforms-rich-edit-text-formatting/VB/Text Formatting Example/Form1.vb#L102

vb
'Add the object to the document collection
document.ParagraphStyles.Add(chapterStyle)

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Styles.vb#L42

vb
pstyle.Alignment = DevExpress.XtraRichEdit.API.Native.ParagraphAlignment.Center
    document.ParagraphStyles.Add(pstyle)
End If

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/StylesActions.vb#L39

vb
pstyle.Alignment = ParagraphAlignment.Center
    document.ParagraphStyles.Add(pstyle)
End If

word-document-api-examples/VB/CodeExamples/StylesActions.vb#L67

vb
' Add the style to the collection of paragraph styles.
    document.ParagraphStyles.Add(pstyle)
End If

winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L113

vb
paragraphStyle.OutlineLevel = level
    Document.ParagraphStyles.Add(paragraphStyle)
End If

See Also

ParagraphStyles

CreateNew()

ParagraphStyleCollection Interface

ParagraphStyleCollection Members

DevExpress.XtraRichEdit.API.Native Namespace