Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Doing ole automation with powerpoint
Message
 
To
02/11/2006 14:57:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01166733
Message ID:
01166753
Views:
12
>I was thinking about chart
>
>>Hi
>>
>>I will have to make some graph in powerpoint using foxpro date and ole automation.
>>
>>Someone have some sample code about that or a web site giving some trick. I try
>>
>>ox = CREATEOBJECT("powerpoint.application"
>>ox.Presentations.Add
>>ox.Presentations(1).SlideMaster.Background.Fill.ForeColor.rgb = 200+200+100
>>ox.presentations(1).SlideMaster.Shapes.AddDiagram ???????????
>>
>>
>>Thanks

Do not know if it is what you mean, but here is the example of my exercises for creating a graph in Excel, and copy it into PowerPoint slide:
PROCEDURE yExcel2PPT

CLOSE TABLES all
oExcel = CREATEOBJECT("Excel.Application")
WITH oExcel
	.DisplayAlerts = .f.
	.visible = .t.
	.Workbooks.Add()
	WITH .ActiveSheet
		FOR ia=1 TO 20
			.cells(ia,1).value=ia
			.cells(ia,2).value=ia^2
		ENDFOR
		.ChartObjects.Add(100, 100, 200, 200)
		.chartobjects(1).chart.chartwizard(;
		.range(.cells(1,1), .cells(20,2)),-4169,6,2,1,0,0,"Title","X-axis","Y-axis","")
	
		.chartobjects(1).Chart.ChartArea.Copy
	ENDWITH
	.Workbooks.Close
	.DisplayAlerts = .t.	
ENDWITH

oExcel.Quit
oExcel=null
RELEASE oExcel

oPpt = CreateObject("Powerpoint.Application")
oPpt.Visible=.t.

oPptPres = oPpt.Presentations.Add(1)
oPptSlide1 = oPptPres.Slides.Add(1,2)

*oPptSlide1.Shapes(2).TextFrame.TextRange.PasteSpecial(;
	DataType, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Link)

*PpPasteDataType can be one of these PpPasteDataType constants. 

ppPasteBitmap=  1 
ppPasteDefault = 0 		&&default
ppPasteEnhancedMetafile  =2 
ppPasteGIF  =4 
ppPasteHTML=  8 
ppPasteJPG  =5 
ppPasteMetafilePicture = 3 
ppPasteOLEObject  =10 
ppPastePNG = 6 
ppPasteRTF = 9 
ppPasteShape=  11 
ppPasteText  =7 

*DisplayAsIcon  Optional MsoTriState. MsoTrue to display the embedded object (or link) as an icon.
*MsoTriState can be one of these MsoTriState constants. 

*msoCTrue Does not apply to this method. 
*msoFalse default  Does not display the embedded object (or link) as an icon. 
*msoTriStateMixed Does not apply to this method. 
*msoTriStateToggle Does not apply to this method. 
*msoTrue Displays the embedded object (or link) as an icon.

IF VAL(oppt.version)>9  && where is pastespecial for 9 ?
	opptpres.Windows(1).View.PasteSpecial(ppPasteMetafilePicture)
ELSE
*	opptpres.Windows(1).View.Paste()
	oShell = CreateObject("WScript.Shell")
	IF oShell.AppActivate(oppt.Name)
		oShell.SendKeys("%ES")
		oShell.SendKeys("%A{DOWN}~")
	endif
	oShell=.null.
endif

SUSPEND

oPptSlide1 = null
oPptPres = null

oPpt.quit
oPpt = null


RETURN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform