楼上的思路没有问题,可以参考下面这段代码:
- var dragTagCatch;
- spread.bind(GC.Spread.Sheets.Events.DragFillBlock, function (s, e) {
- var sheet = e.sheet,
- fillRange = e.fillRange;
- dragTagCatch = [];
- for (var i = 0; i < fillRange.rowCount; i++) {
- dragTagCatch[i] = [];
- for (var j = 0; j < fillRange.colCount; j++) {
- dragTagCatch[i][j] = sheet.getTag(fillRange.row + i, fillRange.col + j);
- }
- }
- console.log(dragTagCatch);
- });
- spread.bind(GC.Spread.Sheets.Events.DragFillBlockCompleted, function (s, e) {
- var sheet = e.sheet,
- fillRange = e.fillRange;
- console.log(sheet.toJSON());
- for (var i = 0; i < fillRange.rowCount; i++) {
- for (var j = 0; j < fillRange.colCount; j++) {
- sheet.setTag(fillRange.row + i, fillRange.col + j, dragTagCatch[i][j]);
- }
- }
- console.log(sheet.toJSON());
- });
复制代码 |