Password Protected Excel Download using EPPLUS

前端 未结 4 670

I am exporting data in Excel form using EPPLUS Excel Library. I want that when excel downloaded it will ask for password. I have tried following code.

4条回答
  •  温柔的废话
    2021-01-02 22:07

    Just need to use the .Save overload with a password as the option:

    package.Save("password");
    

    Response To Comments

    To apply a password if saving via a byte array it is very similar:

    Byte[] bin = pck.GetAsByteArray("password");
    System.IO.File.WriteAllBytes(fullFilePath, bin);
    

提交回复
热议问题