Compartir a través de


Dynamic Information Sharing

In Visual FoxPro, you can dynamically include data from other applications and still have those applications maintain the data by linking or embedding it in your application. For example, you can link or embed a Word document in a General field or you can link or embed a Microsoft Excel worksheet on a form.

When you dynamically link data, it is stored in its source file, not in your Visual FoxPro table or form. The table or form stores only the location of the source and displays a representation of the linked data. Linked data is updated when the source file changes and retains a connection to its source file, unless you break the connection (see Changing or Breaking Links to Data).

Note   Files with an .avi extension are always linked.

When you dynamically embed data, it is stored only in your table or form. This data does not retain a connection to its source file. If changes are made to the source file, they do not appear in your Visual FoxPro application.

Embedding and linking data

Create links when:

  • Data or graphics are likely to change.
  • Your application necessarily includes the latest version available.
  • The source files are available for updating on your computer or across a network.
  • The source files must be shared with other applications.

Embed data or graphics when:

  • You don't need to have the most current versions in your application.
  • The embedded data need not be included in more than one application.
  • The source files would not be available for updating if they were linked.

Use the following guidelines to decide on linking or embedding:

To Use this method Details
Create applications you can use on other computers or edit, even if the source files are not present. Embed the data. To edit the data, all applications from which the data come must be installed on the computer.
Include data that might not always be available, such as data stored on a server. Embed the data. All the necessary information is included with the embedded data.
Include a very large file, such as a video or sound clip. Create a link to the source file. Your application stores only the link, keeping the size of the application manageable.
Include data that is maintained separately in its source application. Create a link to the source application. Your application reflects any changes made to the source application.

Related topics describe how to add data to tables, add data to forms, change or break links to data, display linked or embedded data from tables, and edit linked or embedded data.

Copying and Pasting Data

If you want to share small amounts of data quickly and easily, but don't want to share entire files, select the data manually, cut or copy it, and then paste it wherever you want it. For example, copy selected data from a form and then paste it into a Microsoft Word document, or copy selected cells from a Microsoft Excel worksheet and then paste them into a General field in a table. You can even copy and paste data into mail messages and send the messages from within Visual FoxPro.

Tip   To share entire files, link or embed them. For details about linking and embedding, see Dynamic Information Sharing.

To paste data from another application into a General field

  1. Copy the data to the Clipboard.

  2. Open and browse the table containing the General field in which you want to paste the data.

  3. Double-click the General field.

  4. Embed the data by choosing Paste or Paste Special from the Edit menu.

    -or-

    Link to the data by choosing Paste Special from the Edit menu and then selecting Paste Link in the Paste Special dialog box.

    Tip   You can save disk space when linking or embedding by selecting the Display As Icon check box. When this is selected, Visual FoxPro displays the icon instead of the data.

Visual FoxPro Editor supports embedding and enabling hyperlinks. When you include any valid hyperlink protocol trigger, Visual FoxPro applies hyperlink attributes to the entered text.

If hyperlinks are enabled (Options Dialog Box or EditorOptions Property), a hyperlink will be displayed in your editor with the typical underline visual cue of a hyperlink in HTML.

By default, you need to CTRL + click to follow a link. The EditorOptions property lets you change the default so that simple clicking will follow the link. The following table describes the valid protocols.

Protocol Trigger(s) Syntax
File File:/ file:///cDrive/cPath | cFile | file:////cUNCPath
FTP FTP:/ ftp://[cUserName[:cPassword@]]cDomain
Gopher Gopher:/ gopher://cDomain
HTTP HTTP:/, www.<char> http://cDomain
HTTPS HTTP:/ https://cDomain
MailTo MailTo: mailto:cAddress[;cMoreAddresses][&cSubject] [&cBody] [&cCC][&cBCC]
News News: news:cNewsGroup
Telnet Telnet:/ telnet://cDomain[:iPort]

Creating Mail Merges

A common way of sharing data is to mail letters created from addresses stored in Visual FoxPro and templates stored in Microsoft Word. With Visual FoxPro, you can create a Word document containing data from a Visual FoxPro table by using the Mail Merge Wizard.

To use the Mail Merge Wizard

  1. From the Tools menu, choose Wizards.
  2. From the submenu, choose Mail Merge.
  3. Follow the directions in the wizard.

Sending Mail from Visual FoxPro

If you have a mail program installed, you can send mail from Visual FoxPro.

To send mail

  • From the File menu, choose Send.

    Your electronic mail program displays a dialog box in which you can compose and send a mail message.

You can also send mail from an application by using the MAPI Session Control and MAPI Messages Control For more information on these controls, see the ActiveX Controls Overview.

See Also

Inserting Data in Tables | Changing or Breaking Links to Data in Tables | Displaying Embedded or Linked Data on Forms | Displaying Embedded or Linked Data from Tables | Importing and Exporting Data | Adding OLE