Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert RTF files to TXT format
Message
From
03/10/2001 05:08:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/10/2001 11:31:50
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00563075
Message ID:
00563468
Views:
18
>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
Ç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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform