Not able to add password

Posted by: gagandeep.singh on 18 July 2024, 11:44 am EST

  • Posted 18 July 2024, 11:44 am EST - Updated 18 July 2024, 11:50 am EST

    Hi there,

    When I right click on protect sheet it opens up the dialog box like below, but there is no text box to enter password as it is mentioned here: https://developer.mescius.com/spreadjs/docs/features/worksheet/celllock

    Also there is one more requirement of protecting whole work book instead of sheet, this is what we have in spread .net desktop application. Do we have same thing in Spreadjs?

    Just want to add that we are using V15 spreadjs

  • Posted 19 July 2024, 2:35 am EST

    Hi,

    The password protection feature for protected sheets is not available in version 15 but is available in versions 16 and 17. The link you shared (https://developer.mescius.com/spreadjs/docs/features/worksheet/celllock) is for the version 17 documentation, not version 15. Here is the correct link for version 15 documentation: https://developer.mescius.com/spreadjs/docs/v15/features/worksheet/celllock. As you can see, the password feature is not mentioned in the version 15 documentation.

    Regarding your other requirement of protecting the whole workbook instead of just a sheet, this functionality is available in SpreadJS, including version 15. You can refer to this demo link for more information: https://developer.mescius.com/spreadjs/demos/features/spreadjs-file-format/password/purejs#demo_source_name.

    If you need password protection for protected sheets, I recommend upgrading to a higher version, specifically version 17, which offers many performance improvements and bug fixes.

    Regards,

    Priyam

  • Posted 19 July 2024, 8:25 am EST - Updated 19 July 2024, 12:00 pm EST

    Thank you so much for getting back to me. I will upgrade to V17.

    For protecting sheet, is there any way we can capture event when user click ‘OK’

    However, for other link that you shared is just protecting export and import functionality.

    In the current desktop spread .net when we protect work book then you can’t add sheet or hide/unhide, therefore you need password to do that.

  • Posted 22 July 2024, 2:36 am EST - Updated 22 July 2024, 2:41 am EST

    Hi,

    Regarding your query “For protecting a sheet, is there any way we can capture an event when the user clicks ‘OK’?”, you can use addListener to monitor when the “OK” button is clicked. Please refer to the attached snippet and the gif “Steps.gif”:

    spread.commandManager().addListener("app", (args) => {
        if(args.command.cmd == "Designer.confirmProtectSheet"){
            console.log("Ok is clicked:", args);
        }
    });

    Gif:

    Designer: https://developer.mescius.com/spreadjs/designer/index.html

    Regarding your second query, “However, for the other link you shared, it is just protecting the export and import functionality. In the current desktop Spread.NET, when we protect a workbook, you can’t add or hide/unhide sheets without a password,” my understanding is that you want to set a password when exporting through code.

    You can achieve this by referring to the snippet below, which is also used in the attached demo sample:

    let password = "spreadjs2023";
    spread.export(blob => saveAs(blob, "encrypted-export.xlsx"), console.log, {
       fileType: GC.Spread.Sheets.FileType.excel,
       password: password
    });

    Demo: https://developer.mescius.com/spreadjs/demos/features/spreadjs-file-format/password/purejs#demo_source_name

    If there is any difference in my understanding, to better assist you, could you please elaborate and share your exact use case with some examples?

    Regards,

    Priyam

  • Posted 22 July 2024, 2:47 pm EST

    Thanks,

    My concern is about restricting user to unhide sheets and they can do only when they put password.

    Foreg: This is the use case

    I have workbook which has WB which has 2 sheets

    Sheet 1: Main sheet

    Sheet 2: Some clients legal data

    As my sheet 2 is very confidential, therefore I will hide that sheet and then apply password on workbook. Only users who have password can unhide sheets.

    This is what I want to achieve

  • Posted 23 July 2024, 3:07 am EST

    Hi,

    SpreadJS components enable developers to incorporate Excel-like features into web applications, making them similar to Excel. Since Excel doesn’t have the feature you requested, SpreadJS and Spread .NET also do not have this feature. The closest feature that aligns with your requirement is the password protection for import and export, as mentioned in my previous response.

    However, you can achieve your requested feature in SpreadJS through a workaround. This workaround will only work within your application and not with other SpreadJS applications or Excel. This means that customers can save the file from your application, but if they import it into Excel or another SpreadJS application, they can unhide the sheet and view its content. If you would still like to pursue this workaround, please let us know.

    Best regards,

    Priyam

  • Posted 23 July 2024, 12:31 pm EST - Updated 23 July 2024, 12:37 pm EST

    Hi there,

    I am talking about this feature that we have in excel, you can protect workbook

  • Posted 24 July 2024, 6:48 am EST

    Hi,

    Thank you for providing the details for clarity. This feature is currently not supported by SpreadJS, but it is in our product backlog and is expected to be released with version 18 of SpreadJS. The internal tracking ID is “SJS-22233.” I will update you as soon as I have more information.

    Additionally, could you please confirm whether the workbook protection feature in Excel, as described here: https://support.microsoft.com/en-us/office/protect-a-workbook-7e365a4d-3e89-4616-84ca-1931257c1517?ns=excel&version=90&syslcid=1033&uilcid=1033&appver=zxl900&helpid=21154&ui=en-us&rs=en-us&ad=us, meets your requirements?

    Regards,

    Priyam

  • Posted 24 July 2024, 9:28 am EST

    Alright, thanks for letting me know.

    Yes it does meet our requirements

  • Posted 25 July 2024, 12:05 am EST

    Hi,

    Thank you for confirming. I will update you as soon as I receive any information.

    Regards,

    Priyam

Need extra support?

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

Learn More

Forum Channels