Matlab program for Word images to ppt

3 visualizzazioni (ultimi 30 giorni)
b
b il 15 Nov 2023
Risposto: Dinesh il 15 Nov 2023
Hello, I am trying to write a MATLAB code to do the following: I have a Microsoft Word document with 100 pages of exactly this format: On each page, there is a Title (Heading 1), followed by Paragraph (Text), followed by a picture. I am trying to create a PPT using a MATLAB code (using import mlreportgen.ppt.* and Slide=add(ppt,'**')) which has one slide per page of the Word. Although I am able to put the title and the text on the slide, there are 3 major issues happening:
1). How to extract the picture (image) information from Word using MATLAB? For text, I am using the following in MATLAB code: txt = wdoc.Content.Text;
2). How to put all 3 in the MATLAB code - heading, text and picture on the slide? Currently, I am able to open only either a 'Title and Text' ppt file, or 'Title and Picture' ppt file, but not all 3 - title, text and picture.
3). How to open the ppt file through MATLAB code such that the size of each slide is same as the layout page-size of the Word document? Currently, the Word document is set at A5, but when I open the ppt for writing, it is the default Widescreen format.
Thanks.

Risposte (1)

Dinesh
Dinesh il 15 Nov 2023
Hello.
1) MATLAB does not currently provide direct functionality to extract images from a Word document. However, it can programmatically take in images that are saved in your local folder using the "imread" function.
In your case, if you save the Word file as a web page (HTML), it creates a folder with all the images inside it. Now, you can programmatically read all the images into MATLAB.
2) Since the built-in layouts for MATLAB's PPT API are limited, I would suggest that you follow an approach where you use the in-built layout "Title and Content" to insert the title and content of the page after which you can programmatically add the images read from folder onto the presentation.
3) MATLAB’s PPT API does not provide direct functionality to set custom slide sizes. The PPT API generally creates slides in the default PowerPoint size. However, you can try to adjust the content to fit into a standard slide size or manually change the slide size in PowerPoint after the presentation is created.
The following links might help you:

Community Treasure Hunt

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

Start Hunting!

Translated by