引用符プレフィックス

Excel同様、SpreadJSでは引用符プレフィックス機能がサポートされます。

引用符プレフィックス「'」を使用して入力した値は、文字列として変換および保存されます。
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount: 1}); initFunction(spread); }; function initFunction(spread) { var fbx = new GC.Spread.Sheets.FormulaTextBox.FormulaTextBox(document.getElementById('formulaBar')); fbx.workbook(spread); var sheet = spread.getActiveSheet(); sheet.suspendPaint(); sheet.setColumnWidth(1, 100); sheet.setColumnWidth(2, 300); sheet.setValue(1, 0, 'Sample:'); sheet.setValue(2, 1, 'Normal'); sheet.setValue(3, 1, 'Quote Prefix'); sheet.setValue(4, 1, 'Normal'); sheet.setValue(5, 1, 'Quote Prefix'); spread.commandManager().execute({ cmd: "editCell", sheetName: "Sheet1", row: 2, col: 2, newValue: "12" }); spread.commandManager().execute({ cmd: "editCell", sheetName: "Sheet1", row: 3, col: 2, newValue: "'12" }); spread.commandManager().execute({ cmd: "editCell", sheetName: "Sheet1", row: 4, col: 2, newValue: "4/2/2020 13:39:48" }); spread.commandManager().execute({ cmd: "editCell", sheetName: "Sheet1", row: 5, col: 2, newValue: "'4/2/2020 13:39:48" }); sheet.resumePaint(); }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta name="spreadjs culture" content="ja-jp" /> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/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="formulaBar" contenteditable="true" spellcheck="false" style="border: 1px solid grey; height: 21px; width: 100%; overflow: hidden; font-size: 13px; font-family: arial, sans, sans-serif; margin-bottom: 3px; padding-top: 3px; padding-bottom: 3px"></div> <div id="ss" style="width:100%; height:100%; border: 1px solid gray;"></div> </div></body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }