| 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 |
| In-Reply-To: | <200605311920.k4VIHWuW012368@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; format=flowed |
|---|
pmaradan@COMPILSYS.COM wrote:
>Hi,
>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;
> input;
> if index(tmp,'stringtomodify') > 0 then
> tmp=tranwrd(tmp,'stringtomodify','stringmodified');
> put tmp $varying32767. len;
> run;
>
>...but does'nt work.
>I choose WORD document because same RTF document is ~20MB instead of
>~350K...
>thanks folks
>Pascal
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
automatically,
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.
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
|