Incremental loading import not work

Posted by: pedro.moraes on 16 November 2022, 11:14 pm EST

  • Posted 16 November 2022, 11:14 pm EST

    When importing a file it is working.

    But if I add an incremental loading it doesn’t work.

    Code without loading:

      mergeJSON = (json, result) => {
        const spreadExcel = new GC.Spread.Sheets.Workbook();
    
        const estilo = result.opcoes.estilo;
        const formula = result.opcoes.formula;
        const calcularFormula = result.opcoes.calcularFormula;
        const linha = result.opcoes.linha;
        const coluna = result.opcoes.coluna;
    
        spreadExcel.fromJSON(json, {
          ignoreStyle: estilo,
          ignoreFormula: formula,
          frozenColumnsAsRowHeaders: coluna,
          frozenRowsAsColumnHeaders: linha,
          doNotRecalculateAfterLoad: calcularFormula,
        });
    
        spreadExcel.sheets.forEach((sheet) => {
          const nome = this.adicionaNovaPaginaNaPlanilha(sheet);
          this.nomeDasAbas.push(nome);
        });
    
        spreadExcel.getNamedStyles().forEach((style) => this.workbook.addNamedStyle(style));
    
        const nomeCelulas = json.names as NomeCelula[];
        if (nomeCelulas && nomeCelulas.length > 0) {
          nomeCelulas.forEach((nomeCelula) =>
            this.workbook.addCustomName(nomeCelula.name, nomeCelula.formula, nomeCelula.row, nomeCelula.col, nomeCelula.comment)
          );
        }
    
        this.loading = false;
      };

    Code with loading:

      mergeJSON = (json, result) => {
        const spreadExcel = new GC.Spread.Sheets.Workbook();
    
        const estilo = result.opcoes.estilo;
        const formula = result.opcoes.formula;
        const calcularFormula = result.opcoes.calcularFormula;
        const linha = result.opcoes.linha;
        const coluna = result.opcoes.coluna;
    
        spreadExcel.fromJSON(json, {
          ignoreStyle: estilo,
          ignoreFormula: formula,
          frozenColumnsAsRowHeaders: coluna,
          frozenRowsAsColumnHeaders: linha,
          doNotRecalculateAfterLoad: calcularFormula,
          incrementalLoading: {
            loading: function (progress, _) {
              progress = progress * 100;
              document.getElementById('statusBar').innerText = 'Loading: ' + progress.toFixed(2) + '%';
            },
            loaded: function () {
              document.getElementById('statusBar').innerText = 'Finish';
            },
          },
        });
    
        spreadExcel.sheets.forEach((sheet) => {
          const nome = this.adicionaNovaPaginaNaPlanilha(sheet);
          this.nomeDasAbas.push(nome);
        });
    
        spreadExcel.getNamedStyles().forEach((style) => this.workbook.addNamedStyle(style));
    
        const nomeCelulas = json.names as NomeCelula[];
        if (nomeCelulas && nomeCelulas.length > 0) {
          nomeCelulas.forEach((nomeCelula) =>
            this.workbook.addCustomName(nomeCelula.name, nomeCelula.formula, nomeCelula.row, nomeCelula.col, nomeCelula.comment)
          );
        }
    
        this.loading = false;
      };
    
      private adicionaNovaPaginaNaPlanilha(sheet: GC.Spread.Sheets.Worksheet): string {
        const nome = this.checaSeJaExisteAbaComNome(sheet.name());
        sheet.name(nome);
    
        const index = this.workbook.sheets.length;
        this.workbook.addSheet(index, sheet);
    
        return nome;
      }
  • Posted 17 November 2022, 2:31 pm EST

    Hi,

    We are unable to replicate the issue at our end. could you please refer to the following sample if the issue persists please share a working sample that replicates the issue so that we could investigate it further and help you accordingly.

    sample: https://jscodemine.grapecity.com/share/Tmhx8pd3c0WThxYK4qx6tQ/

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels