TX Text Control .NET Server

Add Method

Method|Introduced in 10.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Adds to new formatting style to the current document.

Syntax

public bool Add(ParagraphStyle paragraphStyle);

Parameters

ParameterDescription
paragraphStyle

Specifies the style to add.

Return Value

The return value is true, if the style could be added. Otherwise it is false.

Examples

The following example works with paragraph styles in the current document by using ParagraphStyleCollection.Add.

ParagraphStyleCollection paragraphStyleCollection = textControl.ParagraphStyles;

if (!paragraphStyleCollection.Add(new ParagraphStyle("CustomerName")))
{
    throw new InvalidOperationException("The item could not be inserted.");
}