Hi Rajeev,
Thanks for your inquiry.
rajeevkrmathur:
I want to protect one paragraph in a document, I tried using the following code.
Unfortunately, Aspose.Words does not support the requested feature (
protect the part of document) at
the moment. However, we have already logged this feature request as
WORDSNET-9000
in our issue tracking system. You will be notified via this forum
thread once this feature is available. We apologize for your
inconvenience.
rajeevkrmathur:
Can you please guide me if there is a way to protect the document and also to know if there is a section in a page that is protected so that I can unprotect that particular section if needed.
Section.ProtectedForForms return true if the section is protected for forms. Following code example protects a section so only editing in form fields is possible. Hope this helps you.
// Create a blank document
Document doc = new Document(MyDir + "Section.Protect
Out.doc");
// Insert two sections with some
text
DocumentBuilder builder = new
DocumentBuilder(doc);
builder.writeln("Section 1.
Unprotected.");
builder.insertBreak(BreakType.SECTION_BREAK_CONTINUOUS);
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.ALLOW_ONLY_FORM_FIELDS);
// By default, all sections are
protected, but we can selectively turn protection off.
doc.getSections().get(0).setProtectedForForms(false);
System.out.println(doc.getSections().get(1).getProtectedForForms());
builder.getDocument().save(MyDir + "Section.Protect
Out.doc");