Section Protect

I need to protect a specific section of a Word document. Can this be accomplished in the latest version of Aspose.Words?

Hi Craig,

Thanks for your inquiry. I am afraid, currently Aspose.Words does not support protection of selected ranges (partial protection of document). Your request has been linked to the appropriate feature. We will let you know once this feature is supported. We apologize for your inconvenience.

The feature ID is WORDSNET-1067.

However, You can use Section.ProtectedForForms property to protect section for forms. When a section is protected for forms, users can select and modify text only in form fields in Microsoft Word.

Following code snippet shows how to protects a section so only editing in form fields is possible.

// Create a blank document
Document doc = new Document();
// Insert two sections with some text
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Section 1. Unprotected.");
builder.InsertBreak(BreakType.SectionBreakContinuous);
builder.Writeln("Section 2. Protected.");
// Section protection only works when document protection is turned and only editing in form fields is allowed.
doc.Protect(ProtectionType.AllowOnlyFormFields);
// By default, all sections are protected, but we can selectively turn protection off.
doc.Sections[0].ProtectedForForms = false;
builder.Document.Save(MyDir + "Section.Protect Out.doc");

The issues you have found earlier (filed as WORDSNET-1067) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(9)