Add Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Adds to new formatting style to the current document.
Syntax
public bool Add(ParagraphStyle paragraphStyle);Public Function Add(paragraphStyle As ParagraphStyle) As BooleanParameters
| Parameter | Description |
|---|---|
| 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.");
}Dim paragraphStyleCollection As ParagraphStyleCollection = textControl.ParagraphStyles
If Not paragraphStyleCollection.Add(New ParagraphStyle("CustomerName")) Then
Throw New InvalidOperationException("The item could not be inserted.")
End If