Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying the contents of a Word document
Message
De
05/05/2001 04:30:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00503281
Message ID:
00503882
Vues:
25
>I have a list of Word document file paths and names in a DBF file.
>What is the easiest way to copy the contents of each document into a memo
>file in the same DBF file ?

Carmel,
Depends on how you want the contents.
-If you want it as a General field. Add a general column say WordDoc :
scan
  append general WordDoc from (myTable.MyPath)
endscan
-If you want an RTF or HTML version :
#define wdFormatRTF  6
oWord = createobject('Word.Application')
with oWord
 scan
  .Documents.Open(myTable.MyPath)
  .Activedocument.SaveAs(ForceExt(myTable.MyPath,'RTF'),wdFormatRTF)
  .ActiveDocument.Close(-1)
  append memo mytable.myRTF from (ForceExt(myTable.MyPath,'RTF'))
 endscan
 .quit
endwith
For HTML if wdFormatHTML=8 is not defined (ie:word97) you can use fileconverters to find it :
for each oConverter in oWord.Fileconverters
  if oConverter.ClassName = 'HTML'
     wdFormatHTML = oConverter.SaveFormat
  endif
endfor
-If you want only pure text content :
oWord = createobject('Word.Application')
with oWord
 scan
  .Documents.Open(myTable.MyPath)
  .ActiveDocument.Content.Select
  .Selection.Copy
  .ActiveDocument.Close(0)
  replace mytable.myDocContent with _cliptext
 endscan
 .quit
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform