# InlineStyleCollection.Add Method

> Adds to new formatting style to the current document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 10.1
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > InlineStyleCollection.Add Method
- **489 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inlinestylecollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inlinestylecollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inlinestylecollection/add-method/llms-full.txt

---

### Description

Adds to new formatting style to the current document.

### Syntax

```csharp
public bool Add(InlineStyle inlineStyle);
```

```vbnet
Public Function Add(inlineStyle As InlineStyle) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| inlineStyle | 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 inline styles in the current document by using `InlineStyleCollection.Add`.

```csharp
InlineStyleCollection inlineStyleCollection = textControl.InlineStyles;

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

```vbnet
Dim inlineStyleCollection As InlineStyleCollection = textControl.InlineStyles

If Not inlineStyleCollection.Add(New InlineStyle("CustomerName")) Then
    Throw New InvalidOperationException("The item could not be inserted.")
End If
```

---

## Nearby

- **Previous:** [InlineStyleCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inlinestylecollection/llms-full.txt)
- **Next:** [InlineStyleCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inlinestylecollection/copyto-method/llms-full.txt)
