View Single Post
  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default INCLUDETEXT field adding extra carriage return before and after

Although the rest of this conversation appears to be about TOC fields,
as far as INCLUDETEXT fields go, whether they insert "extra" paragraph
marks depends on
a. what is in the thing you are inserting
b. what type of file you are inserting

For (a), if you are inserting a complete Word file, you need to know
that a Word document always has a final paragraph/section mark, and that
is inserted. e.g. suppose you have a document called myfile.doc that
contains single paragraph as follows:

Hello world!

then a document containing

aaa{ INCLUDETEXT "myfile.doc" }zzz

will show

aaaHello world!
zzz

not

aaaHello world!zzz

You can work around that problem by inserting a bookmark, e.g. mybm, in
myfile.doc that covers all the text except the final paragraph mark, and
referencing that in the includetext field, e.g.

aaa{ INCLUDETEXT "myfile.doc" mybm }zzz

For (b), if you include text from (say) a plain text file, you will also
always get a paragraph mark at the end of the field result, even if the
text file has no CR or CRLF at the end. AFAIK you cannot avoid that
using a bookmark (i.e. as above) because plain text fiels don't have
bookmarks.

Beyond that (doubt if many people need to know stuff beyond that,
but...) what happens depends partly on whether Word uses a built-in text
converter (the sort it uses to open "native" Word formats such as Word
..doc, .rtf, possibly .txt and certainly .htm) or an external text
converter, e.g. the sort it uses to open WordPerfect or Works files.
With internal converters, it is still possible to INCLUDETEXT without
inserting a paragraph mark if the source format supports bookmarks. For
example, you can define a bookmark in HTML using the a element

(e.g.

a name="mybm"Hello world!/a

and that bookmark can be referenced in an INCLUDETEXT field the same way
as a bookmark in a .doc

With external converters, Word inserts at least one additional paragraph
mark whatever you do. That is a little strange because in Word 2003,
converters have to supply Word with a stream of RTF, i.e. the bookmarks
look exactly the same as they do in a .rtf file, but Word inserts an
extra paragraph mark anyway.

Peter Jamieson

http://tips.pjmsn.me.uk

On 14/11/2009 18:01, petersk wrote:
Is there any way to eliminate the extra paragraph mark being inserted in MS
Word 2003 before and after the field {INCLUDETEXT} ?

Kurt