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
}
}