是将 箭头指的 粘贴的方法paste_operation(spread, 'values') 这个替换掉null么?
- function paste_operation(spread, content) {
- var value = JSON.parse(sessionStorage.getItem('cutCopy_value')),
- sheet = spread.getActiveSheet(),
- selections = sheet.getSelections();
- for (var i = 0; i < selections.length; i++) {
- var target_row = selections[i].row,
- target_col = selections[i].col;
- for (var k in value) {
- for (var j in value[k]) {
- var style = new GC.Spread.Sheets.Style();
- if (content == 'formula') {
- sheet.setFormula(parseInt(k) + target_row, parseInt(j) + target_col, value[k][j].formula);
- } else if (content == 'formatting') {
- for (var h in value[k][j].style) {
- if (typeof value[k][j].style[h] == 'string') {
- style[h] = value[k][j].style[h]
- }
- }
- sheet.setStyle(parseInt(k) + target_row, parseInt(j) + target_col, style, GC.Spread.Sheets.SheetArea.viewport);
- } else if (content == 'values') {
- sheet.setValue(parseInt(k) + target_row, parseInt(j) + target_col, value[k][j].value);
- } else if (content == 'all') {
- sheet.setFormula(parseInt(k) + target_row, parseInt(j) + target_col, value[k][j].formula);
- for (var h in value[k][j].style) {
- if (typeof value[k][j].style[h] == 'string') {
- style[h] = value[k][j].style[h]
- }
- }
- sheet.setStyle(parseInt(k) + target_row, parseInt(j) + target_col, style, GC.Spread.Sheets.SheetArea.viewport);
- sheet.setValue(parseInt(k) + target_row, parseInt(j) + target_col, value[k][j].value);
- }
- }
- }
- }
- }
复制代码 |