SpreadJS freezed when set sheet.options.isProtected = true and hide row 1

Posted by: longthien2211uit on 9 August 2024, 12:26 am EST

  • Posted 9 August 2024, 12:26 am EST

    Dear SpreadJS team,

    I am implementing about readonly for sheet.

    I uploaded excel file and hid row 1 and then add more setting:

    sheet.options.isProtected = true;

    After that, I displayed sheet and it freezed the sheet. Max CPU for browser tab.

    QA: Could you please help me this why?

    And what solution to resolve this issue?

    Many thanks,

  • Posted 9 August 2024, 1:14 am EST - Updated 9 August 2024, 1:20 am EST

    Hi,

    I tried to replicate the behavior on my end using the available information, but I was unable to do so. I uploaded the Excel file, then hid the row and protected the sheet, but the sheet functioned as expected and did not freeze. Please refer to the attached gif “Steps.gif” for details.

    Gif:

    Tested Environment:

    SpreadJS Version: 17.1.3

    Chrome Version: 127.0.6533.100

    OS: Windows 11 Pro (Version: 23H2, 64-bit)

    Processor: 12th Gen Intel(R) Core™ i7-1270P

    RAM: 16 GB

    If you’re using a lower version, I suggest trying the latest version (17.1.3). If the issue still persists, to better assist you, could you please share a sample along with the steps to replicate the behavior you’ve observed? Alternatively, you can modify the below sample to replicate the issue by forking it. This will help me investigate the problem more thoroughly. Additionally, it would be helpful if you could provide a GIF or video illustrating the issue, as well as your system configuration.

    Spread: https://jscodemine.mescius.io/share/F_d7Q33JOkmS33zBip8vwA/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fpackage.json"]%2C"ActiveFile"%3A"%2Fpackage.json"}

    Designer component: https://jscodemine.mescius.io/share/Yw7CCu0nTUi-8GwonSGqKQ/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fpackage.json"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fpackage.json"}

    Regards,

    Priyam

  • Posted 12 August 2024, 3:11 am EST - Updated 12 August 2024, 3:16 am EST

    Hi @priyam.kushwaha,

    I just found how to reproduce this issue.

    1. In excel file, hid first row (row 1st).
    2. Import excel file.
    3. Add more setting for current sheet and add two rows.
    var sheet = spread.getActiveSheet();
    sheet.options.protectionOptions.allowSelectLockedCells  = false;
    sheet.options.isProtected = true

    If I change logic code as below this work fine:

    var sheet = spread.getActiveSheet();
    sheet.options.isProtected = true
    sheet.options.protectionOptions.allowSelectLockedCells  = false;

    Could you try this and make me the reason of it?

    Thanks



  • Posted 12 August 2024, 3:29 am EST

    I just uploaded excel file that I use to import.

    template - Copy.zip

  • Posted 13 August 2024, 1:58 am EST - Updated 13 August 2024, 2:05 am EST

    Hi,

    I was able to replicate the behavior on my end. After investigating, I found that the issue seems to be with the Excel file itself. When I saved the file again using MS Excel and then loaded it using the same process, the screen freezing issue did not occur. Please refer to the attached GIF, “Steps.gif,” for details.

    Gif:

    Could you please let me know how this Excel file was generated? If the file was created using third-party tools, please note that SpreadJS does not guarantee compatibility with files generated by third-party applications. However, if you encounter any issues with Excel files created using MS Excel or our products, we can certainly assist you with those.

    Regards,

    Priyam

  • Posted 13 August 2024, 9:38 pm EST

    Hi @priyam.kushwaha,

    I just use Microsoft Excel 2016 to make template.xlsx and save this file.

    It’s just take specials action as I hid first rows and then save the file immediately.

    Step 1: Make template.xlsx by Microsoft Excel 2016.

    Step 2: Hide first row. (Don’t focus any cell)

    Step 3: Press save this file.

    We found more case easier reproduce this issue.

    You just hide first row and possible take more action before save file. this issue will happen when use Excel.IO API.

    function ImportFile() {
                var excelFile = document.getElementById("fileDemo").files[0];
                excelIO.open(excelFile, function (json) {
                    var workbookObj = json;
                    workbook.fromJSON(workbookObj);
                    const sheet = workbook.getActiveSheet();
                    sheet.setActiveCell(0,0);
                    sheet.options.protectionOptions.allowSelectLockedCells = false;
                    sheet.options.isProtected = true;
                }, function (e) {
                    console.log(e);
                });
            }

    Could you try with this code?

    If this issue not happen, please send me the sample I will try it again.

    Thanks,

  • Posted 16 August 2024, 5:06 am EST - Updated 16 August 2024, 5:12 am EST

    Hi,

    I was able to replicate the issue on my end using the latest version of Excel. Please refer to the attached GIF “Steps.gif” and the sample “Sample.zip” for more details.

    Gif:

    Sample: Sample.zip

    I have escalated this to the relevant team for further investigation, as I’m not entirely certain about the cause. The internal tracking ID for this issue is “SJS-26037”. I will keep you updated as soon as I have more information.

    Regards,

    Priyam

  • Posted 4 October 2024, 3:07 am EST

    Hi @priyam.kushwaha,

    How about this issue?

    Have you any answer for this issue yet?

  • Posted 4 October 2024, 4:40 am EST

    Hi,

    The mentioned issue has been fixed in the latest version of SpreadJS. Kindly upgrade to the latest version 17.1.6 of SpreadJS and let us know if you still face the same issue.

    Regards,

    Priyam

Need extra support?

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

Learn More

Forum Channels