Codabar

Codabar is the barcode developed by Monarch Marking Systems in 1972. It is the barcode introduced in the early stages following ‘code 2 of 5’. It is widely used for applications that require serial numbers, such as management of blood banks, slips for door-to-door delivery services and membership cards.

You can create a Codabar using the BC_CODABAR function in a formula: =BC_CODABAR(value, color, backgroundColor, showLabel, labelPosition, checkDigit, nwRatio, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom). The function has the following parameters: value: this type must be string that contains only '+', '-', '/', '$', '.', ':', and 0-9. checkDigit: (default value is false) this value represents whether the symbol needs a check digit. nwRatio: (default value is 3) this value represents the wide and narrow bar ratio, which can only be 2 or 3.
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), {sheetCount: 2}); initSpread(spread); }; function initSpread(spread) { var sheet = spread.getSheet(0); spread.suspendPaint(); _initBasicSheet(sheet); spread.resumePaint(); } function _initBasicSheet(sheet) { sheet.name('customSheet'); _setData(sheet); _setStyle(sheet); for (var row = 3; row < 6; row++) { sheet.setFormula(row, 3, '=BC_CODABAR(C' + (row + 1) + ')'); sheet.setFormula(row, 4, '=BC_CODABAR(C' + (row + 1) + ',,,,,"true")'); sheet.setFormula(row, 5, '=BC_CODABAR(C' + (row + 1) + ',,,,,,"2")'); } } function _setData(sheet) { var headers = [['Default', 'Change checkDigit', 'Change nwRatio']]; var dataArray = [ ['Notebook', 6935205311092], ['Paper', 6922266446146], ['Value can contain letters and some symbol', 'A1234+-/.$A'] ]; sheet.setArray(3, 1, dataArray); sheet.addSpan(1, 1, 2, 1); sheet.addSpan(1, 2, 2, 1); sheet.addSpan(1, 3, 1, 3); sheet.setValue(1, 1, 'Name'); sheet.setValue(1, 2, 'Number'); sheet.setValue(1, 3, 'Codabar'); sheet.setArray(2, 3, headers); } function _setStyle(sheet) { sheet.setColumnWidth(0, 20); for (var row = 3; row < 6; row++) { sheet.setRowHeight(row, 100); } for (var col = 1; col < 8; col++) { sheet.setColumnWidth(col, 200); } sheet .getRange(1, 1, 2, 5) .foreColor('#000') .backColor('#FFF3CE') .setBorder(new GC.Spread.Sheets.LineBorder('orange', GC.Spread.Sheets.LineStyle.thin), {all: true}); sheet .getRange(1, 1, 5, 5) .vAlign(GC.Spread.Sheets.VerticalAlign.center) .hAlign(GC.Spread.Sheets.HorizontalAlign.center) .setBorder(new GC.Spread.Sheets.LineBorder('orange', GC.Spread.Sheets.LineStyle.medium), {outline: true}); sheet.getRange(1, 1, 5, 1).wordWrap(true); }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-barcode/dist/gc.spread.sheets.barcode.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-resources-ja/dist/gc.spread.sheets.resources.ja.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" class="sample-tutorial"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }