Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conversion of text file into MS-Excel
Message
From
20/09/2002 06:52:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00702626
Message ID:
00702641
Views:
10
>Hi All,
>
>Is there any function or utility is available in VFP to convert ";" deleimited text file to MS Excel.
>
>TIA
>Ajay

Ajay,
You could use OPenText method.
If you know the format of fields create an array defining it.

oExcel.Workbooks.OpenText(lcSemiColonFile,,,xlDelimited,,,,.T.,,,,, @arrFldSemicolonInfo)

If you don't have it the do not pass field info array.

oExcel.Workbooks.OpenText(lcSemiColonFile,,,xlDelimited,,,,.T.)

Field info array is two dimensional where first defines the column order and second formatting. ie:
If you would export 10 columns where 5,6th columns are date type and you want them as MDY (rest text):
#DEFINE xlDelimited	1	
#DEFINE xlFixedWidth	2	

#DEFINE xlGeneralFormat	1	
#DEFINE xlTextFormat	2	
#DEFINE xlMDYFormat	3	
#DEFINE xlDMYFormat	4	
#DEFINE xlYMDFormat	5	
#DEFINE xlMYDFormat	6	
#DEFINE xlDYMFormat	7	
#DEFINE xlYDMFormat	8	
#DEFINE xlSkipColumn	9	
#DEFINE xlEMDFormat	10	

dimension arrFldSemicolonInfo[10,2]
for ix=1 to 10
 arrFldSemicolonInfo[ix,1]=ix
 arrFldSemicolonInfo[ix,2]=xlTextFormat
endfor
arrFldSemicolonInfo[5,2]=xlMDYFormat
arrFldSemicolonInfo[6,2]=xlMDYFormat
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