T
tartancli
An archived post to this forum (http://www.ureader.com/message/2849995.aspx)
indicated that, when a document is protected, attempts to read text
programmatically by getting the "content" range and then getting its text,
result in an exception being raised.
I would like to use this "feature" (ie. stop other Add-ins and VBA from
retrieving my document's text), but it does not seem to work for me. In Word
2003, i have tried protecting the document and then using doc.content.text to
retrieve the document text. I can retrieve the text both in the add-in itself
(immediately after protecting the doc) and in VBA macro. Is this "feature"
Word version dependant, or have i not protected the document properly? The
code that i use to protect is as follows:
// Apply Words own protection mechanism
void ProtectContent( Word.Document doc)
{
object missing = System.Reflection.Missing.Value;
object protPass = "the password";
doc.Protect( Word.WdProtectionType.wdAllowOnlyFormFields, ref
missing,ref protPass, ref missing, ref missing );
} // end ProtectContent
If it is not possible to protect document text from being read
programatically using the document protection mechanism, is there some other
way to do this.
Thanks in advance!
indicated that, when a document is protected, attempts to read text
programmatically by getting the "content" range and then getting its text,
result in an exception being raised.
I would like to use this "feature" (ie. stop other Add-ins and VBA from
retrieving my document's text), but it does not seem to work for me. In Word
2003, i have tried protecting the document and then using doc.content.text to
retrieve the document text. I can retrieve the text both in the add-in itself
(immediately after protecting the doc) and in VBA macro. Is this "feature"
Word version dependant, or have i not protected the document properly? The
code that i use to protect is as follows:
// Apply Words own protection mechanism
void ProtectContent( Word.Document doc)
{
object missing = System.Reflection.Missing.Value;
object protPass = "the password";
doc.Protect( Word.WdProtectionType.wdAllowOnlyFormFields, ref
missing,ref protPass, ref missing, ref missing );
} // end ProtectContent
If it is not possible to protect document text from being read
programatically using the document protection mechanism, is there some other
way to do this.
Thanks in advance!