{"id":4862,"date":"2013-10-11T09:00:30","date_gmt":"2013-10-11T13:00:30","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=4862"},"modified":"2017-03-27T20:37:14","modified_gmt":"2017-03-28T00:37:14","slug":"export-to-powerpoint-2","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2013\/10\/11\/export-to-powerpoint-2\/","title":{"rendered":"Export to PowerPoint\u00ae"},"content":{"rendered":"\r\n<div class=\"content\"><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\">Jiro<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/40277-exporttopptx\"><tt>exportToPPTX<\/tt><\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/320028\">Stefan Slonevskiy<\/a>.<\/p><p>Did you know that you could automatically <a href=\"\">generate reports<\/a> from your MATLAB program? You can publish a report in various formats -- HTML, PDF, LaTeX, XML, Microsoft&reg; Word&reg; (only on Windows&reg;), and Microsoft PowerPoint (only on Windows). For PowerPoint output, each section of the program is put into a separate slide, and you can apply formatting afterwards in PowerPoint.<\/p><p>There are a number of File Exchange entries that allow you to programmatically create PowerPoint slides with formatting capabilities, including <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/340-saveppt\"><tt>saveppt<\/tt><\/a> (<a href=\"https:\/\/blogs.mathworks.com\/pick\/2004\/10\/20\/export-to-powerpoint\/\">Pick of the Week post<\/a>), <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/20949-subplotppt\"><tt>subplotPPT<\/tt><\/a>, and <tt>officedoc<\/tt>. These entries all use the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Component_Object_Model\">COM<\/a> interface to create the PowerPoint document and, therefore, require a Windows platform and PowerPoint. Stefan's <tt>exportToPPTX<\/tt> creates the document completely \"natively\" by creating the necessary XML files and packing them into a PPTX file. That means that this works in any platform that runs MATLAB, and you don't need to have PowerPoint installed. Since this is XML writing, it's much faster than the other COM interface counterparts.<\/p><p>Stefan includes a detailed example that showcases the various formatting options included with the function. As you can see from the animation of the slides below, here are some of the formatting options:<\/p><div><ul><li>Setting the size of the slides<\/li><li>Adding pictures (from figures, axes, image files, CDATA)<\/li><li>Setting the position and scale of pictures<\/li><li>Adding text and specifying positions, angles, and font properties<\/li><li>Adding notes to the slides<\/li><li>Specifying slide background color.<\/li><\/ul><\/div><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_exporttopptx\/export_to_pptx_animation.gif\" alt=\"\"> <\/p><p><b>Comments<\/b><\/p><p>Do you create presentation slides from your MATLAB results? How do you currently do that? If you haven't used <tt>exportToPPTX<\/tt>, give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=4862#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/40277-exporttopptx#comments\">comment<\/a> for Stefan.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_7eb8b57b176f4fc2b9fc6897f656a843() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='7eb8b57b176f4fc2b9fc6897f656a843 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 7eb8b57b176f4fc2b9fc6897f656a843';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2013 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_7eb8b57b176f4fc2b9fc6897f656a843()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2013b<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2013b<br><\/p><\/div><!--\r\n7eb8b57b176f4fc2b9fc6897f656a843 ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\r\n% Jiro>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/40277-exporttopptx\r\n% |exportToPPTX|> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/320028\r\n% Stefan Slonevskiy>.\r\n%\r\n% Did you know that you could automatically\r\n% <\r\n% generate reports> from your MATLAB program? You can publish a report in\r\n% various formats REPLACE_WITH_DASH_DASH HTML, PDF, LaTeX, XML, Microsoft\u00c2\u00ae Word\u00c2\u00ae (only on\r\n% Windows\u00c2\u00ae), and Microsoft PowerPoint (only on Windows). For PowerPoint\r\n% output, each section of the program is put into a separate slide, and you\r\n% can apply formatting afterwards in PowerPoint.\r\n%\r\n% There are a number of File Exchange entries that allow you to\r\n% programmatically create PowerPoint slides with formatting capabilities,\r\n% including <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/340-saveppt\r\n% |saveppt|>\r\n% (<https:\/\/blogs.mathworks.com\/pick\/2004\/10\/20\/export-to-powerpoint\/ Pick\r\n% of the Week post>),\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/20949-subplotppt |subplotPPT|>,\r\n% and <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/151-ball---beam-demo92\r\n% |officedoc|>. These entries all use the\r\n% <http:\/\/en.wikipedia.org\/wiki\/Component_Object_Model COM> interface to\r\n% create the PowerPoint document and, therefore, require a Windows platform\r\n% and PowerPoint. Stefan's |exportToPPTX| creates the document completely\r\n% \"natively\" by creating the necessary XML files and packing them into a\r\n% PPTX file. That means that this works in any platform that runs MATLAB,\r\n% and you don't need to have PowerPoint installed. Since this is XML\r\n% writing, it's much faster than the other COM interface counterparts.\r\n%\r\n% Stefan includes a detailed example that showcases the various formatting\r\n% options included with the function. As you can see from the animation of\r\n% the slides below, here are some of the formatting options:\r\n%\r\n% * Setting the size of the slides\r\n% * Adding pictures (from figures, axes, image files, CDATA)\r\n% * Setting the position and scale of pictures\r\n% * Adding text and specifying positions, angles, and font properties\r\n% * Adding notes to the slides\r\n% * Specifying slide background color.\r\n%\r\n% <<export_to_pptx_animation.gif>>\r\n%\r\n% *Comments*\r\n%\r\n% Do you create presentation slides from your MATLAB results? How do you\r\n% currently do that? If you haven't used |exportToPPTX|, give it a try and\r\n% let us know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=4862#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/40277-exporttopptx#comments\r\n% comment> for Stefan.\r\n\r\n##### SOURCE END ##### 7eb8b57b176f4fc2b9fc6897f656a843\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_exporttopptx\/export_to_pptx_animation.gif\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nJiro's pick this week is exportToPPTX by Stefan Slonevskiy.Did you know that you could automatically generate reports from your MATLAB program? You can publish a report in various formats -- HTML,... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2013\/10\/11\/export-to-powerpoint-2\/\">read more >><\/a><\/p>","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4862"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=4862"}],"version-history":[{"count":7,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4862\/revisions"}],"predecessor-version":[{"id":8493,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4862\/revisions\/8493"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=4862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=4862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=4862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}