Hi Dave,
You provided two links which contains two different concepts. Let me
clarify these first before answering your questions.
In
http://msdn.microsoft.com/en-us/library/ms178793.aspx (How to: Protect
Documents and Parts of Documents), this is the feature for protecting the
entire document, and then optionally, make some exceptional parts editable.
In
http://msdn.microsoft.com/en-us/library/bb386181.aspx (How to: Protect
Parts of Documents by Using Content Controls), this is the new feature
available in Word 2007, something like a field and you can set it as
non-editable or even non-deletable. It has nothing to do with the entire
document protection and it is a Word only feature. It is part of the Word
2007 object model, so you can access it via your add-in code and also VSTO
/ VBA. If you want to know more about content controls, this is a very
helpful webcast to watch:
http://www.microsoft.com/uk/msdn/screencasts/screencast/235/Structuring-Docu
ments-in-Word-2007-Using-Content-Controls.aspx.
Now let's get more specific on the *entire document* protection.
1) Is this Word only or can it be done in Excel and/or PowerPoint also?
This is not Word only.
In Word, we can protect the entire document and set some parts editable to
all or certain users.
In Excel, we can do the similar to Worksheets.
In PowerPoint, not really, we can only set protection to the entire
presentation when Information Rights Management is available.
2) Can this be done from the Office UI or only in code?
Both.
For 2003 Office, the options can be found in Tools -> Protect Document /
Worksheet menu.
For 2007 Office, the options can be found in the Review Tab.
Using code, here is a short Word sample:
object missing = Type.Missing;
// Create a Word instance. In Add-In, we don't need to do this.
Word.Application app = new Word.ApplicationClass();
app.Visible = true;
app.Documents.Add(ref missing, ref missing, ref missing, ref missing);
app.Selection.TypeText("Hello! This area is editable.");
// select editable area
object unit = Word.WdUnits.wdCharacter;
object count = 22;
object extend = Word.WdMovementType.wdExtend;
app.Selection.MoveLeft(ref unit, ref count, ref extend);
// add selection into editable areas
object editorID = Word.WdEditorType.wdEditorEveryone;
app.Selection.Editors.Add(ref editorID);
// protect the document
app.ActiveDocument.Protect(Word.WdProtectionType.wdAllowOnlyReading,
ref missing, ref missing, ref missing, ref missing);
3) Does this require VSTO or can we do it using our IExtensibility AddIn?
This feature is part of the Office object model, we can access it via
various of ways - like VSTO, IExtensibility AddIn and VBA.
4) If it requires the AddIn, what happens if it is opened in Office without
the AddIn - is the whole document now editable?
No require of the AddIn. It will always be protected in Office application.
5) Are there any limits on what can/cannot be marked uneditable?
The edit restriction (content and style) is applied on the entire document
/ worksheet. We can select parts of the content to be editable.
Best regards,
Jie Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.