- Export the figure as a '.png' file.
- Instead of using the 'Slide.Shapes.Placeholders'
- Insert the image directly using 'Slide.Shapes.AddPicture' with the path of the exported image
- Set appropriate parameters to set the image.
Paste a figure to powerpoint with actxserver when the presentation is invisible
    15 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hi,
I am using actxserver('PowerPoint.Application') to make PowerPoint presentations in Matlab. I changed the Open function to make the presentation invisible:
h = actxserver('PowerPoint.Application'); %Create an ActiveX object
hInterface = h.Presentation.Open( fullfile(obj.templatePath_1, obj.templateName_1), 0,0,0 ); %Open an existing presentation by supplying the fullpath to the file
To copy figures I use the following method:
function addFigure(obj, actserverPP_in, presentationInterface_in)
    %Function to copy the figure of the object to the their figure
    %placeholder
    if exist( fullfile(obj.figurePath_1, obj.figureName_1), 'file') == 2 %Check if figure exists
        openfig( fullfile(obj.figurePath_1, obj.figureName_1), 'invisible');
        print -clipboard -dmeta
        noLastSlide = presentationInterface_in.Slides.Count; %Get index of last slide
        Slide = presentationInterface_in.Slides.Item(noLastSlide); %Last slide
        %Slide.Select; %Select last slide -> not allowed when presentation is invisible
        Slide.Shapes.Placeholders.Item( obj.itemId_1 ).Select; %Select item to copy to
        actserverPP_in.ActiveWindow.View.Paste
        close %Close figure
    end
end
While the presentation was visible, I was able to select the slide and the placeholder item to copy the figure to. Now selecting the placeholder and paste the figure does not work anymore. I am looking for something like set(Slide.Shapes.Placeholders.Item( obj.itemId_1 ), 'Figure', fig_handle)
Any suggestions? Thanks a lot!
0 comentarios
Respuestas (1)
  Rahul
      
 el 11 de Jun. de 2025
        
      Editada: Rahul
      
 el 11 de Jun. de 2025
  
      I understand that you are trying to paste a figure from MATLAB to Powerpoint using 'actxserver' methods. You mention that you changed the Open function to make the presentation invisible. 
Unfortunately, in this case, the ActiveWindow.View.Paste or Slide.Shapes.Placeholders.Item().Select won't work because selection requires a visible window.
 A workaround in this case would be to:
The following references provide a good resource:
Thanks.
0 comentarios
Ver también
Categorías
				Más información sobre MATLAB Report Generator en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

