Created
June 6, 2024 13:34
-
-
Save bjoerntx/48a7bf0d88cdd2dc09a04d6cc4c60096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ReplaceWithMergeField(ServerTextControl textControl, FieldInfo field) | |
{ | |
textControl.Select(field.StartIndex, field.EndIndex - field.StartIndex); | |
var selectionText = textControl.Selection.Text; | |
var mergeField = new MergeField | |
{ | |
Name = field.FieldName, | |
Text = selectionText, | |
ApplicationField = | |
{ | |
DoubledInputPosition = true, | |
HighlightMode = HighlightMode.Activated | |
} | |
}; | |
textControl.Selection.Text = string.Empty; | |
textControl.ApplicationFields.Add(mergeField.ApplicationField); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment