Hello Support,
This is request from Mahendra Reddy Kona:
We encountered a requirement where we need to maintain a consistent revision color across all document revisions, regardless of the author. Despite following the documentation, I haven’t been able to get the following code to work:
doc.layout_options.revision_options.inserted_text_color = aw.layout.RevisionColor.CLASSIC_BLUE
doc.layout_options.revision_options.deleted_text_color = aw.layout.RevisionColor.CLASSIC_BLUE
Windsurf says the above code works only when converting to PDF so I tried getting the run of each revision node and adjusting the font colour and that didn’t work either.
for rev in doc.revisions:
rng = getattr(rev, 'range', None)
if rng is not None:
runs = rng.get_child_nodes(aw.NodeType.RUN, True)
for r_any in runs:
r_any.as_run().font.color = target_run_color
Is there a more cleaner way to set single colour to all revisions and not by author?
Could you please assist with this issue?
@alexey.butalov
Summary
Aspose.Words can apply a single colour to all tracked changes by setting the document‑level RevisionsColor property. When this property is assigned a concrete colour (e.g., RevisionColor.ClassicBlue), the per‑author colour mapping is ignored, so every insertion and deletion is shown in the same colour both in Word and in rendered outputs such as PDF or HTML.
Why it happens
LayoutOptions.RevisionOptions affects only the rendering stage (PDF, XPS, HTML). It does not change the colour information stored in the DOCX, so Word continues to display author‑based colours.
- Changing the colour of each
Run.Font modifies only the visual appearance of the run; the revision metadata that Word uses to decide the colour remains unchanged, so the change is lost when the document is reopened.
What to do next
- Set a uniform revision colour for the whole document
using Aspose.Words;
using Aspose.Words.Layout;
// Load the document that contains tracked changes
Document doc = new Document("Result.docx");
// Apply a single colour to all revisions (inserted and deleted)
doc.RevisionsColor = RevisionColor.ClassicBlue; // any RevisionColor enum value
// Optional: also enforce the colour when rendering to PDF/HTML
doc.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.ClassicBlue;
doc.LayoutOptions.RevisionOptions.DeletedTextColor = RevisionColor.ClassicBlue;
// Save the document
doc.Save("Result_UniformRevisions.docx"); // DOCX with uniform colour
doc.Save("Result_UniformRevisions.pdf", SaveFormat.Pdf); // PDF with the same colour
- Verify the outcome
- Open the saved DOCX in Microsoft Word – all tracked changes should appear in the colour you set.
- Open the generated PDF – the inserted and deleted text should also be shown in that colour.
-
Use a different colour
Replace RevisionColor.ClassicBlue with any other value from the RevisionColor enum (e.g., Red, Green, Purple). The same single colour will be applied to every revision regardless of the author.
-
Keep author‑specific colours when needed
- Do not set
doc.RevisionsColor; leave it at its default (RevisionColor.ByAuthor).
- Use only the
LayoutOptions.RevisionOptions for the specific output format that requires a uniform colour, leaving the DOCX unchanged.
Note – The RevisionsColor property and the related LayoutOptions.RevisionOptions are available in recent releases of Aspose.Words for .NET/.NET Core. If you do not see these members, consider updating to a newer version of the library.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
@alexey.butalov
You are right, layout_options.revision_options. allows configuring revision appearance while converting document to fixed page formats, like PDF. Unfortunately, there is no way configure revision appearance for .NET or other flow formats. Revision appearance is configured on application level. For example in MS Word you can configure them in this menu: