Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
PromisedOyster PromisedOyster is offline
external usenet poster
 
Posts: 4
Default Problems with mail merge

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.R ange, 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?

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Problems with mail merge

I don't know C programming, but you need to add a \*charformat switch to
your conditional field to get it to adopt the style of the text into which
it is inserted.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PromisedOyster wrote:
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.R ange, 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?



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
PromisedOyster PromisedOyster is offline
external usenet poster
 
Posts: 4
Default Problems with mail merge

I changed the code as follows but this did not fix the problem

Word.MailMergeField condition =
_wordDoc.MailMerge.Fields.AddIf(_wordApp.Selection .Range
,fieldName + "\\* charformat"
,wdComparison
,ref oCompareTo
,ref oMissing
,ref oTrueText
,ref oMissing
,ref oFalseText
);
Graham Mayor wrote:
I don't know C programming, but you need to add a \*charformat switch to
your conditional field to get it to adopt the style of the text into which
it is inserted.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PromisedOyster wrote:
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.R ange, 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?


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Problems with mail merge

The space should really be before the slash not after the asterisk.
" \\*charformat" though I suspect the real problem is that the field is not
being updated.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



PromisedOyster wrote:
I changed the code as follows but this did not fix the problem

Word.MailMergeField condition =
_wordDoc.MailMerge.Fields.AddIf(_wordApp.Selection .Range
,fieldName + "\\* charformat"
,wdComparison
,ref oCompareTo
,ref oMissing
,ref oTrueText
,ref oMissing
,ref oFalseText
);
Graham Mayor wrote:
I don't know C programming, but you need to add a \*charformat
switch to your conditional field to get it to adopt the style of the
text into which it is inserted.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PromisedOyster wrote:
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.R ange, 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?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th 07 09:33 PM
Field problems with Mail Merge Debbie Baker Mailmerge 1 December 8th 05 08:58 PM
Mail Merge Date Format Problems tony Microsoft Word Help 2 October 11th 05 10:09 PM
If statement problems in mail merge jameseyryan Mailmerge 6 August 5th 05 09:29 PM
Mail Merge - Parameter prompts twice... TL Mailmerge 6 June 17th 05 02:58 PM


All times are GMT +1. The time now is 12:27 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"