Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert RTF files to TXT format
Message
De
03/10/2001 10:43:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
03/10/2001 10:19:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00563075
Message ID:
00563608
Vues:
12
>>>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?
Joe,
MS KB says it's a confirmed bug and was corrected in VS SP5. Would you check your version. It's in system or system32 directory named Richtx32.ocx. Version should read 6.0.88.77
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform