SpreadJS 13
SpreadJS Documentation / Developer's Guide / Features / Manage Data Visualization and Objects / Barcodes / Codabar
In This Topic
    Codabar
    In This Topic

    Codabar is a barcode that uses alphanumeric characters including : A B C D + - : . / $ and all numbers.

    A screenshot depicting Codabar sparkline is shared below.

    Codabar sparkline

    Formula definition

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

    =BC_CODABAR(value, color, backgroudColor, showLabel, labelPosition, checkDigit, nwRatio, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, 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)'
    showLabel Specifies whether to show label text when the barcode has label.
    labelPosition ​A value that represents the label position when the label is shown.
    checkDigit Specifies whether the symbol needs a check digit. The default value is 'false'.
    nwRatio A value that represents the wide and narrow bar ratio. It has values 2|3. The default value is '3'.
    fontFamily A string that represents the label text fontFamily. The default value is 'sans-serif'.
    fontStyle A string that represents the label text fontStyle. The default value is 'normal'.
    fontWeight A string that represents the label text fontWeight. The default value is 'normal'.
    fontTextDecoration A string that represents the label text fontTextDecoration. The default value is 'none'.
    fontTextAlign A string that represents the label text fontTextAlign. The default value is 'center'.
    fontSize A string that represents the label text fontSize. The default value is '12px'.
    quietZoneLeft A value that represents the size of left quiet zone.
    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 code sets Codabar sparkline in the worksheet.

    JavaScript
    Copy Code
    var sheet = spread.getActiveSheet();
    // Set Codabar Barcode Sparkline
    sheet.setValue(3, 1, "Codabar", GC.Spread.Sheets.SheetArea.viewport);
    sheet.setValue(3, 2, "9787560044231", GC.Spread.Sheets.SheetArea.viewport);
    // Set 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 Formula
    sheet.setFormula(3, 3, '=BC_CODABAR(C4)');