Paste Special

SpreadJS supports Paste Special for more customized pasting. The below demo shows some of the different types of pasting available.

The Paste Special feature can be used in one of two ways: ContextMenu: Open Context Menu and click Paste Special… Shortcut: Press Ctrl + Alt + V Additionally, you can use the "Paste" command to execute a special paste command, for example: pasteSpecialOptions Object Details pasteSpecialOptions.operationOptions: The option of paste special operation. Usage Example If pasteSpecialOptions.operationOptions is GC.Spread.Sheets.PasteOperationOptions.transform, you need to configure transformScope and transformFormula to do the transformation paste. pasteSpecialOptions.transformScope: The work scope for cell transform when pasting. Transform Paste Example
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="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-io/dist/gc.spread.sheets.io.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; }