在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):stefslon/exportToPPTX开源软件地址(OpenSource Url):https://github.com/stefslon/exportToPPTX开源编程语言(OpenSource Language):MATLAB 100.0%开源软件介绍(OpenSource Introduction):OverviewexportToPPTX allows user to create PowerPoint 2007+ (PPTX) files without using COM-objects automation (or PowerPoint application itself). Proper XML files are created and packaged into PPTX file that can be read and displayed by PowerPoint. UsageBasic command syntax: pptx = exportToPPTX();
pptx.<command>(...) List of Available CommandsexportToPPTXpptx = exportToPPTX([fileName],...); Creates new PowerPoint presentation if first parameter is empty or opens existing presentation. Actual PowerPoint files are not written until Additional parameters, applicable if creating new presentation:
savefileOutPath = pptx.save([filename]) Saves current presentation. If new PowerPoint was created, then filename to save to is required. If PowerPoint was openned, then by default it will write changes back to the same file. If another filename is provided, then changes will be written to the new file (effectively a 'Save As' operation). Returns full name of the presentation file written. addSlideslideId = pptx.addSlide(); Adds a slide to the presentation. No additional inputs required. Returns newly created slide ID (sequential slide number signifying total slides in the deck, not neccessarily slide order). Additional parameters
switchSlideslideId = pptx.switchSlide(slideId); Switches current slide to be operated on. Requires slide ID as the second input parameter. addPicturepptx.addPicture([figureHandle|axesHandle|imageFilename|CDATA],...) Adds picture to the current slide. Requires figure or axes handle or image filename or CDATA to be supplied. Images supplied as handles or CDATA matricies are saved in PNG format. This command does not return any values. Additional parameters
addShapepptx.addShape(xData,yData,...) Add lines or closed shapes to the current slide. Requires X and Y data to be supplied. This command does not return any values. Additional parameters
addNotepptx.addNote(noteText,...) Adds notes information to the current slide. Requires text of the notes to be added. This command does not return any values. Note: repeat calls overwrite previous information. Additional parameters
addTextboxpptx.addTextbox(textboxText,...) Adds textbox to the current slide. Requires text of the box to be added. This command does not return any values. Additional parameters
addTablepptx.addTable(tableData,...) Adds PowerPoint table to the current slide. Requires table content to be supplied in the form of a cell matrix. This command does not return any values. All of the MarkdownAny textual inputs (addtext, addnote) support basic markdown formatting:
Notes about TemplatesIn order to use PowerPoint templates with exportToPPTX a basic knowledge of the structure of the template is required. You will need to know master layout name (especially if there are more than one master layout), slide layout names, and placeholder names on each layout slide. There are multiple ways of getting this information. The easiest way of getting template structure information is to open the presentation in PowerPoint and to look under Layout drop-down menu on the Home tab. Master name will be given at the top of the list. Layout names will be listed under each slide thumbnail. Placeholder names are not easy (if not impossible) to get to from PowerPoint itself. But typically they are named with obvious names such as Title, Content Placeholder, Text Placeholder, etc. Alternative way of getting template structure information is to open presentation template with exportToPPTX and run >> pptx = exportToPPTX('Parallax.pptx');
>> pptx
pptx =
File: D:\Stefan\MATLAB\exportToPPTX\Parallax.pptx
Total slides: 0
Current slide: 0
Author: Stefan Slonevskiy
Title: PowerPoint Presentation
Subject:
Description:
Dimensions: 13.33 x 7.50 in
Master #1: Parallax
Layout #1: Content with Caption (Title 1, Content Placeholder 2, Text Placeholder 3, Date Placeholder 4, Footer Placeholder 5, Slide Number Placeholder 6)
Layout #2: Name Card (Title 1, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #3: Section Header (Title 1, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #4: Blank (Date Placeholder 1, Footer Placeholder 2, Slide Number Placeholder 3)
Layout #5: Quote with Caption (TextBox 13, TextBox 14, Title 1, Text Placeholder 9, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #6: Vertical Title and Text (Vertical Title 1, Vertical Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #7: Title and Content (Title 1, Content Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #8: Title and Vertical Text (Title 1, Vertical Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #9: Title Slide (Freeform 6, Freeform 7, Freeform 9, Freeform 10, Freeform 11, Freeform 12, Title 1, Subtitle 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #10: Title Only (Title 1, Date Placeholder 2, Footer Placeholder 3, Slide Number Placeholder 4)
Layout #11: Title and Caption (Title 1, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #12: Comparison (Title 1, Text Placeholder 2, Content Placeholder 3, Text Placeholder 4, Content Placeholder 5, Date Placeholder 6, Footer Placeholder 7, Slide Number Placeholder 8)
Layout #13: True or False (Title 1, Text Placeholder 9, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5)
Layout #14: Panoramic Picture with Caption (Title 1, Picture Placeholder 2, Text Placeholder 3, Date Placeholder 4, Footer Placeholder 5, Slide Number Placeholder 6)
Layout #15: Two Content (Title 1, Content Placeholder 2, Content Placeholder 3, Date Placeholder 4, Footer Placeholder 5, Slide Number Placeholder 6)
Layout #16: Picture with Caption (Title 1, Picture Placeholder 2, Text Placeholder 3, Date Placeholder 4, Footer Placeholder 5, Slide Number Placeholder 6)
Layout #17: Quote Name Card (TextBox 13, TextBox 14, Title 1, Text Placeholder 9, Text Placeholder 2, Date Placeholder 3, Footer Placeholder 4, Slide Number Placeholder 5) Once you have all this structure information available it's easy to use templates with exportToPPTX. When creating new slide specify which slide layout you want to use. When adding text, images, or tables to the slide, instead of giving exact position and dimensions of the element, simply pass in the placeholder name. ExamplesBasic ExampleHere is a simple example that does not use templates % Start new presentation
pptx = exportToPPTX();
% Set presentation title
pptx.title = 'Basic example'
% Just an example image
load mandrill; figure('color','w'); image(X); colormap(map); axis off; axis image;
% Add slide, then add image to it, then add box
pptx.addSlide();
pptx.addPicture(gcf,'Scale','maxfixed');
pptx.addTextbox('Mandrill','Position',[0 5 6 1],'FontWeight','bold','HorizontalAlignment','center','VerticalAlignment','bottom');
% Save
pptx.save('example.pptx'); A more elaborate example is included in the Template ExampleHere is another simple example that uses templates % Open presentation template
pptx = exportToPPTX('Parallax.pptx');
% Add new slide with layout #9 (Title Slide)
pptx.addSlide('Master',1,'Layout','Title Slide');
% Add title text and subtitle text
pptx.addTextbox('Example Presentation','Position','Title');
pptx.addTextbox('Created with exportToPPTX','Position','Subtitle');
% Save as another presentation and close
pptx.save('example2'); A more elaborate template example is included in the
Switching from previous (non-class) versionChanging over to class-based implementation is a major change and breaks all previous usage of the code. However updating to a new implementation should not be too bad. See the following table of the old to new commands mapping.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论