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

Free Support Forum - aspose.com

Formatting in word using Aspose

Hello Experts,
In My active “document1.docx”(opening) i have a 4 Items like below here,
PRODUCT NAME: kannnan
PURCHASE DATE: 7/1/222014
GROUP TO BILL:
Choose an item.
REMARKS:25
Using my frontend(.net) windows am populated the fields in tree view below

here am selected the “name” field (control) and applying some formating (change the product name color “red” ) thru font dialog box for below code

if (tvXmlpart.SelectedNode.Index != null)
{
    var CurrDoc = Globals.ThisAddIn.Application.ActiveDocument;
    var ControlList = GetContentControlByName(tvXmlpart.SelectedNode.Text);
    var DialogBox = CurrDoc.Application.Dialogs[WdWordDialog.wdDialogFormatFont];

    DialogBox.Display();
    foreach (var cControl in ControlList)
    {
        cControl.Range.Select();
        DialogBox.Execute();
    }

Now I want to back to front (reverse action). if i select the “Name” and click font dialog box, the font dilog box show and selected the font color red automatically, how?
If i select the field (kannan) value in document it’s showed, i need without selecting the value in document … how it’s possible…?
Any one give me your suggestion…using ASPOSE?.

Thanks,
Senthil Kumar P

Hi Senthil,

Thanks for your interest in Aspose.Words. Sure, you can easily reset font formatting of Run nodes to default by calling Font.ClearFormatting method. Also, note that all text of the document is stored in runs of text and a Run can only be a child of Paragraph.
https://reference.aspose.com/words/net/aspose.words/run/

Best regards,