特殊粘贴

SpreadJS支持特殊粘贴功能,以便进行更个性化的粘贴。以下示例演示了可用的不同粘贴类型。

“特殊粘贴”功能可以通过以下两种方式使用: 上下文菜单: 打开 菜单 并且点击 选择性粘贴… 快捷键: 按下 Ctrl + Alt + V 另外,您可以使用“粘贴”命令来执行特殊的粘贴命令,例如:
window.onload = function() { let spread = new GC.Spread.Sheets.Workbook('ss'); // open sjs fetch(getFileUrl()).then(res => res.blob()).then(file => spread.open(file)); spread.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, args) { var sheet = args.sheet, row = args.row, col = args.col; var cellType = sheet.getCellType(row, col); if (cellType) { sheet.options.showFormulas = !!sheet.getValue(row, col); } }); }; function getFileUrl () { return '$DEMOROOT$/spread/source/data/pasteSpecialDemo.sjs'; }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="spreadjs culture" content="zh-cn" /> <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-io/dist/gc.spread.sheets.io.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-spreadsheets"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } .sample-spreadsheets { width: 100%; height: 100%; overflow: hidden; float: left; } .option-row { font-size: 14px; padding: 5px; margin-top: 10px; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }