CODE39

CODE 39 is the barcode developed by Intermec Corporation in 1975. Up to 43 characters including numbers, letters and some symbols can be included in the barcode.

You can create a Code39 barcode using the BC_CODE39 function in a formula: =BC_CODE39(value, color, backgroundColor, showLabel, labelPosition, labelWithStartAndStopCharacter, checkDigit, nwRatio, fullASCII, fontFamily, fontStyle, fontWeight, fontTextDecoration, fontTextAlign, fontSize, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom). The function has the following parameters: value: this type must be a string that contains only numbers, uppercase letters, and symbols like '+', '-', '/', '$', and '%'. labelWithStartAndStopCharacter: ​(default value is false) this value indicates whether to show the start and stop character in the label. checkDigit: (default value is false) this value specifies if 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. fullASCII: (default value is false) this value indicates if the bar code supports full ASCII.
import * as React from 'react'; import { createRoot } from 'react-dom/client'; import './styles.css'; import { AppFunc } from './app-func'; // import { App } from './app-class'; // 1. Functional Component sample createRoot(document.getElementById('app')).render(<AppFunc />); // 2. Class Component sample // createRoot(document.getElementById('app')).render(<App />);
import * as React from 'react'; import GC from '@mescius/spread-sheets'; import '@mescius/spread-sheets-barcode'; import { SpreadSheets, Worksheet } from '@mescius/spread-sheets-react'; export function AppFunc() { let spread = null; let autoGenerateColumns = true; const initSpread = (currSpread) => { spread = currSpread; spread.suspendPaint(); let sheet = spread.getSheet(0); sheet.name('customSheet'); _setData(sheet); _setStyle(sheet); for (let 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")'); } spread.resumePaint(); } const _setData = (sheet) => { let headers = [ [ 'Default ', 'Change labelWithStartAndStopCharacter', 'Change checkDigit', 'Change nwRatio', 'Change fullASCII' ] ]; let 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); } const _setStyle = (sheet) => { sheet.setColumnWidth(0, 20); for (let row = 3; row < 6; row++) { sheet.setRowHeight(row, 100); } for (let 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 }); } return ( <div class="sample-tutorial"> <div class="sample-spreadsheets"> <SpreadSheets workbookInitialized={initSpread}> <Worksheet autoGenerateColumns={autoGenerateColumns} /> </SpreadSheets> </div> </div> ); }
import * as React from 'react'; import GC from '@mescius/spread-sheets'; import '@mescius/spread-sheets-barcode'; import { SpreadSheets, Worksheet } from '@mescius/spread-sheets-react'; const Component = React.Component; export class App extends Component { constructor(props) { super(props); this.spread = null; this.autoGenerateColumns = true; } render() { return ( <div class="sample-tutorial"> <div class="sample-spreadsheets"> <SpreadSheets workbookInitialized={spread => this.initSpread(spread)}> <Worksheet autoGenerateColumns={this.autoGenerateColumns} /> </SpreadSheets> </div> </div> ); } initSpread(spread) { this.spread = spread; spread.suspendPaint(); let sheet = spread.getSheet(0); sheet.name('customSheet'); this._setData(sheet); this._setStyle(sheet); for (let 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")'); } spread.resumePaint(); } _setData(sheet) { let headers = [ [ 'Default ', 'Change labelWithStartAndStopCharacter', 'Change checkDigit', 'Change nwRatio', 'Change fullASCII' ] ]; let 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); } _setStyle(sheet) { sheet.setColumnWidth(0, 20); for (let row = 3; row < 6; row++) { sheet.setRowHeight(row, 100); } for (let 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 charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/react/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <!-- SystemJS --> <script src="$DEMOROOT$/en/react/node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('$DEMOROOT$/en/lib/react/license.js').then(function () { System.import('./src/app'); }); </script> </head> <body> <div id="app"></div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } .sample-spreadsheets { width: 100%; height: 100%; overflow: hidden; float: left; } .options-container legend { text-align: center; } .option-row { font-size: 14px; padding: 5px; } input { display:block; width: 100%; margin: 8px 0; box-sizing: border-box; } label, input { padding: 4px 6px; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } #app { height: 100%; } #drawUnderline { display: inline-block; width: 30px; } #drawUnderlineLabel { display: inline-block; } #allowAutoCreateHyperlink { display: inline-block; width: 30px; } #setHyperlinkButton { font-weight: bold; background-color: #ecf3ff; width: 200px; height: 35px; border-radius: 4px; border-color: #0b93d5; border-width: thin; }
(function (global) { System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true, react: true }, meta: { '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-barcode': 'npm:@mescius/spread-sheets-barcode/index.js', '@mescius/spread-sheets-react': 'npm:@mescius/spread-sheets-react/index.js', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js', 'react': 'npm:react/cjs/react.production.js', 'react-dom': 'npm:react-dom/cjs/react-dom.production.js', 'react-dom/client': 'npm:react-dom/cjs/react-dom-client.production.js', 'scheduler': 'npm:scheduler/cjs/scheduler.production.js', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'jsx' }, "node_modules": { defaultExtension: 'js' }, } }); })(this);