CODE39 条形码

CODE 39是Intermec Corporation于1975年开发的条形码。条形码中最多可包含43个字符,包括数字,字母和一些符号。

你可以通过BC_CODE39公式创建Code39条形码:=BC_CODE39(value, color, backgroudColor, showLabel, labelPosition, labelWithStartAndStopCharacter, checkDigit, nwRatio, fullASCII, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZonLeft, quietZoneRight, quietZoneTop, quietZoneBottom). 公式包含以下参数: value: 条形码编码数值,数值只能包含数字,大写字母以及符号 '+', '-', '/', '$', 和 '%'. labelWithStartAndStopCharacter: 是否在条形码标注中显示开始或终止字符 checkDigit: 是否包含校验码(默认值为 false) nwRatio: 表示条形码宽窄条的比例(默认值是3),只允许为2或者3 fullASCII: 表示条形码是否支持全ASCII编码字符集(默认值是 false)
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), {sheetCount: 1}); 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_CODE39(C' + (row + 1) + ')'); sheet.setFormula(row, 4, '=BC_CODE39(C' + (row + 1) + ',,,,,"true")'); sheet.setFormula(row, 5, '=BC_CODE39(C' + (row + 1) + ',,,,,,"true")'); sheet.setFormula(row, 6, '=BC_CODE39(C' + (row + 1) + ',,,,,,,2)'); sheet.setFormula(row, 7, '=BC_CODE39(C' + (row + 1) + ',,,,,,,,"true")'); } } function _setData(sheet) { var headers = [ [ 'Default ', 'Change labelWithStartAndStopCharacter', 'Change checkDigit', 'Change nwRatio', 'Change fullASCII' ] ]; var dataArray = [ ['Paper', 6922266446146], ['Book', 9787560044231], ['Value can contain some symbol', '1234+-#*'] ]; sheet.setArray(3, 1, dataArray); sheet.addSpan(1, 1, 2, 1); sheet.addSpan(1, 2, 2, 1); sheet.addSpan(1, 3, 1, 5); sheet.setValue(1, 1, 'Name'); sheet.setValue(1, 2, 'Number'); sheet.setValue(1, 3, 'Code39'); 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, 240); } sheet .getRange(1, 1, 2, 7) .foreColor('#000') .backColor('#FFF3CE') .setBorder(new GC.Spread.Sheets.LineBorder('orange', GC.Spread.Sheets.LineStyle.thin), {all: true}); sheet .getRange(1, 1, 5, 7) .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}); }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta name="spreadjs culture" content="zh-cn" /> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-barcode/dist/gc.spread.sheets.barcode.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-resources-zh/dist/gc.spread.sheets.resources.zh.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; }