Aspose.Words.Examples.CSharp.Programming_Documents.Working_With_Document.DocumentBuilderInsertTCFieldsAtText.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:DocumentBuilderInsertTCFieldsAtText
            Document doc = new Document();

            FindReplaceOptions options = new FindReplaceOptions();

            // Highlight newly inserted content.
            options.ApplyFont.HighlightColor = Color.DarkOrange;
            options.ReplacingCallback =  new InsertTCFieldHandler("Chapter 1", "\\l 1");

            // Insert a TC field which displays "Chapter 1" just before the text "The Beginning" in the document.
            doc.Range.Replace(new Regex("The Beginning"), "", options);
            // ExEnd:DocumentBuilderInsertTCFieldsAtText
          
        }     
    }
DocumentBuilderInsertTCFieldsAtText