SpreadJS Documentation
Setting DataMatrix
SpreadJS Documentation > Developer's Guide > Managing Data Visualization and Objects > Working with Barcodes > Setting DataMatrix

DataMatrix barcode is a high density, two-dimensional barcode with square modules typically arranged in a square or a rectangular matrix pattern.

A screenshot depicting datamatrix barcode sparkline is shared below.

Formula definition

You can set Datamatrix sparkline in a worksheet using the following formula:

=BC_DataMatrix(value, color, backgroudColor, eccMode, ecc200SymbolSize, ecc200EndcodingMode, ecc00_140Symbole, structureAppend, structureNumber, fileIdentifier, quietZoneRight, quietZoneTop, quietZoneBottom)

Parameter

Name Description
value A string that represents encode on the symbol of QRCode.
color A color that represents the barcode color. The default value is 'rgb(0,0,0)'.
backgroundColor A color that represents the barcode backgroundcolor. The default value is 'rgb(255, 255, 255)'
eccMode A value that represents which ecc mode to use. It has the following values : 'ECC000, ECC050, ECC080, ECC100, ECC140, ECC200'.
ecc200SymbolSize A value that specifies the size of the ECC200 symbol only. The default value is 'squareAuto'.
ecc200EndcodingMode A value that specifies which encoding mode to use for the symbol. The default value is 'auto'.
ecc00_140Symbole A value that specifies the size of the ECC000-140 symbol only. The default value is 'auto'.
structureAppend Specifies whether the symbol is part of a structured append message ECC200 only.The default value is 'false'.
structureNumber A value that represents which block the symbol is in the structured append message. It has the value '0-15', only for ECC200. The default value is '0'.
fileIdentifier A value that specifies the file identification. It has values '1-254', only for ECC200. The default value is '0'.
quietZoneRight A value that represents the size of right quiet zone.
quietZoneTop A value that represents the size of top quiet zone.
quietZoneBottom A value that represents the size of bottom quiet zone.

Using Code

This example creates a DataMatrix barcode sparkline.

JavaScript
Copy Code

var sheet = spread.getActiveSheet();

// Datamatrix sets the barcode sparkline
sheet.setValue(3, 1, "Data Matrix", GC.Spread.Sheets.SheetArea.viewport);
sheet.setValue(3, 2, "Policy:411", GC.Spread.Sheets.SheetArea.viewport);

// Set the style
sheet.setRowHeight(3, 100);
for (var col = 1; col < 4; col++)
{
    sheet.setColumnWidth(col, 200);
}
sheet.getRange(3, 0, 1, 4).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
sheet.getRange(3, 0, 1, 4).vAlign(GC.Spread.Sheets.VerticalAlign.center);

// Set the Formula
sheet.setFormula(3, 3, '=BC_DataMatrix(C4)');