Protecting parts of a document

Hi,

I was going through the recent posts in your forums and I came across several posts where a message has been posted by the Apsoe Notifier that the feature to partially lock and unlock a document, given the code WordsNet-9000 has been implemented in the latest release of Aspose.Words. However, I was not able to find any guides or walkthroughs on how to use this feature. If someone can point me in the right direction, I will be truly grateful.

Thanks

Hi there,

Thanks for your inquiry. EditableRangeStart class represents a start of an editable range in a Word document. EditableRangeEnd class represents an end of an editable range in a Word document.

A complete editable range in a Word document consists of a EditableRangeStart and a matching EditableRangeEnd with the same Id. EditableRangeStart and EditableRangeEnd are just markers inside a document that specify where the editable range starts and ends.

Please note that currently editable ranges are supported only at the inline-level, that is inside Paragraph, but editable range start and editable range end can be in different paragraphs. Badly formed editable range will be ignored when the document is saved.

Please check following code example. This code example sets the editable range for second paragraph of document.

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
doc.Protect(ProtectionType.ReadOnly);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToParagraph(1, 0);
builder.StartEditableRange();
builder.MoveToParagraph(1, -1);
builder.EndEditableRange();
doc.Save(MyDir + "Out.docx");

Hi again,

Thanks a lot for your reply.

Best regards,
SMQ

Hi there,

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.