EAN13 条形码

EAN-13是常见的最终产品条形码协议和标准的比较,主要用于超市和其他零售。

EAN-13是比较常见的终端产品条码协议和标准,主要用于超市和其他零售行业。 你可以通过公式BC_EAN13来创建一个EAN-13条形码: =BC_EAN13(value, color, backgroudColor, showLabel, labelPosition, addOn, addOnLabelPosition, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZonLeft, quietZoneRight, quietZoneTop, quietZoneBottom). 公式包含以下参数: value: 条形码编码数值,数值只能为数字类型且长度只能为12或者13 addOn: 附加码数值,数值只能是数字且长度为2或者4 addOnLabelPosition: 附加码标识位置
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_EAN13(C' + (row + 1) + ')'); sheet.setFormula(row, 4, '=BC_EAN13(C' + (row + 1) + ',,,,,22)'); sheet.setFormula(row, 5, '=BC_EAN13(C' + (row + 1) + ',,,,,22,"bottom")'); } sheet.setValue(5, 6, 'No EAN-13 generated, because the last digit is check-sum digit and it is invalid'); } function _setData(sheet) { var pos = [1, 2, 6]; for (var i = 0; i < pos.length; i++) { sheet.addSpan(1, pos[i], 2, 1); } var dataArray = [ ['Medicine', 692031229621], ['Pen', 6945091701532], [ 'value length is 13', 8142486545683 // 'No EAN-13 generated, because the last digit is check-sum digit and it is invalid' ] ]; sheet.setArray(3, 1, dataArray); sheet.addSpan(1, 3, 1, 3); sheet.setValue(1, 1, 'Name'); sheet.setValue(1, 2, 'Number'); sheet.setValue(1, 3, 'EAN-13'); sheet.setValue(1, 6, 'Explain'); sheet.setValue(2, 3, 'Default'); sheet.setValue(2, 4, 'Change addOn'); sheet.setValue(2, 5, 'Change addOnLabelPosition'); } function _setStyle(sheet) { sheet.setColumnWidth(0, 20); for (var row = 3; row < 6; row++) { sheet.setRowHeight(row, 100); } for (var col = 1; col < 7; col++) { sheet.setColumnWidth(col, 200); } sheet .getRange(1, 1, 2, 6) .foreColor('#000') .backColor('#FFF3CE') .setBorder(new GC.Spread.Sheets.LineBorder('orange', GC.Spread.Sheets.LineStyle.thin), {all: true}); sheet .getRange(1, 1, 5, 6) .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.getCell(5, 6).foreColor('red').wordWrap(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; }