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.
Unfortunately, activation email could not send to your email. Please try again.

Could not set the password in XLSX and XLSM excel sheet

Thread ID:

Created:

Updated:

Platform:

Replies:

129965 Apr 12,2017 03:30 AM Apr 13,2017 09:02 AM ASP.NET Core 1
loading
Tags: XlsIO
vasanth
Asked On April 12, 2017 03:30 AM

Hi..,

 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))
                {
                    
                    workbook.SaveAs(fileStream_write);
                }



Attachment: Blank_267592b7.zip

Sridhar Sukumar [Syncfusion]
Replied On April 13, 2017 09:02 AM

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 

  

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

  

Please let me know if you have any questions. 

  

Regards, 

Sridhar S. 


CONFIRMATION

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.

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.

;