Microsoft.Office.Interop.Word.Document wordDoc = (Microsoft.Office.Interop.Word.Document)axFramerControl1.ActiveDocument; Microsoft.Office.Interop.Word.Application wordApp = wordDoc.Application; wordDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading);
string path = "C:\\test-wb.xlsx"; axFramerControl1.Open(path, true,"excel.sheet", "", ""); Microsoft.Office.Interop.Excel._Workbook excelDoc =(Microsoft.Office.Interop.Excel._Workbook)axFramerControl1.ActiveDocument; Microsoft.Office.Interop.Excel.Application excelApp =excelDoc.Application; //What code should i write to protect Excel Workbook with read - only. excelDoc.Protect(misval, true, misval);//It is not working.
Quote:Call theOpen method with third parameter (ReadOnly) = true. See MSDN documentation :Workbooks.Open Method [^] ReadOnly Optional Object. True to open the workbook in read-only mode.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)