# BarcodeOptions Class

> BarcodeOptions class in the TX Sheet Control .NET API: Native barcode configuration for cell and floating symbols. Shown with a C# example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **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)
- **Derived:** `TXTextControl.TXSheetControl.Server.BarcodeDrawingOptions`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > BarcodeOptions Class
- **1352 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/llms-full.txt

---

Native barcode configuration for cell and floating symbols.

### Syntax

```csharp
public class BarcodeOptions
{
    public string Symbology { get; init; }
    public string? Source { get; init; }
    public string? Value { get; init; }
    public bool? ShowText { get; init; }
    public string? Foreground { get; init; }
    public string? Background { get; init; }
    public string? ErrorCorrection { get; init; }
    public int? Version { get; init; }
}
```

### Remarks

See [Barcodes and QR Codes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/barcodes/llms-full.txt) for a complete .NET example, source validation, mail merge and file compatibility.

- [Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/constructor/llms-full.txt) — Creates settings.
- [Symbology](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/symbology-property/llms-full.txt) — Required format: code128, code39, ean13, ean8, upca, upce, itf, codabar or qrCode.
- [Source](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/source-property/llms-full.txt) — Cell reference or formula, with an optional leading equals sign. Mutually exclusive with value. Maximum 8192 characters; cannot be blank.
- [Value](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/value-property/llms-full.txt) — Literal payload, mutually exclusive with source. Maximum 8192 characters. Omit both to read the owning or anchor cell.
- [ShowText](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/showtext-property/llms-full.txt) — Human-readable caption for linear codes; defaults to true. QR codes always omit the caption.
- [Foreground](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/foreground-property/llms-full.txt) — Six-digit RGB color. Defaults to #000000.
- [Background](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/background-property/llms-full.txt) — Six-digit RGB color. Defaults to #ffffff.
- [ErrorCorrection](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/errorcorrection-property/llms-full.txt) — QR correction level. Defaults to M.
- [Version](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/version-property/llms-full.txt) — QR version 1–40. Omit to choose the smallest version that fits.

### Constructor

```csharp
public BarcodeOptions()
```

Creates an instance with the property defaults shown in this reference. Settings are validated when applied to the owning document; result objects obtained from document operations are detached snapshots.

### Examples

Create and save a label workbook with the configured barcode settings.

```csharp
using TXTextControl.TXSheetControl.Server;

static async Task<byte[]> CreateLabelsAsync(ServerSheetControl control)
{
    var sheet = await control.Workbook.Sheets.AtAsync(0);
    await sheet.Cell("A1").SetTextAsync("https://example.com/invoice/1042");
    var options = new BarcodeOptions {
        Symbology = "qrCode", Source = "A1", ShowText = false,
        Foreground = "#163b63", Background = "#ffffff", ErrorCorrection = "M", Version = 3
    };
    await sheet.Cell("B2").SetBarcodeAsync(options);
    await sheet.Cell("D2").SetBarcodeAsync(new BarcodeOptions { Symbology = "code128", Value = "001042", ShowText = true });
    var snapshot = await sheet.Cell("B2").GetBarcodeAsync();
    return await control.SaveAsync(StreamType.SpreadsheetML);
}
```

---

## In This Section

- [BarcodeOptions.Background Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/background-property/llms-full.txt): BarcodeOptions.Background property in the TX Sheet Control .NET API: Six-digit RGB color. Defaults to #ffffff. Shown with its type string? and a C# example.
- [BarcodeOptions Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/constructor/llms-full.txt): BarcodeOptions constructor in the .NET API: Creates native barcode settings; Symbology defaults to code128 and optional settings are omitted from transport.
- [BarcodeOptions.ErrorCorrection Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/errorcorrection-property/llms-full.txt): BarcodeOptions.ErrorCorrection property in the TX Sheet Control .NET API: QR correction level. Defaults to M. Shown with its type string? and a C# example.
- [BarcodeOptions.Foreground Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/foreground-property/llms-full.txt): BarcodeOptions.Foreground property in the TX Sheet Control .NET API: Six-digit RGB color. Defaults to #000000. Shown with its type string? and a C# example.
- [BarcodeOptions.ShowText Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/showtext-property/llms-full.txt): BarcodeOptions.ShowText property in the TX Sheet Control .NET API: Human-readable caption for linear codes; defaults to true. QR codes always omit the caption.
- [BarcodeOptions.Source Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/source-property/llms-full.txt): BarcodeOptions.Source property in the .NET API: Cell reference or formula of up to 8192 characters, mutually exclusive with Value; it cannot be blank.
- [BarcodeOptions.Symbology Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/symbology-property/llms-full.txt): BarcodeOptions.Symbology property in the TX Sheet Control .NET API: Required format: code128, code39, ean13, ean8, upca, upce, itf, codabar or qrCode.
- [BarcodeOptions.Value Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/value-property/llms-full.txt): BarcodeOptions.Value property in the .NET API: Literal payload of up to 8192 characters, mutually exclusive with Source; omit both to read the cell.
- [BarcodeOptions.Version Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/version-property/llms-full.txt): BarcodeOptions.Version property in the TX Sheet Control .NET API: QR version 1–40. Omit to choose the smallest version that fits.

---

## Nearby

- **Previous:** [DashboardHighlight.Value Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/dashboardhighlight/value-property/llms-full.txt)
- **Next:** [BarcodeOptions Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/barcodeoptions/constructor/llms-full.txt)
