Information générale
Catégorie:
Contrôles ActiveX en VFP
Sorry about the first submission. I used less than greater than signs. Sorry, I wasn't thinking. Here you go again.
Excel uses the MicroSoft Graph or MSGRAPH ActiveX object. You can use this control in a number of ways with Visual FoxPro general fields.
1. If you have already created the graph and only want to move the graph from Excel to the VFP general field do the following:
a. Open Excel and select the graph
b. Copy the graph (CTRL+C)
c. Go to the VFP command window
d. USE TableWithGeneralField
e. BROWSE
f. Move to the desired record and move to the general field
g. CTRL+HOME (opens the general field content)
h. CTRL+V (Pastes the graph in the general field
2. Programatically add the Excel Graph to the general field in VFP from the .XLS file itself:
a. Go to the VFP command window
b. USE TableWithGeneralField
c. APPEND BLANK (create a new record)
d. APPEND GENERAL [GeneralFieldName] FROM X:\Book1.XLS CLASS EXCELCHART
3. Prgramatically insert a graph into a general field and bypass Excel altogether:
This is a little more complicated. You must first build a string seperated with TAB's and CARRIAGE RETURNS just as it would be in an Excel table. For example to create a graph with two columns you could format a string like this:
lcData = 'Header 1' + CHR(9) + 'Header 2' + CHR(13) +;
ALLTRIM(STR()) + CHR(9) + ALLTRIM(STR()) + CHR(13)
Once the string is formatted, execute the following code:
a. Go to the VFP command window or place this in your code
b. USE TableWithGeneralField IN 0
c. SELECT TableWithGeneralField
d. APPEND GENERAL [GeneralFieldName] DATA lcData CLASS msgraph
Note: Depending on your current version of your MsGraph control registered on you computer the CLASS statement may vary. You can reference MSDN and you FoxPro help for more infomration on formatting and using the MsGraph control.
Hope this helped.
Trent L. Taylor
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement