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

Free Support Forum - aspose.com

Incorrect EditableRangeStartValue format when opening document

I’m working on a creating a document with editable ranges to restricted access to content in the document. The document is being constructed in the manner below, however when the document is re-opened in aspose after being saved, an Aspose.Words.FileCorruptedException is thrown with message:
The document appears to be corrupted and cannot be loaded. ---> System.ArgumentException: incorrect EditableRangeStartValue format.

I’m not exactly sure what I’m doing wrong here or how to resolve this message. Any help would be appreciated

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveTo(doc.Sections[0].Body.FirstParagraph);
builder.StartEditableRange();
builder.InsertNode(new Run(doc));
builder.EndEditableRange();

builder.MoveTo(doc.Sections[0].Body.FirstParagraph.LastChild);
builder.StartBookmark("customBookmark");
builder.EndBookmark("customBookMark");

doc.Protect(ProtectionType.ReadOnly, "somePassword");
doc.Save(@"C:\Temp\test.rtf");

Document doc2 = new Document(@"C:\Temp\test.rtf"); //throws  Aspose.Words.FileCorruptedException

@elliot.justice

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18124. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-18124) have been fixed in this Aspose.Words for .NET 19.3 update and this Aspose.Words for Java 19.3 update.