Bonjour,
Je souhaterais mettre mes images dans une présentation PowerPoint. Tout va bien avec PowerPoint 2003 mais le pb c'est que je dois avoir PowerPoint 2007 sur ma machine, et avec 2007, impossible d'ajouter des diapos :
Le code que j'ai utilisé est celui du FEX :
Dans le prompt, il s'affiche ce qui suit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 %% Open PowerPoint as a COM Automation server h = actxserver('PowerPoint.Application') % Show the PowerPoint window h.Visible = 1; % What attributes and operations are available for the handle "h"? These % are attributes and operations of the PowerPoint object ... and are % documented in the PowerPoint Visual Basic Reference. Bring up the % PowerPoint session help window: h.Help % Not that PowerPoint documentes in VBA syntax ... so operation signatures % may need a little translating. %% ADD PRESENTATION % View the methods that can be invoked h.Presentation.invoke % Add a presentation via "Add" method Presentation = h.Presentation.Add %% ADD SLIDES % View the methods that can be invoked Presentation.Slides.invoke % Add two slides via "Add" method Slide1 = Presentation.Slides.Add(1,'ppLayoutBlank') Slide2 = Presentation.Slides.Add(2,'ppLayoutBlank')
A priori, il y aurait 2 manières de résoudre le pb :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 h = COM.PowerPoint_Application Item = handle Item(handle, Variant) Add = handle Add(handle, Variant(Optional)) Open = handle Open(handle, string, Variant(Optional)) CheckOut = void CheckOut(handle, string) CanCheckOut = bool CanCheckOut(handle, string) Open2007 = handle Open2007(handle, string, Variant(Optional)) Presentation = Interface.Microsoft_PowerPoint_12.0_Object_Library._Presentation Item = handle Item(handle, Variant) FindBySlideID = handle FindBySlideID(handle, int32) InsertFromFile = int32 InsertFromFile(handle, string, int32, Variant(Optional)) Range = handle Range(handle, Variant(Optional)) Paste = handle Paste(handle, Variant(Optional)) AddSlide = handle AddSlide(handle, int32, handle) ??? No appropriate method, property, or field Add for class Interface.Microsoft_PowerPoint_12.0_Object_Library.Slides.
Changer le code pour que ça fonctionne avec PowerPoint 2007 ou faire en sorte que Matlab appelle PowerPoint 2003 au lieu de 2007 (j'ai les 2 versions installés).
Mais bien sûr, je ne vois pas du tout comment je pourrais faire ça.
Merci pour vos idées
Partager