INCLUDETEXT field problem witht Word 2007

P

pierre0102

Hello,

I manage to include text from a text file in my word document with the
following RTF field statement.
However I had to update manually the field (with F9) to update the
field and make the text appear after having oppened the word file.
I was using Word 2003 and everything was fine, but when switching to
word 2007, the text was not loaded anymore even after a field update
(still with F9)...

---------------------------------------------------
\pard\ql{\field{\*\fldinst { INCLUDETEXT "C:/data/MyText.txt" \\! \\*
MERGEFORMAT }}}
---------------------------------------------------

I am not sure about the use of the switches ... \\! \\* MERGEFORMAT

any ideas ?

Thanks,

PB
 
P

Peter Jamieson

However I had to update manually the field (with F9) to update the
field and make the text appear after having oppened the word file.

This has been standard behaviour in Word for quite a long time - it's a
"security feature"
\pard\ql{\field{\*\fldinst { INCLUDETEXT "C:/data/MyText.txt" \\! \\*
MERGEFORMAT }}}
I am not sure about the use of the switches ... \\! \\* MERGEFORMAT

I would certainly get rid of the \\! (which would lock the result) and
probably the \\* MERGEFORMAT

It's just possible that Word 2007 requires one or both of the \fldedit
and \fldrslt keywords, but I doubt it

You may also need to replace the "/" characters by "\\\\" (double
because \ is the escape character for \ in rtf, and doubled again
because you need double-backslashes in pathname literals in the field
code iin Word itself, i.e.

\pard\ql{\field{\fldedit{\*\fldinst{ INCLUDETEXT
"C:\\\\data\\\\MyText.txt" }}}

See how that goes...

Peter Jamieson

http://tips.pjmsn.me.uk
 
M

macropod

Hi Peter,

If the source document is protected for forms, the \! switch will be needed.
 
P

Peter Jamieson

Thanks.

Now I can check both versions, it looks as if the only thing that really
needs to change is the "/" separators in the pathname, which appear to
work in Word 2003 but not Word 2007, to \\\\ as that appears to work in
both versions - assuming that there is no additional OS-version related
effect.

Peter Jamieson

http://tips.pjmsn.me.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top