//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //Open an excel file. var fileStream = this.GetResourceStream("xlsx\\Medical office start-up expenses 1.xlsx"); workbook.Open(fileStream); //Protects the workbook with a password so that other users cannot view hidden worksheets, add, move, delete, hide, or rename worksheets. //The protection only happens when you open it with an Excel application. workbook.Protect("Y6dh!et5");
' Create a new Workbook Dim workbook As New Workbook 'Open an excel file Dim fileStream = GetResourceStream("xlsx\\Medical office start-up expenses 1.xlsx") workbook.Open(fileStream) ' Protects the workbook with a password so that other users cannot view hidden worksheets, add, move, delete, hide, or rename worksheets. ' The protection only happens when you open it with an Excel application. workbook.Protect("Y6dh!et5") ' save to an excel file workbook.Save("ProtectWorkbook.xlsx")