We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Could not set the password in XLSX and XLSM excel sheet

Thread ID:





129965 Apr 12,2017 07:30 AM UTC Apr 13,2017 01:02 PM UTC ASP.NET Core 1
Tags: XlsIO
Asked On April 12, 2017 07:30 AM UTC


 I try to set the password in XLSX and XLSM file but i could not.

if i initialize PasswordToOpen property worksheet could not saved it will throw object set reference error.

  ExcelEngine excelEngine = new ExcelEngine();
                IApplication application = excelEngine.Excel;
                application.OnPasswordRequired += application_OnPasswordRequired;
                application.DefaultVersion = ExcelVersion.Excel2013;
                //Loads or open an existing workbook through Open method of IWorkbooks
                MemoryStream ms_template = new MemoryStream();
                byte[] buffer = File.ReadAllBytes(@"D:\Book1.xlsx");

                ms_template.Position = 0;
                ms_template.Write(buffer, 0, buffer.Length);
                IWorkbook workbook = excelEngine.Excel.Workbooks.Open(ms_template, ExcelOpenType.SpreadsheetML2010);
 using (var fileStream_write = new FileStream(@"D:\TemplateEmpty.xlsx", FileMode.Create, FileAccess.Write))

Attachment: Blank_267592b7.zip

Sridhar Sukumar [Syncfusion]
Replied On April 13, 2017 01:02 PM UTC

Hi Vasanth, 
Thank you for contacting Syncfusion support. 

We were able to reproduce the issue. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates 




Please let me know if you have any questions. 



Sridhar S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon