Date: Wed, 31 May 2006 22:13:20 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Read/Write Microsoft Word document
Content-Type: text/plain; format=flowed
>Does anyone knows how to read a Microsoft Word document (not RTF) and
>write into a new one with some string modified...
>I tried :
> data _null_;
> infile 'c:\mydocument.doc' recfm=n length=len _infile_=tmp;
> if index(tmp,'stringtomodify') > 0 then
> put tmp $varying32767. len;
>...but does'nt work.
>I choose WORD document because same RTF document is ~20MB instead of
In addition to Alan's excellent suggestions, let me suggest Perl. It has
win32 modules specifically for stuff like this.
However, in general, I don't recommend doing this sort of task
unless you have a lot of safeguards in place to make sure you do not also
change things which you didn't want to be changed. Or that the changes
all meet the specifications you needed.
And if your RTF file is 20 Megs while your .doc file is 350K, then you have
probably done something like embedding images into your RTF file. Normally,
an RTF file is just not going to be that big.
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
FREE pop-up blocking with the new MSN Toolbar – get it now!