找回密码
 立即注册

QQ登录

只需一步,快速开始

y.a.n

注册会员

2

主题

2

帖子

10

积分

注册会员

积分
10
  • 42

    金币

  • 2

    主题

  • 2

    帖子

最新发帖
y.a.n
注册会员   /  发表于:2021-10-8 14:57  /   查看:2115  /  回复:1
1金币
const setSpreadTableStyle = (sheet: any, rowCount: number, columnCount: number) => {
    let style = new GC.current.Spread.Sheets.Style();
    spread.current.suspendPaint();
    for (let i = 0; i < rowCount; i++) {
      for (let j = 0; j < columnCount - 1; j++) {

        if (i === 0) {
          style.font = "bold normal 15px normal";
          style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.center;
          style.vAlign = GC.current.Spread.Sheets.VerticalAlign.center;
          sheet.setStyle(0, 0, style, GC.current.Spread.Sheets.SheetArea.viewport);
          sheet.addSpan(0, 0, 1, columnCount);
          sheet.addSpan(1, 0, 1, columnCount);
        }
        if (i === 2) {
          // style.font = "bold normal 15px normal";
          style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.right;
          style.vAlign = GC.current.Spread.Sheets.VerticalAlign.right;
          sheet.setStyle(2, 4, style, GC.current.Spread.Sheets.SheetArea.viewport);
          sheet.addSpan(2, 4, 1, columnCount);
        }
        if (i === 3) {
          // style.font = "bold normal 15px normal";
          style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.center;
          style.vAlign = GC.current.Spread.Sheets.VerticalAlign.center;
          sheet.setStyle(i, j, style, GC.current.Spread.Sheets.SheetArea.viewport);
          let cell = sheet.getCell(i, j, GC.current.Spread.Sheets.SheetArea.viewport);
          cell.hAlign(GC.current.Spread.Sheets.HorizontalAlign.center);
          cell.vAlign(GC.current.Spread.Sheets.VerticalAlign.center);
        }
        if (i >= 4 && j >= 2) {
          let cell = sheet.getCell(i, j, GC.current.Spread.Sheets.SheetArea.viewport);
          cell.hAlign(GC.current.Spread.Sheets.HorizontalAlign.right);
          cell.vAlign(GC.current.Spread.Sheets.VerticalAlign.right);
          const currentCellValue = sheet.getValue(i, j);
          sheet.setValue(i, j, numberFormat_S(UnitType.Individual,currentCellValue,'0,0.00'));
        }
      }
    }
    spread.current.resumePaint();
  };


最佳答案

查看完整内容

请问你使用的版本是多少呢?如果你的版本过旧,建议你尝试升级产品版本,我们在新的版本中对于数据以及样式的处理都有一定程度的优化。另外,请问你描述的慢具体是需要多长时间以及加载的数据量是多少呢?建议你提供一个完整的demo,这边调研看下是否有优化的方案。

1 个回复

正序浏览
最佳答案
最佳答案
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-10-8 14:57:41
来自 2#
请问你使用的版本是多少呢?如果你的版本过旧,建议你尝试升级产品版本,我们在新的版本中对于数据以及样式的处理都有一定程度的优化。另外,请问你描述的慢具体是需要多长时间以及加载的数据量是多少呢?建议你提供一个完整的demo,这边调研看下是否有优化的方案。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部