Answered by:
Create non editable word document using c#.net

Question
-
User-1949221332 posted
Hi all,
I want to create a non editable word document using c#.net. Well i have already created a word document using "Microsoft.Office.Interop.Word" but can not figure out that how can i make it non editable.
Your help is highly appriciated.
Regards,
Ali bin zubair
Wednesday, August 5, 2009 7:33 AM
Answers
-
User-1026295734 posted
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word._Document oDoc;
......
......
.....
oDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 5, 2009 8:45 AM
All replies
-
Wednesday, August 5, 2009 8:23 AM
-
User-1026295734 posted
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word._Document oDoc;
......
......
.....
oDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 5, 2009 8:45 AM -
User-1910946339 posted
Don't forget to set the operating system security on the document you create. Otherwise, it is a simple matter to copy the text from a non-editable document, paste it in to a new document and save with the same name as the original document.
What are you trying to achieve by making the document non-editable? I can always print the document and use correction fluid (or a pair of scissors and a photocopier) to change it! To have the document not change it is more a matter of operating system security than it is of document properties.
Wednesday, August 5, 2009 7:44 PM -
User-1199946673 posted
Well i have already created a word document using "Microsoft.Office.Interop.Wordbefore you continue, you need to know this:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
Wednesday, August 5, 2009 8:27 PM -
User-1949221332 posted
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word._Document oDoc;
......
......
.....
oDoc.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Thanks brother, it solves problem
Regards,
Ali bin zubair
Thursday, August 6, 2009 5:36 AM -
User1176561268 posted
Hi...
You can use this code..
string filename= "myfilename.doc";
StreamWriter fp;
fp = File.CreateText(Server.MapPath("~/Resumes/") + filename);
fp.WriteLine(resume);
fp.Close();
this will create word document...Hope it helps..Please mark as answer if its useful..
Thanks
Kinjal
Sharma Infoway
Thursday, October 8, 2009 8:42 AM