Track Changes - Change DeletedTextColor dynamically

Hi,

We are using Aspose.words 17.3.0.0.

We need to make the deleted text color dynamic. Basically it is database driven. We tried and did not get success.

Code has been pasted below. I must be doing something wrong.

Document doc = new Document(“D:\temp\in.docx”);

        DocumentBuilder builder = new DocumentBuilder(doc);

        builder.Document.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.DarkBlue;
        builder.Document.LayoutOptions.RevisionOptions.CommentColor = RevisionColor.DarkBlue;

        builder.Document.LayoutOptions.RevisionOptions.RevisedPropertiesColor = RevisionColor.DarkBlue;
        builder.Document.LayoutOptions.RevisionOptions.DeletedTextColor = RevisionColor.DarkBlue;
        builder.Document.LayoutOptions.RevisionOptions.MovedFromTextColor = RevisionColor.DarkBlue;
        builder.Document.LayoutOptions.RevisionOptions.MovedToTextColor = RevisionColor.DarkBlue;

        builder.Document.Save("D:\\temp\\out.docx");

@manishtiwari

Thanks for your inquiry. Please try following code snippet to use RevsionsOptions class properties, hopefully it will help you to accomplish the task. However, If you still face any issue then please share your sample input and expected output document here, we will look into these and will guide you accordingly.

Document doc = new Document("input.docx");
doc.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.DarkBlue;
...

Best Regards,

Thanks,

The code does not seem to be giving expected result. Let me attach the input/output document image.

image.png (8.0 KB)

@manishtiwari,

Thanks for your feedback. I am sorry for the confusion. Please note the RevisionOptions controls revision text settings while rendering word document to PDF. For Word documents the MS Word settings are used.Revision_test_AW17.7.pdf (11.8 KB)

Document doc = new Document("test.docx");
doc.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.DarkBlue;
doc.LayoutOptions.RevisionOptions.CommentColor = RevisionColor.DarkYellow;
doc.LayoutOptions.RevisionOptions.DeletedTextColor = RevisionColor.BrightGreen;
doc.Save("Revision_test_AW17.7.pdf");

Best Regards,