フィルターのクリア

How to align powerpoint texts and images using matlab activex commands

13 ビュー (過去 30 日間)
Marcus Solis
Marcus Solis 2017 年 6 月 12 日
I am trying to automate the process of presenting Matlab graphs in powerpoint. I have figured out how to create a presentation and add slides, pictures, and texts to the presentation; however, I have not found a way to align the texts or images within the slides.
Is there a code to do this?
I have tried using the following without success:
Title1.Text.Frame.TextRange.ParagraphFormat.Alignment = 'ppAlignCenter'; Title1.Text.Frame.TextRange.ParagraphFormat.Alignment = ppAlignCenter; SlideImage1.PictureAlignment = 2;
Here is the code I have right now: % Open PowerPoint as a COM Automation server ppt = actxserver('PowerPoint.Application'); % Show the PowerPoint window ppt.Visible = 1; % Bring up the PowerPoint session help window - this contains the API, the % complete function list. At first it's a little intimidating, but after % acclimating it's not hard to find the methods you're looking for. Also, % the function signatures are given in VBA syntax, so they takes a little % deciphering. ppt.Help; % ADD PRESENTATION % View the methods that can be invoked ppt.Presentation.invoke; % Add a presentation via "Add" method Presentation = ppt.Presentation.Add; % ADD SLIDES % View the methods that can be invoked Presentation.Slides.invoke; % Add a slide via "Add" method blankSlide = Presentation.SlideMaster.CustomLayouts.Item(1); Slide1 = Presentation.Slides.AddSlide(1,blankSlide); SlideImage1 = Slide1.Shapes.AddPicture(ImageDirectory1,'msoFalse','msoTrue',0,0,300,300); SlideTitle1 = Slide1.Shapes.AddTextbox('msoTextOrientationHorizontal',0,0,400,70); SlideTitle1.TextFrame.TextRange.Text = Title1; SlideTitle1.TextFrame.TextRange.ParagraghFormat.Alignment = ppAlignCenter; Slide2 = Presentation.Slides.AddSlide(2,blankSlide); SlideImage2 = Slide2.Shapes.AddPicture(ImageDirectory2,'msoFalse','msoTrue',0,0,400,400); SlideTitle2 = Slide2.Shapes.AddTextbox('msoTextOrientationHorizontal',0,0,400,70); SlideTitle2.TextFrame.TextRange.Text = Title2; Slide3 = Presentation.Slides.AddSlide(3,blankSlide); Slide4 = Presentation.Slides.AddSlide(4,blankSlide); Slide5 = Presentation.Slides.AddSlide(5,blankSlide); Slide6 = Presentation.Slides.AddSlide(6,blankSlide); Slide7 = Presentation.Slides.AddSlide(7,blankSlide); Slide8 = Presentation.Slides.AddSlide(8,blankSlide); Slide9 = Presentation.Slides.AddSlide(9,blankSlide); Slide10 = Presentation.Slides.AddSlide(10,blankSlide);
PPTDirectory = strcat(Directory,'/',PowerPointPresentationTitle,'.ppt'); Presentation.SaveAs(PPTDirectory);
Any help would be greatly appreciated!

回答 (0 件)

カテゴリ

Help Center および File ExchangeActiveX についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by