# CellTextStyle Constructor

> CellTextStyle constructor in the TX Sheet Control .NET API, with the parameters FontFamily, FontSize, Bold and Italic and a C# example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Constructor
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > CellTextStyle > CellTextStyle Constructor
- **1351 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/constructor/llms-full.txt

---

### Syntax

```csharp
public CellTextStyle(string? FontFamily = null, double? FontSize = null, bool? Bold = null, bool? Italic = null, bool? Underline = null, bool? Strikethrough = null, string? TextColor = null)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `FontFamily` | `string?` | Yes | Value matching FontFamily's declared type and the owning object's validation rules. |
| `FontSize` | `double?` | Yes | Value matching FontSize's declared type and the owning object's validation rules. |
| `Bold` | `bool?` | Yes | Value matching Bold's declared type and the owning object's validation rules. |
| `Italic` | `bool?` | Yes | Value matching Italic's declared type and the owning object's validation rules. |
| `Underline` | `bool?` | Yes | Value matching Underline's declared type and the owning object's validation rules. |
| `Strikethrough` | `bool?` | Yes | Value matching Strikethrough's declared type and the owning object's validation rules. |
| `TextColor` | `string?` | Yes | Value matching TextColor's declared type and the owning object's validation rules. |

### Return Value

`CellTextStyle`.

### Examples

Apply CellTextStyle to a small working document, then return the exported bytes. The caller can save or download the result.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateCellTextStyleConstructorAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Cell("B8").SetValueAsync(120);
    await sheet.Cell("B9").SetValueAsync(80);
    await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");
    await sheet.Cell("A1").SetTextAsync("October invoice");
    await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    await sheet.Range("B8:B10").FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });

    var settings = new CellTextStyle()
    {
        Bold = true,
        FontFamily = "Liberation Sans",
        FontSize = 12,
        TextColor = "#163b63"
    };

    await sheet.Cell("A1").SetTextAsync("Invoice total");
    await sheet.Cell("A1").FormatTextAsync(0, 7, settings);
    return await control.SaveAsync(StreamType.PDF);
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [CellTextStyle Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/llms-full.txt)
- [Formatting and Number Display](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formatting/llms-full.txt)

---

## Nearby

- **Previous:** [CellTextStyle Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/llms-full.txt)
- **Next:** [CellTextStyle.Bold Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/celltextstyle/bold-property/llms-full.txt)
