P
PromisedOyster
We have a C# program that programatically inserts merge fields and into
a Word document. There are basically two different types of merge field
that get inserted:
1. An ordinary merge field
2. An If merge field
Both merge fields insert perfectly well and is getting used in
production extensively.
With the ordinary merge field, the font that gets assigned to the newly
inserted mergefield is the current one (ie the one used for the
surrounding text). However, with the if merge field, the font that
gets applied is the default font, ie Times New Roman. Ideally, this
should behave in exactly the same manner and get the current font.
See code below for example calls:
_wordDoc.MailMerge.Fields.Add(_wordApp.Selection.Range, fieldName);
Word.MailMergeField condition =
_wordDoc.MailMerge.Fields.AddIf(_wordApp.Selection.Range
,fieldName
,wdComparison
,ref oCompareTo
,ref oMissing
,ref oTrueText
,ref oMissing
,ref oFalseText
);
Although I could reselect and apply a font, it seems cumbersome. Is
there an easier way?
Is this a bug or am I doing something wrong?
a Word document. There are basically two different types of merge field
that get inserted:
1. An ordinary merge field
2. An If merge field
Both merge fields insert perfectly well and is getting used in
production extensively.
With the ordinary merge field, the font that gets assigned to the newly
inserted mergefield is the current one (ie the one used for the
surrounding text). However, with the if merge field, the font that
gets applied is the default font, ie Times New Roman. Ideally, this
should behave in exactly the same manner and get the current font.
See code below for example calls:
_wordDoc.MailMerge.Fields.Add(_wordApp.Selection.Range, fieldName);
Word.MailMergeField condition =
_wordDoc.MailMerge.Fields.AddIf(_wordApp.Selection.Range
,fieldName
,wdComparison
,ref oCompareTo
,ref oMissing
,ref oTrueText
,ref oMissing
,ref oFalseText
);
Although I could reselect and apply a font, it seems cumbersome. Is
there an easier way?
Is this a bug or am I doing something wrong?