Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Worksheet Protection
posted

Running the following code will not protect my worksheet. Am I doing something wrong or is this a bug?

Dim ms As New MemoryStream()
Dim wb as new Workbook()

wb.SetCurrentFormat(WorkbookFormat.Excel2007)
wb.Worksheets.Add("TEST WORKSHEET")
wb.Worksheets.Last.Protected = True
populateWorksheet(wb.Worksheets.Last)
wb.Save(ms)

Response.Clear()
Response.AddHeader("Content-Type", "application/vnd.ms-excel")
Response.AddHeader("content-disposition", "attachment; filename=test.xlsx")
Response.BinaryWrite(rpt.ExcelSpreadSheet().ToArray())
Response.End()