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

Free Support Forum - aspose.com

Yellow Color of Content of Editable Ranges in Word Document Turns Red after Calling Document.Unprotect Method C# .NET

Hi @awais.hafeez,
Just need to know when below issue will get resolved and how to track the issue whether its resolved or not in latest/old jar:-

WORDSNET-20207 : Provide option to disable default Yellow color of content of Editable Ranges
Currently we are using aspose-words-17.11-jdk16 jar

@ajit_b,

Unfortunately, there is no further news about this ticket (WORDSNET-20207). We had completed the analysis of this problem and shared the details here; can you please also try the code from my previous post and share your thoughts?

P.S. There is no direct way that you can use to interact with the issue tracking system. But, you are welcome to ask your issue status via the forum threads. We will verify the status from our internal issue tracking system and reply you about the progress.

Hi @awais.hafeez,
THANKS for your quick response.
I have particular requirement where I’m using builder.startEditableRange() & builder.endEditableRange() for editable range and protecting my documents using document.protect().
which is giving the mentioned issue:-
WORDSNET-20207 : Provide option to disable default Yellow color of content of Editable Ranges
and **for time being we are ok with that.

Then we unproctect that document using document.unprotect(),whole document get editable which is right functionality but the same yellow highlighted color or yellow background is converted to red color . I have even tried setBackgroundPatternColor to all my docuemnt paragragh to
new Color(0, 0, 0, 0) or setHighlightColor(new java.awt.Color(0, true)); but still red highlighted color is not removed.

Can you please provide any solution or workaround.

PS :- we don’t want to use section break and then make particular section editable using section.setProtectedForForms(false); at this stage because we use this section break and make particular section editable logic in further lifecycle of this document in our project.

@ajit_b,

The red color you get after calling the Document.Unprotect method is because of Editable Ranges. You can simply remove those Editable Ranges by using the following code:

Document doc = new Document("C:\\temp\\EditableRange.docx");

doc.Unprotect();

foreach (EditableRangeStart editableRangeStart in doc.GetChildNodes(NodeType.EditableRangeStart, true))
{
    EditableRange editableRange = editableRangeStart.EditableRange;
    editableRange.Remove();
}

doc.Save("C:\\temp\\20.10.docx");