TX Sheet Control

BarcodeSymbol.rows Property

Property

Detached module rows; true denotes a dark module. The quiet zone is excluded.

Package: @txtextcontrol/tx-sheet-control.

Syntax

rows: boolean[][]

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.

Examples

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

import { encodeBarcode } from '@txtextcontrol/tx-sheet-control';
import type { BarcodeSymbol, BarcodeSymbology } from '@txtextcontrol/tx-sheet-control';

const symbology: BarcodeSymbology = 'qrCode';
const symbol: BarcodeSymbol = encodeBarcode({ symbology, value: 'Invoice 1042' });
const canvas = document.createElement('canvas');
const moduleSize = 4;
canvas.width = (symbol.rows[0].length + symbol.quietZone * 2) * moduleSize;
canvas.height = (symbol.rows.length + symbol.quietZone * 2) * moduleSize;
canvas.setAttribute('aria-label', symbol.text);
canvas.dataset.symbolType = symbol.isMatrix ? 'matrix' : 'linear';
const context = canvas.getContext('2d')!;
context.fillStyle = '#ffffff';
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = '#000000';
symbol.rows.forEach((row, y) => row.forEach((isDark, x) => {
    if (isDark) context.fillRect((x + symbol.quietZone) * moduleSize, (y + symbol.quietZone) * moduleSize, moduleSize, moduleSize);
}));
document.body.append(canvas);