A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Embedding INCLUDETEXT in an IF changes styles



 
 
Thread Tools Display Modes
  #1  
Old March 19th, 2010, 11:41 PM posted to microsoft.public.word.mailmerge.fields
sdjwalls
external usenet poster
 
Posts: 2
Default Embedding INCLUDETEXT in an IF changes styles

Hello,

I have a document that needs to pull in other documents based off of what is
in the Subject Document Property, and also have the Table of Contents and
List of Tables update properly (several headings and tables get included with
the inserted document).

If I use just the INCLUDETEXT on its own, it seems to work pretty well...the
doc is inserted, the headings styles look correct, and the TOC and LOT update
properly. My field:

{ INCLUDETEXT "BASE.doc" }

The proper TOC looks similar to:

1.1 Introduction ... 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

However, if I put this INCLUDETEXT inside an IF statement, then things go
awry. The first heading in the included doc doesn't come out right, but next
heading in the included doc seems all right? The added tables do not show up
in the LOT at all when updated. And the TOC is very strange...where the
messed up heading occurred, I have something similar to:

{ if { DOCPROPERTY "Subject" } = "BASE" { INCLUDETEXT "BASE.doc" } }

1.1 Introduction ... 7
1.1 .......... 7
1.1 .......... 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

Beside the fact that this looks odd (should look like example above, w/out
the IF), it doesn't match what the doc is actually showing.

Help is greatly appreciated! This would be wonderful it would actually work!

I saw similar posts, and tried several variations, but didn't find anything
that really matched this (or worked).

Thanks,
SDJWalls
  #2  
Old March 20th, 2010, 06:49 AM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Embedding INCLUDETEXT in an IF changes styles

Hi sdjwalls,

What Style is applied to the paragraph the IF field is attached to?

A slightly different approach you could take, which avoids the IF field altogether, is to use the DOCPROPERTY field in your target
document to refer to different bookmarked ranges in your source document (meaning you'd only need one source document for all the
variable boilerplate text) and code the INCLUDETEXT field along the lines of:
{ INCLUDETEXT "filepath//REFERENCE.doc" { DOCPROPERTY "Subject" } }
With this approach, if your source document has a bookmarked range named 'base' and the target document has a DOCPROPERTY "Subject"
set to 'Base', the corresponding text will be imported. For this to work, you'll need to have a default bookmark name (even if its
range is empty) in the source document for the DOCPROPERTY field to refer.


--
Cheers
macropod
[Microsoft MVP - Word]


"sdjwalls" wrote in message ...
Hello,

I have a document that needs to pull in other documents based off of what is
in the Subject Document Property, and also have the Table of Contents and
List of Tables update properly (several headings and tables get included with
the inserted document).

If I use just the INCLUDETEXT on its own, it seems to work pretty well...the
doc is inserted, the headings styles look correct, and the TOC and LOT update
properly. My field:

{ INCLUDETEXT "BASE.doc" }

The proper TOC looks similar to:

1.1 Introduction ... 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

However, if I put this INCLUDETEXT inside an IF statement, then things go
awry. The first heading in the included doc doesn't come out right, but next
heading in the included doc seems all right? The added tables do not show up
in the LOT at all when updated. And the TOC is very strange...where the
messed up heading occurred, I have something similar to:

{ if { DOCPROPERTY "Subject" } = "BASE" { INCLUDETEXT "BASE.doc" } }

1.1 Introduction ... 7
1.1 .......... 7
1.1 .......... 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

Beside the fact that this looks odd (should look like example above, w/out
the IF), it doesn't match what the doc is actually showing.

Help is greatly appreciated! This would be wonderful it would actually work!

I saw similar posts, and tried several variations, but didn't find anything
that really matched this (or worked).

Thanks,
SDJWalls


  #3  
Old March 22nd, 2010, 05:25 PM posted to microsoft.public.word.mailmerge.fields
sdjwalls
external usenet poster
 
Posts: 2
Default Embedding INCLUDETEXT in an IF changes styles

Hi macropod,

Thank you so much! By changing the problem around like that, it works very
well. I've concatenated my source files and added bookmarks, and it works
very well. Everything updates nicely, without styles getting scrambled. A
workable work-around.

To answer your question, the source docs had a variety of styles. Different
headings, body, etc. I had tried setting the style of the field itself, but
then when the field was updated, everything imported had that same style
without any variation--too flat.

So, does this imply that IF really has problems? Seems fine for straight
text, but nothing more involved than that?

Again-many thanks.
sdjwalls

"macropod" wrote:

Hi sdjwalls,

What Style is applied to the paragraph the IF field is attached to?

A slightly different approach you could take, which avoids the IF field altogether, is to use the DOCPROPERTY field in your target
document to refer to different bookmarked ranges in your source document (meaning you'd only need one source document for all the
variable boilerplate text) and code the INCLUDETEXT field along the lines of:
{ INCLUDETEXT "filepath//REFERENCE.doc" { DOCPROPERTY "Subject" } }
With this approach, if your source document has a bookmarked range named 'base' and the target document has a DOCPROPERTY "Subject"
set to 'Base', the corresponding text will be imported. For this to work, you'll need to have a default bookmark name (even if its
range is empty) in the source document for the DOCPROPERTY field to refer.


--
Cheers
macropod
[Microsoft MVP - Word]


"sdjwalls" wrote in message ...
Hello,

I have a document that needs to pull in other documents based off of what is
in the Subject Document Property, and also have the Table of Contents and
List of Tables update properly (several headings and tables get included with
the inserted document).

If I use just the INCLUDETEXT on its own, it seems to work pretty well...the
doc is inserted, the headings styles look correct, and the TOC and LOT update
properly. My field:

{ INCLUDETEXT "BASE.doc" }

The proper TOC looks similar to:

1.1 Introduction ... 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

However, if I put this INCLUDETEXT inside an IF statement, then things go
awry. The first heading in the included doc doesn't come out right, but next
heading in the included doc seems all right? The added tables do not show up
in the LOT at all when updated. And the TOC is very strange...where the
messed up heading occurred, I have something similar to:

{ if { DOCPROPERTY "Subject" } = "BASE" { INCLUDETEXT "BASE.doc" } }

1.1 Introduction ... 7
1.1 .......... 7
1.1 .......... 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

Beside the fact that this looks odd (should look like example above, w/out
the IF), it doesn't match what the doc is actually showing.

Help is greatly appreciated! This would be wonderful it would actually work!

I saw similar posts, and tried several variations, but didn't find anything
that really matched this (or worked).

Thanks,
SDJWalls


.

  #4  
Old March 22nd, 2010, 11:07 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Embedding INCLUDETEXT in an IF changes styles

Hi sdjwalls,

I don't believe it was the IF field, per se, that was the problem but, more likely, the Style of the paragraph you had it attached
to.

--
Cheers
macropod
[Microsoft MVP - Word]


"sdjwalls" wrote in message ...
Hi macropod,

Thank you so much! By changing the problem around like that, it works very
well. I've concatenated my source files and added bookmarks, and it works
very well. Everything updates nicely, without styles getting scrambled. A
workable work-around.

To answer your question, the source docs had a variety of styles. Different
headings, body, etc. I had tried setting the style of the field itself, but
then when the field was updated, everything imported had that same style
without any variation--too flat.

So, does this imply that IF really has problems? Seems fine for straight
text, but nothing more involved than that?

Again-many thanks.
sdjwalls

"macropod" wrote:

Hi sdjwalls,

What Style is applied to the paragraph the IF field is attached to?

A slightly different approach you could take, which avoids the IF field altogether, is to use the DOCPROPERTY field in your
target
document to refer to different bookmarked ranges in your source document (meaning you'd only need one source document for all the
variable boilerplate text) and code the INCLUDETEXT field along the lines of:
{ INCLUDETEXT "filepath//REFERENCE.doc" { DOCPROPERTY "Subject" } }
With this approach, if your source document has a bookmarked range named 'base' and the target document has a DOCPROPERTY
"Subject"
set to 'Base', the corresponding text will be imported. For this to work, you'll need to have a default bookmark name (even if
its
range is empty) in the source document for the DOCPROPERTY field to refer.


--
Cheers
macropod
[Microsoft MVP - Word]


"sdjwalls" wrote in message ...
Hello,

I have a document that needs to pull in other documents based off of what is
in the Subject Document Property, and also have the Table of Contents and
List of Tables update properly (several headings and tables get included with
the inserted document).

If I use just the INCLUDETEXT on its own, it seems to work pretty well...the
doc is inserted, the headings styles look correct, and the TOC and LOT update
properly. My field:

{ INCLUDETEXT "BASE.doc" }

The proper TOC looks similar to:

1.1 Introduction ... 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

However, if I put this INCLUDETEXT inside an IF statement, then things go
awry. The first heading in the included doc doesn't come out right, but next
heading in the included doc seems all right? The added tables do not show up
in the LOT at all when updated. And the TOC is very strange...where the
messed up heading occurred, I have something similar to:

{ if { DOCPROPERTY "Subject" } = "BASE" { INCLUDETEXT "BASE.doc" } }

1.1 Introduction ... 7
1.1 .......... 7
1.1 .......... 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.1.1 7
1.2 Base Config ..... 7
1.3 Base Config Desc ...8
1.3.1 Desc A ...8
1.3.2 Desc B ...9

Beside the fact that this looks odd (should look like example above, w/out
the IF), it doesn't match what the doc is actually showing.

Help is greatly appreciated! This would be wonderful it would actually work!

I saw similar posts, and tried several variations, but didn't find anything
that really matched this (or worked).

Thanks,
SDJWalls


.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.