Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert RTF files to TXT format
Message
De
03/10/2001 10:19:46
 
 
À
03/10/2001 05:08:03
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00563075
Message ID:
00563585
Vues:
19
>>Does anyone know of a third-party product that will convert RTF files to TXT format? We really need a program that will run on its own (a batch program) to convert mass quantities of files on a daily basis.
>>
>>TIA!
>
>Joe,
>Below code would get a directory where .rtf are stored and write out .txt versions. Pls be notified rtf has a LoadFile method but it can't be used here because it can't accomodate to fast operations - you'd need set step, wait or alike (instead fopen(),TextRTF etc was used).
>
local lcRTFDir,lnRTFFiles,myRTF, lcSaveFile,lnSize
>local array arrRTF[1]
>lcRTFDir = getdir()
>if empty(lcRTFDir)
>	return
>endif
>lnRTFFiles = adir(arrRTF, lcRTFDir+'*.rtf')
>myRTF = CREATEOBJECT("RICHTEXT.RichTextCtrl.1")
>for ix=1 to lnRTFFiles
> lcSaveFile = lcRTFDir+stuff(arrRTF[ix,1],rat('.RTF',arrRTF[ix,1]),len('.rtf'),'.txt')
> lnHandle=fopen(lcRTFDir+arrRTF[ix,1])
> lnSize=fseek(lnHandle,0,2)
> =fseek(lnHandle,0,0)
> myRTF.TextRTF=fread(lnHandle,lnSize)
> =fclose(lnHandle)
> myRTF.SaveFile(lcSaveFile,1)	
>endfor
>
Cetin

Thanks for the code. I have tried it and am getting an Exception Code saying

OLE IDIPSATCH EXCEPTION CODE 0 FROM RICHTEXTCTRL: PROPERTY CANNOT BE SET.

What is causing this error? or why can't the property be set?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform