PageBreak is not working after we save the spread to Excel file

Posted by: johina.olla on 5 September 2022, 4:15 am EST

  • Posted 5 September 2022, 4:15 am EST

    We are using the spreadjs v15 in angular applictaion and we are setting the page break using method

    activeSheet.setColumnPageBreak(2, true);

    activeSheet.setRowPageBreak(3, true);

    but when we export the spread as excel the in excel file the pagebreak is not visible through pagebreak preview and not working when printing.

    Please suggest how can we resolve it?

  • Posted 6 September 2022, 7:57 am EST - Updated 3 October 2022, 9:02 am EST

    Hi,

    We are sorry but we are unable to replicate the issue on our end. Could you please refer to the following gif of our observation and let me know if we missed any steps?

    Regards,

    Avinash

  • Posted 6 September 2022, 8:17 am EST

    Actually we are setting the pagebreak through code in spreadJS in angular application using the code below.

    spread.getactiveSheet().setColumnPageBreak(2, true);

    spread.getactiveSheet().setRowPageBreak(3, true);

    and then export the spread through method exportFile() using the below piece of code

    [b] private exportFile(spread: GC.Spread.Sheets.Workbook): void {

    //var json = JSON.stringify(spread.toJSON());

    var cache = ;

    var json = JSON.stringify(spread.toJSON({ includeBindingSource: true }), function (key, value) {

    if (typeof value === ‘object’ && value !== null) {

    if (cache.indexOf(value) !== -1) {

    // Circular reference found, discard key

    return;

    }

    // Store value in our collection

    cache.push(value);

    }

    return value;

    });

    cache = null; //

    var excelIO = new GC.Spread.Excel.IO();
    excelIO.save(json, function (blob) {
      saveAs(blob, 'export.xlsx');
    }, function (e) {
      alert(e);
    });
    

    }[/b]

    when we open the exported excel file, row/column pagebreak is not working.

    Please use the above code to reproduce the issue.

  • Posted 7 September 2022, 1:14 am EST

    Hi,

    We have created a sample using the provided code snippet but we are still unable to replicate the issue at our end. Could you refer to the following sample and edit it to replicate the issue?

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

    Regards,

    Avinash

Need extra support?

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

Learn More

Forum Channels