Save PPT slide temporarily
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am creating PPT file using programming. I want to create screenshot (for preview purpose) of PPT slide, which can be temporary.
Or if it is possible to save particular slide as PPT for temporary use and I can make a preview of that and can be deleted afterwards.
0 comentarios
Respuestas (1)
Abhinav Gupta
el 17 de Ag. de 2021
The Slide Class in mlreportgen.ppt is a handle class which means we can't use Slide class to create objects. We can use Slide object methods to add, find and replace the slide Content.Every Slide object created is associated with a PPT. So to isolate the Slide object from a PPT would not be possible. However there can be workaround to this situation:
1) You can create a temporary PPT in your script and add a same layout slide to it, using replace function you can set the individual properties of the slide to the properties of the slide you want to copy and then preview that temporary PPT.
% Here myPresentation is the main presentation and Temp is the temporary
% Presentation
import mlreportgen.ppt.*
ppt = Presentation('myPresentation.pptx');
ppt2 = Presentation('Temp.pptx');
titleSlide = add(ppt,'Title Slide');
replace(titleSlide,'Title','Create Histogram Plots');
subtitleText = Paragraph('The ');
funcName = Text('histogram');
funcName.Font = 'Courier New';
append(subtitleText,funcName);
append(subtitleText,' Function');
replace(titleSlide,'Subtitle',subtitleText);
%For the first slide in myPresentation
x = randn(10000,1);
h = histogram(x);
saveas(gcf,'myPlot_img.png');
plot1 = Picture('myPlot_img.png');
pictureSlide = add(ppt,'Title and Picture');
replace(pictureSlide,'Title','Histogram of Vector');
replace(pictureSlide,'Picture',plot1);
%For the slide with Text in myPresentation
textSlide = add(ppt,'Title and Content');
titleText = Paragraph('What You Can Do with ');
func = Text('histogram');
func.Font = 'Courier New';
append(titleText,func);
replace(textSlide,'Title',titleText);
replace(textSlide,'Content',{'Create histogram plot of x',...
'Specify:',{'Number of bins','Edges of the bins'},...
'Plot into a specified axes'});
%adding a slide to Temporary Presentation
textSlide2 = add(ppt2,'Title and Content');
replace(textSlide2,'Title',titleText);
replace(textSlide2,'Content',{'Create histogram plot of x',...
'Specify:',{'Number of bins','Edges of the bins'},...
'Plot into a specified axes'});
close(ppt);
close(ppt2);
rptview(ppt);
rptview(ppt2);
2) You can also use third party tools like PowerPoint Slide Extractor,it can be used for extracting slides from a PPT file.However MathWorks does not provide support for third party tools.
0 comentarios
Ver también
Categorías
Más información sobre Create and Format Presentation Objects 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!