# BarcodeOptions Interface

> BarcodeOptions interface in the Node.js TypeScript API: Portable barcode settings; source and value are mutually exclusive, and omitting both reads the cell.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Interface
- **Path:** TX Sheet Control > API Reference > TypeScript API > Node.js Server > BarcodeOptions Interface
- **874 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/llms-full.txt

---

Portable barcode settings. Source and literal value are mutually exclusive; omit both to read the owning or anchor cell.

Package: `@txtextcontrol/tx-sheet-control-server`.

### Syntax

```typescript
interface BarcodeOptions {
    symbology: BarcodeSymbology;
    source?: string;
    value?: string;
    showText?: boolean;
    foreground?: string;
    background?: string;
    errorCorrection?: 'L' | 'M' | 'Q' | 'H';
    version?: number;
}
```

### Remarks

Settings are detached snapshots. Cell values and formulas remain available beneath the symbol. Sources resolve after calculation and mail merge. See [Barcodes and QR Codes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/barcodes/llms-full.txt) for validation, supported payloads and XLSX behavior.

- [symbology](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/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/typescript-api/nodejs/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/typescript-api/nodejs/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/typescript-api/nodejs/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/typescript-api/nodejs/barcodeoptions/foreground-property/llms-full.txt) — Six-digit RGB color. Defaults to #000000.
- [background](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/background-property/llms-full.txt) — Six-digit RGB color. Defaults to #ffffff.
- [errorCorrection](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/errorcorrection-property/llms-full.txt) — QR correction level. Defaults to M.
- [version](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/version-property/llms-full.txt) — QR version 1–40. Omit to choose the smallest version that fits.

### Examples

Create a barcode from application data and retain its editable workbook settings.

```typescript
import { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';
import type { BarcodeOptions } from '@txtextcontrol/tx-sheet-control-server';

const control = new ServerSheetControl();
const book = control.workbook;
const sheet = book.sheets.at(0);
sheet.cell('A1').setText('https://example.com/invoice/1042');
const options: BarcodeOptions = {
    symbology: 'qrCode', source: 'A1', showText: false,
    foreground: '#163b63', background: '#ffffff', errorCorrection: 'M', version: 3,
};
sheet.cell('B2').setBarcode(options);
sheet.cell('D2').setBarcode({ symbology: 'code128', value: '001042', showText: true });
```

---

## In This Section

- [BarcodeOptions.background Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/background-property/llms-full.txt): BarcodeOptions.background property in the TX Sheet Control TypeScript API for Node.js: Six-digit RGB color. Defaults to #ffffff.
- [BarcodeOptions.errorCorrection Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/errorcorrection-property/llms-full.txt): BarcodeOptions.errorCorrection property in the TX Sheet Control TypeScript API for Node.js: QR correction level. Defaults to M.
- [BarcodeOptions.foreground Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/foreground-property/llms-full.txt): BarcodeOptions.foreground property in the TX Sheet Control TypeScript API for Node.js: Six-digit RGB color. Defaults to #000000.
- [BarcodeOptions.showText Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/showtext-property/llms-full.txt): BarcodeOptions.showText property in the TX Sheet Control TypeScript API for Node.js, with its type boolean and a TypeScript example.
- [BarcodeOptions.source Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/source-property/llms-full.txt): BarcodeOptions.source property in the TX Sheet Control TypeScript API for Node.js, with its type string and a TypeScript example.
- [BarcodeOptions.symbology Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/symbology-property/llms-full.txt): BarcodeOptions.symbology property in the TX Sheet Control TypeScript API for Node.js, with its type BarcodeSymbology and a TypeScript example.
- [BarcodeOptions.value Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/value-property/llms-full.txt): BarcodeOptions.value property in the TX Sheet Control TypeScript API for Node.js, with its type string and a TypeScript example.
- [BarcodeOptions.version Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/version-property/llms-full.txt): BarcodeOptions.version property in the TX Sheet Control TypeScript API for Node.js: QR version 1–40. Omit to choose the smallest version that fits.

---

## Nearby

- **Previous:** [DashboardExploration.canGoForward Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/dashboardexploration/cangoforward-property/llms-full.txt)
- **Next:** [BarcodeOptions.symbology Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/barcodeoptions/symbology-property/llms-full.txt)
