//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); // Specify the name of the user who reserves write permission on this workbook. workbook.WriteProtection.WriteReservedBy = "Eric"; // Specify this workbook is saved as read-only recommended. // Microsoft Excel displays a message recommending that you open the workbook as read-only. workbook.WriteProtection.ReadOnlyRecommended = true; // Protects the workbook with a password so that other users cannot accidentally or intentionally edit the data. // The write-protection only happens when you open it with an Excel application. workbook.WriteProtection.WritePassword = "Y6dh!et5"; // Save to an excel file workbook.Save("CreateWriteProtectedWorkbook.xlsx");
' 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) ' Specify the name of the user who reserves write permission on this workbook. workbook.WriteProtection.WriteReservedBy = "Eric" ' Specify this workbook Is saved as read-only recommended. ' Microsoft Excel displays a message recommending that you open the workbook as read-only. workbook.WriteProtection.ReadOnlyRecommended = True ' Protects the workbook with a password so that other users cannot accidentally Or intentionally edit the data. ' The write-protection only happens when you open it with an Excel application. workbook.WriteProtection.WritePassword = "Y6dh!et5" ' save to an excel file workbook.Save("CreateWriteProtectedWorkbook.xlsx")