TX Sheet Control

Cell.setBarcode Method

Method

Displays a barcode while retaining the underlying value or formula. Omit options to remove only the barcode.

Package: @txtextcontrol/tx-sheet-control.

Syntax

setBarcode(options?: BarcodeOptions): this

Example

Use an existing workbook as book.

import { Workbook as ExampleWorkbook } from '@txtextcontrol/tx-sheet-control';
const book = new ExampleWorkbook();

const sheet = book.sheets.at(0);
sheet.cell('A2').setText('000123');
sheet.cell('A2').setBarcode({ symbology: 'code128' });

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 for validation, supported payloads and XLSX behavior.