{"id":10163,"date":"2018-03-22T12:15:48","date_gmt":"2018-03-22T03:15:48","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=10163"},"modified":"2018-03-22T14:50:52","modified_gmt":"2018-03-22T05:50:52","slug":"phppresentation%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6php%e3%81%8b%e3%82%89powerpoint%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e5%87%ba%e5%8a%9b%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=10163","title":{"rendered":"PHPPresentation\u3092\u4f7f\u3063\u3066PHP\u304b\u3089PowerPoint\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u307f\u308b\u3002"},"content":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306b<a href=\"https:\/\/github.com\/PHPOffice\" title=\"PHPOffice\" target=\"_blank\">PHPOffice<\/a>\u3092\u8997\u3044\u3066\u307f\u305f\u3089\u300c<a href=\"https:\/\/github.com\/PHPOffice\/PHPPresentation\" title=\"PHPPresentation\" target=\"_blank\">PHPPresentation<\/a>\u300d(<a href=\"https:\/\/mag.osdn.jp\/07\/09\/05\/017211\" title=\"GNU LGPLv3 \u65e5\u672c\u8a9e\u8a33 | OSDN Magazine\" target=\"_blank\">LGPL v3<\/a>\u30e9\u30a4\u30bb\u30f3\u30b9)\u304c\u66f4\u65b0\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u3055\u3063\u305d\u304f\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h4 class=\"style4a\">PHPPresentation\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>PHPPresentation\u3082\u3001<a href=\"https:\/\/www.ka-net.org\/blog\/?p=9210\" title=\"PhpSpreadsheet\u3092\u4f7f\u3063\u3066PHP\u304b\u3089Excel\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u307f\u308b\u3002 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">PhpSpreadsheet<\/a>\u3084<a href=\"https:\/\/www.ka-net.org\/blog\/?p=6952\" title=\"PHPWord\u3092\u4f7f\u3063\u3066PHP\u304b\u3089Word\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u307f\u308b\u3002 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">PHPWord<\/a>\u3068\u540c\u3058\u304f\u300c<a href=\"https:\/\/getcomposer.org\/\" title=\"Composer\" target=\"_blank\">composer install<\/a>\u300d\u3059\u308b\u3060\u3051\u3067\u5c0e\u5165\u3067\u304d\u307e\u3059\u3002<\/p>\n<h5 class=\"style5a\">composer.json<\/h5>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n    &quot;require&quot;: {\r\n       &quot;phpoffice\/phppresentation&quot;: &quot;dev-master&quot;\r\n    }\r\n}<\/pre>\n<h4 class=\"style4a\">PHPPresentation\u306e\u547c\u3073\u51fa\u3057<\/h4>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u3055\u3063\u305d\u304fPHPPresentation\u3092\u4f7f\u3063\u3066PowerPoint\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;?php\r\n    require_once '.\/vendor\/autoload.php';\r\n    \r\n    use PhpOffice\\PhpPresentation\\PhpPresentation;\r\n    use PhpOffice\\PhpPresentation\\IOFactory;\r\n    use PhpOffice\\PhpPresentation\\Style\\Color;\r\n    use PhpOffice\\PhpPresentation\\Style\\Alignment;\r\n    \r\n    \/\/\u65b0\u898f\u30d7\u30ec\u30bc\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u4f5c\u6210\r\n    $phpPres = new PhpPresentation();\r\n    \r\n    \/\/\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u8a2d\u5b9a\r\n    $phpPres-&gt;getDocumentProperties()\r\n        -&gt;setCreator('@kinuasa')\r\n        -&gt;setCompany('\u521d\u5fc3\u8005\u5099\u5fd8\u9332')\r\n        -&gt;setTitle('PHPPresentation Sample')\r\n        -&gt;setDescription('PHPPresentation\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002');\r\n    \r\n    \/\/\u56f3\u5f62(\u30c6\u30ad\u30b9\u30c8)\u8ffd\u52a0\r\n    $slide = $phpPres-&gt;getActiveSlide();\r\n    $shape = $slide-&gt;createRichTextShape()\r\n        -&gt;setHeight(300)\r\n        -&gt;setWidth(600)\r\n        -&gt;setOffsetX(170)\r\n        -&gt;setOffsetY(180);\r\n    $shape-&gt;getActiveParagraph()\r\n        -&gt;getAlignment()\r\n        -&gt;setHorizontal(Alignment::HORIZONTAL_CENTER);\r\n    $textRun = $shape-&gt;createTextRun('\u3053\u3093\u306b\u3061\u306f\u3001\u4e16\u754c\uff01');\r\n    $textRun-&gt;getFont()\r\n        -&gt;setName('\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af')\r\n        -&gt;setBold(true)\r\n        -&gt;setSize(48)\r\n        -&gt;setColor(new Color('8e44ad'));\r\n    \r\n    \/\/\u30d5\u30a1\u30a4\u30eb\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\r\n    \/\/MIME\u30bf\u30a4\u30d7\uff1ahttps:\/\/technet.microsoft.com\/ja-jp\/ee309278.aspx\r\n    header('Content-Description: File Transfer');\r\n    header('Content-Disposition: attachment; filename*=utf-8\\'\\'' . rawurlencode('\u30b5\u30f3\u30d7\u30eb.pptx'));\r\n    header('Content-Type: application\/vnd.openxmlformats-officedocument.presentationml.presentation');\r\n    header('Content-Transfer-Encoding: binary');\r\n    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\r\n    header('Expires: 0');\r\n    $xmlWriter = IOFactory::createWriter($phpPres, 'PowerPoint2007');\r\n    ob_end_clean(); \/\/\u30d0\u30c3\u30d5\u30a1\u6d88\u53bb\r\n    $xmlWriter-&gt;save('php:\/\/output');<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPPresentation_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPPresentation_01.jpg\" alt=\"\" width=\"828\" height=\"484\" class=\"alignnone size-full wp-image-10164\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPPresentation_01.jpg 828w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPPresentation_01-300x175.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPPresentation_01-768x449.jpg 768w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/a><\/p>\n<p>\u65e5\u672c\u8a9e\u8868\u793a\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u305f\u3060\u3001<a href=\"http:\/\/phppresentation.readthedocs.io\/en\/latest\/readers.html\" title=\"Readers - PhpPresentation 0.12.0 documentation\" target=\"_blank\">\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u306b\u3088\u308c\u3070\u4e0b\u8a18\u30b3\u30fc\u30c9\u3067\u65e2\u5b58\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u3081\u308b\u306f\u305a\u306a\u306e\u3067\u3059\u304c\u3001\u79c1\u304c\u8a66\u3057\u305f\u9650\u308a\u3067\u306f\u3001\u65e2\u5b58\u30d5\u30a1\u30a4\u30eb\u3092\u5143\u306b\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u7834\u640d\u3057\u3066\u4e0a\u624b\u304f\u3044\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">$oReader = IOFactory::createReader('PowerPoint2007');\r\n$oReader-&gt;load(__DIR__ . '\/sample.pptx');<\/pre>\n<p>\u3053\u306e\u3042\u305f\u308a\u306f\u307e\u3060\u767a\u5c55\u9014\u4e0a\u3068\u3044\u3063\u305f\u611f\u3058\u304c\u3057\u307e\u3059\u304c\u3001\u4f7f\u3044\u52dd\u624b\u306f\u826f\u304f\u3001\u76f4\u611f\u7684\u306b\u6271\u3048\u308b\u306e\u3067\u3001PHP\u3067PowerPoint\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3059\u308b\u969b\u306b\u306f\u5f79\u7acb\u3064\u30e9\u30a4\u30d6\u30e9\u30ea\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"\u4e45\u3057\u3076\u308a\u306bPHPOffice\u3092\u8997\u3044\u3066\u307f\u305f\u3089\u300cPHPPresentation\u300d(LGPL v3\u30e9\u30a4\u30bb\u30f3\u30b9)\u304c\u66f4\u65b0\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u3055\u3063\u305d\u304f\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 PHPPresentation\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb PHPPre [&hellip;]","protected":false},"author":1,"featured_media":9211,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[PHPPresentation\u3092\u4f7f\u3063\u3066PHP\u304b\u3089PowerPoint\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u307f\u308b]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,58,157],"tags":[],"class_list":["post-10163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-powerpoint","category-php"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-PHP.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2DV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10163"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10163\/revisions"}],"predecessor-version":[{"id":10165,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10163\/revisions\/10165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/9211"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}