• spreadjs 复制单元格样式


    /**
    * @param {起始行} a
    * @param {起始列} b
    * @param {复制到行} c
    * @param {复制到列} d
    * @param {复制多少行} e
    * @param {复制多少列} f
    * @param {添加行循环次数} g
    * @param {要复制的sheet页行} copyA
    * @param {要复制的sheet页列} copyB
    * @param {要复制标签页} copySheet
    * @param {复制到标签页} toSheet
    * @param {spread} spread
    */

    function copysty(a, b, c, d, e, f, g,copyA,copyB,copySheet,toSheet,spread)
    {
    var sheetto = spread.getSheet(toSheet);
    var sheetcopy = spread.getSheet(copySheet);
    for (var i = 0; i < g; i++) {
    sheetto.addRows(c,e);
    var selectionRange = sheetcopy.getRange(copyA,copyB,e,f);
    fromRange = selectionRange;
    fromSheet = sheetcopy;
    sheetto.isPaintSuspended(true);
    var toRange = sheetto.getRange(c,d,e,f);
    //toRange biger than fromRange
    if (fromRange.rowCount > toRange.rowCount) {
    toRange.rowCount = fromRange.rowCount;
    }
    if (fromRange.colCount > toRange.colCount) {
    toRange.colCount = fromRange.colCount;
    }
    //toRange must in Sheet
    if (toRange.row + toRange.rowCount > sheetto.getRowCount()){
    toRange.rowCount = sheetto.getRowCount() - toRange.row;
    }
    if (toRange.col + toRange.colCount > sheetto.getColumnCount()) {
    toRange.colCount = sheetto.getColumnCount() - toRange.col;
    }
    var rowStep = fromRange.rowCount, colStep = fromRange.colCount;
    var endRow = toRange.row + toRange.rowCount - 1, endCol = toRange.col + toRange.colCount - 1;
    // if toRange bigger than fromRange, repeat paint
    for (var startRow = toRange.row; startRow <= endRow; startRow = startRow + rowStep) {
    for (var startCol = toRange.col; startCol <= endCol; startCol = startCol + colStep) {

    var rowCount = startRow + rowStep > endRow + 1 ? endRow - startRow + 1 : rowStep;
    var colCount = startCol + colStep > endCol + 1 ? endCol - startCol + 1 : colStep;
    // sheet.copyTo(fromRange.row,fromRange.col, startRow, startCol, rowCount, colCount,GC.Spread.Sheets.CopyToOptions.style | GC.Spread.Sheets.CopyToOptions.span);
    var fromRanges = new GC.Spread.Sheets.Range(fromRange.row, fromRange.col, rowCount, colCount);
    var pastedRange = new GC.Spread.Sheets.Range(startRow, startCol, rowCount, colCount);
    spread.commandManager().execute({
    cmd: "clipboardPaste",
    sheetName: sheetto.name(),
    fromSheet: fromSheet,
    fromRanges: [fromRanges],
    pastedRanges: [pastedRange],
    isCutting: false,
    clipboardText: "",
    pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all
    });
    }
    }
    c += e;
    }

    }

  • 相关阅读:
    Zend Framework 2.1.5 中根据服务器的环境配置调用数据库等的不同配置
    在基于 Eclipse 的 IDE 中安装和使用 Emmet(ZenCoding)
    【翻译】Emmet(Zen Coding)官方文档 之六 自定义 Emmet
    【翻译】Emmet(Zen Coding)官方文档 之二 缩写
    【翻译】Emmet(Zen Coding)官方文档 之七 一览表
    【翻译】Emmet(Zen Coding)官方文档 之三 CSS 缩写
    【翻译】Emmet(Zen Coding)官方文档 之四 动作
    【翻译】Emmet(Zen Coding)官方文档 之一 web 编程的必备工具
    Zend Framework 2 时区设置警告问题的解决
    【翻译】Emmet (Zen Coding) 元素类型
  • 原文地址:https://www.cnblogs.com/yeyuqian/p/10750441.html
Copyright © 2020-2023  润新知