Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying General field contents to Disk
Message
From
22/09/1998 07:13:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/09/1998 04:30:35
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00139390
Message ID:
00139409
Views:
21
>I have small DBFs that are stored in the General field of another DBF. How
>do I programatically copy one of these small embedded DBFs to disk.
>
>Alternatively - how can I programatically open this small DBF in the General
>field in a Selected area so that I can access the data in it. I know this
>can be done by double clicking on the General field, but I want this process
>to be transparent to the user.
>
>Best Regards
>
>
>Ian Morley
>QA Software
Ian,
It would be easier to maintain binary data in a memo field. Anyway if host supports OLEAutomation then you could use its saveas method. This example is a word example doing it with 2 different OLE control. First is OLEBoundcontrol and does a saveas an embedded word doc. The second one is an OLEControl using saved doc as a documentfile. To test it you could create \temp\wtest with a gen field (wf) and embed a word doc there.
use \temp\wtest  && Fields (wf g)
oform = createobject("form")
with oForm
  .addobject("olbW","Oleboundcontrol")
  .height = 420
  .width = 620
  with .olbW
	.top = 10
	.left = 10
	.height = 400
	.width = 600
	.controlsource = "wtest.wf"    		&& Embedded word doc
	.object.saveas("c:\temp\testsave.doc")  && saved to disk
  endwith	
  .removeobject("olbW")
  .AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button
  .AddObject("oleObject","oleWordObject")  && Add OLE object
  .cmdCommand1.Visible=.T.	 	&& Display the "Quit" Command button
  .oleObject.DoVerb(-1)			&& -1 for Edit
  .Show					&& Display the form
endwith	
READ EVENTS	&& Start event processing

DEFINE CLASS oleWordObject as OLEControl
  OleClass ="Word.document.8"		&& Server name
  OleTypeAllowed = 0 			&& Linked
  DocumentFile = "C:\temp\testsave.doc"	&& This file created from embedded
ENDDEFINE

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button
	Caption = '\<Quit'  && Caption on the Command button
	Cancel = .T.  && Default Cancel Command button (Esc)
	Left = 1  && Command button column

	Top = 1  && Command button row
	Height = 25  && Command button height

	PROCEDURE Click
		CLEAR EVENTS  && Stop event processing, close form
        ENDPROC
ENDDEFINE
You'll notice "quit" button and form seem useless. They're there to demonstrate OLEObject working in background. W/o them operation would be transparent to user.
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
Reply
Map
View

Click here to load this message in the networking platform