Hi Joseph,
Thanks for your inquiry. EditableRangeStart, EditableRangeEnd and EditableRange (facade) classes are added as new public API model entities which can be preserved during DOC/DOCX/WML/RTF round trip. Let me show few more examples which will help you to get acquainted with new API:
- Using new API you can make all editable ranges read-only, all that you need is remove them. In this case all content inside the editable regions will be preserved. Please see the following code:
NodeCollection editableRangeStarts = doc.GetChildNodes(NodeType.EditableRangeStart, true);
foreach (EditableRangeStart start in editableRangeStarts)
start.EditableRange.Remove();
- Sometimes, due to a new permission policy, you have to change the editor of the editable range (it can be a single user or a group). In this case you can use the following code:
NodeCollection editableRangeStarts = doc.GetChildNodes(NodeType.EditableRangeStart, true);
// Change EditorGroup to Administrators, after this only users associated with the Administrators group shall be allowed
// to edit editable ranges using this editing type when document protection is enabled.
((EditableRangeStart)editableRangeStarts[0]).EditableRange.EditorGroup = EditorType.Administrators;
// Only SingleUser 'Aspose\\Andrey' will be able to change this region.
((EditableRangeStart)editableRangeStarts[1]).EditableRange.SingleUser = "Aspose\\Andrey";
- You can do this operation for whole document (using ‘foreach’ like in the first example) or just for the particular editable range (you can find this range by editor (SingleUser) and EditorGroup name):
NodeCollection editableRangeStarts = doc.GetChildNodes(NodeType.EditableRangeStart, true);
foreach (EditableRangeStart start in editableRangeStarts)
{
// For example, restricted EditableRange can be opened for Everyone.
if (start.EditableRange.SingleUser == "Aspose\\Andrey")
start.EditableRange.EditorGroup = EditorType.Everyone;
}
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.
Joseph:
I need to add nodes to a document, and then protect them (ie, set read-only but allow editing of those added nodes). This is similar to setting document protection but then allowing “everyone” editing to a part of the document.
I have logged a new feature request in our issue tracking system as WORDSNET-9000. Your request has also been linked to this issue and you will be notified as soon as it is supported. Sorry for the inconvenience.
Best regards,