I opened the Excel file in my C # WinForm application by adding a link to Microsoft.Office.Interop.Excel.dll and using DSO FRAMER CONTROL. But I want to open read-only excel file. I have successfully done this for a WORD application like this
Word.Document wordDoc = (Word.Document)axFramerControl1.ActiveDocument; Word.Application wordApp = wordDoc.Application; wordDoc.Protect(Word.WdProtectionType.wdAllowOnlyReading);
In the same I want to make this work for Excel. But I could not protect the Excel file in this way.
string path = "C:\\test-wb.xlsx"; axFramerControl1.Open(path, true,"excel.sheet", "", ""); Excel._Workbook excelDoc =(Microsoft.Office.Interop.Excel._Workbook)axFramerControl1.ActiveDocument; 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.
c # excel winforms vsto office-interop
Saravanan Jan 18 '12 at 7:33 2012-01-18 07:33
source share