Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to copy an Excel Chart and save it as JPG/GIf
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00795319
Message ID:
00795384
Vues:
17
Anatoliy,
You could just add oApp.Chart.Export(...) to the bottom of your code and take out the copy method and be done with it without the need to call anything else external. Something like:
oApp.Chart.Export("\images\temp\"+output+".GIF","GIF")
. Just need to get the objects and method names right.
>Run the following code, which creates several Excel objects and buidls a simple chart:
>
>CLEAR
>CLEAR ALL
>
>#DEFINE xl3DPieExploded    70
>
>PUBLIC oApp, oBook, oSheet, oChart
>oApp = CreateObject('Excel.Application')
>oBook = oApp.Workbooks.Add()
>oSheet = oBook.Sheets(1)
>
>WITH oSheet
>	.Range('A1').Value = 'Grocery'
>	.Range('A2').Value = 'Insurance'
>	.Range('A3').Value = 'Car lease'
>	.Range('A4').Value = 'Home Mortgage'
>	.Range('A5').Value = 'Hydro bill'
>	.Range('A6').Value = 'Water bill'
>	.Range('A7').Value = 'Other bills'
>
>	.Range('B1').Value = 559.33
>	.Range('B2').Value = 410.00
>	.Range('B3').Value = 254.44
>	.Range('B4').Value = 1631.56
>	.Range('B5').Value = 143.05
>	.Range('B6').Value = 84.15
>	.Range('B7').Value = 169.00
>	
>	.Range('A1:B7').Select
>ENDWITH
>
>oChart = oApp.Charts.Add
>WITH oChart
>	.ChartType = xl3DPieExploded
>	.Select
>ENDWITH
>
>oApp.Selection.Copy
>oBook.Close(0)
>oApp.Quit
>
>
>If no errors happened, you have an image of created chart in the clipboard. Open any graphics application (like Paint) and do Paste command.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform