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