Hello,
I need to replace all occurrences of "*1" with suberscripted "*1" (see attachement)
So Duration *1 should be:
So how can I search for "*1" and replace it with its suberscripted text?
Thank you
Document document = new Document();
document.LoadFromFile(@"test.docx");
TextSelection[] textSelections = document.FindAllString("*1", false, true);
foreach (TextSelection selection in textSelections)
{
//Set the searched text as subscript
//selection.GetAsOneRange().CharacterFormat.SubSuperScript = SubSuperScript.SubScript;
//Set the searched text as SuperScript
selection.GetAsOneRange().CharacterFormat.SubSuperScript = SubSuperScript.SuperScript;
}
document.SaveToFile("result.docx", FileFormat.Docx);