How to check if revision is hyperlink or not

Hello Support
I want to check if the revision is hyperlink or not?
This is because I want to make the links which are not new revisions as black rather than blue,

I am aware that we could revisions from the document,
We can check the parent node as well to check if it is a shape or not but not able to go further to check field type and then to typecast revision as hyperlink field to change the style,

Thanks in advance

Regards
Mandar

@mandar_limaye

Could you please ZIP and attach your input Word document here for our reference? We will then provide you more information about your query.

Hello Tahir,
Please find attached zip file link1.docx with one link, link2.docx with added new link and third file with compare.
In compare although the link colour and new revision colour is slightly different both are blue, hence I want to change the link which had not changed to black as to signify new revision primarily,

Hope this helps

Thanks in advance.

Best Regards
Mandar
Link-Compare.zip (26.1 KB)

@mandar_limaye

Please note that track changes information (color of links) is MS Word (Application) level setting and does not store in the document. Therefore it cannot be controlled by Aspose.Words. This is completely controlled by the viewer which opens the document.

Hello
Yes that is correct and hence what I want to do is

Loop through all the links in document using field type
if the given link revision is not new then
change the style of link to normal rather than blue or change text font colour to black

I could able to loop through links or revisions independently but not able to get them to work together

Looking for help in this area.

Thanks in advance.

Regards
Mandar

@mandar_limaye

Please use TestCompare_Aspose.docx and create your expected output Word document using MS Word and share it here for our reference. We will then provide you more information about your query.

Hello Tahir,

Please find the attached expected output, link1 text is now black and not blue

Thanks in advance.

Regards
Mandar
TestCompare_Aspose-Expected.zip (9.1 KB)

@mandar_limaye

Please use the following code example to get the desired output. Hope this helps you.

var doc = new Document(MyDir + "TestCompare_Aspose.docx");
doc.Styles[StyleIdentifier.Hyperlink].Font.Color = Color.Black;
doc.Save(MyDir + "out.docx");

Hello Tahir,

Thank you, will try.

However is it any way possible to check if the hyperlink is new revision or not?

Regards
Mandar

@mandar_limaye

Yes, you can check either hyperlink is new revision or not. Please check the following code snippet. Hope this helps you.

foreach (Field field in doc.Range.Fields)
{
    if (field.Start.NextSibling != null && field.Start.NextSibling.NodeType == NodeType.Run)
    {
        if (((Run)field.Start.NextSibling).IsDeleteRevision || ((Run)field.Start.NextSibling).IsInsertRevision)
        {
            //Your code...
        }
    }
}

Hello tahir,

Thank you, This will be more suitable to me,

Regards
Mandar