We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Protect Specific Sections in a word document

Hi,

I want to protect one paragraph in a document, I tried using the following code.

Document pssDocument = new Document();

pssDocument.protect(ProtectionType.ALLOW_ONLY_FORM_FIELDS);

But the above two lines protects the complete page in the document. I also used the following line of code.

docBuilder.getCurrentSection().setProtectedForForms(true);

and after the paragraph was finished I added

docBuilder.getCurrentSection().setProtectedForForms(false);

But by doing this nothing is protected in the document. 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.

Regards,

I am trying to implement something like this link http://office.microsoft.com/en-us/word-help/allow-changes-to-parts-of-a-protected-document-HA010372706.aspx

Is it possible using Aspose words.

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");


Hi Tahir,

Thanks for your response, is there any timeline by when WORDSNET-9000 feature will be provided.

Regards,

Hi Carol,

Thanks for your inquiry. I am afraid this issue WORDSNET-9000 has now been postponed till a later date due to some other important issues and new features. We will inform you as soon as there are any further developments.

We apologize for your inconvenience.

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


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