I am working on a document management program. I want to open up a Word document with the click of a button and according to the permissions to the user whoever logged in will be given certain permissions (like read-only, edittable).
I tried with this code:
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass doc = new Microsoft.Office.Interop.Word.ApplicationClass();
object name = @"some.doc";
object read = true;
object t = true;
doc.Documents.Open(ref name, ref missing, ref read, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref t, ref missing, ref missing, ref missing, ref missing);
doc.Visible = true;
This code is opening up the document but as I have set the read-only true, it should open the document in readonly mode. When document is opened in Word 2003 it is editable whereas when opened in Word 2010 it is read-only.
Also, I'd like to know if is it worth it to disable all the toolbars of Word and create my own with the buttons which I want. I want to give only the functionality which I want - like I want to disable the SaveAs functionality.