Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
General field export
Message
From
08/10/2001 17:23:43
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00565634
Message ID:
00565693
Views:
17
Hi Charles,

If it's in a General field, try using it as a controlsource to an invisible form with an OLEBoundControl. Then, you can use the Object property to access the Save functions of the host application (for example, Word with a Word Document) to create the file.

>When selecting attachments (BLOB'S) stored in an backend table, I retrieve it as a general field for mailing as an attachment. In order to do this I was copying the general field to a separate table and then changing the file type to 'Memo' and then doing a low level file write to create an attachment file. (IF anyone's got a better way I'd love to hear it, I based this on a FAQ that I saw on UT). However, sometimes the file is a spreadsheet, sometimes a BMP. Any ideas on how to then get it in the proper format so that when the recipient opens it the proper association is made? I had a excel spreadsheet stored and wrote it to a filename.xls. The association seemed correct but when it opened it was basically gibberish. Any help would be greatly appreciated. See code snippet below:
>
>tcf='tcf_'+sys(3)
>select attach_fle from sendmail into cursor tempfile
>if file(tcf+".dbf")
> erase (tcf+".dbf")
>endif
>if file(tcf+".fpt")
> erase (tcf+".fpt")
>endif
>copy to (tcf)
>use in select('tempfile')
>
>* change general field type to memo
>ll = fopen(tcf+".dbf",12)
>fseek(ll,43)
>fwrite(ll,'M')
>fclose(ll)
>
>* save data from memo field into file
>use (tcf) alias TT
>this.FileName = getenv('temp')+'\'+"tempfile.xls" && what if it was a BMP?
>if file(this.FileName)
> erase (this.FileName)
>endif
>
>local lH
>lH = FCREATE(this.fileName)
>FWRITE(lH,TT.attach_fle)
>FCLOSE(lH)
>
>* Clean up files
>use in select('TT')
>use in select(tcf)
>
>if file(tcf+".dbf")
> erase (tcf+".dbf")
>endif
>if file(tcf+".fpt")
> erase (tcf+".fpt")
>endif
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform