{"id":6808,"date":"2016-03-15T11:36:59","date_gmt":"2016-03-15T02:36:59","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6808"},"modified":"2016-03-15T11:36:59","modified_gmt":"2016-03-15T02:36:59","slug":"office%e3%82%a2%e3%83%89%e3%82%a4%e3%83%b3%e3%83%ad%e3%83%bc%e3%82%ab%e3%83%ab%e3%81%ae%e7%94%bb%e5%83%8f%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92word%e6%96%87%e6%9b%b8%e3%81%ab%e6%8c%bf","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6808","title":{"rendered":"[Office\u30a2\u30c9\u30a4\u30f3]\u30ed\u30fc\u30ab\u30eb\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092Word\u6587\u66f8\u306b\u633f\u5165\u3059\u308b\u3002"},"content":{"rendered":"<p>\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=6237\" title=\"OfficeJS Snippet Explorer\u3092\u4f7f\u3063\u3066\u65b0\u3057\u3044Office \u30a2\u30c9\u30a4\u30f3\u3092\u4f53\u9a13\u3059\u308b\u3002 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">OfficeJS Snippet Explorer\u3092\u4f7f\u3063\u3066\u65b0\u3057\u3044Office \u30a2\u30c9\u30a4\u30f3\u3092\u4f53\u9a13\u3059\u308b<\/a>\u300d\u3067\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u65b0\u3057\u304f\u306a\u3063\u305fJavaScript API(Word v2 JavaScript API \/ Excel v2 JavaScript API)\u3067\u306f\u30b3\u30fc\u30c9\u306e\u66f8\u304d\u65b9\u3082\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308a\u3001\u3067\u304d\u308b\u3053\u3068\u3082\u304b\u306a\u308a\u5897\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306fWordAPI\u3067\u65b0\u305f\u306b\u8ffd\u52a0\u3055\u308c\u305f<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt616492.aspx#insertinlinepicturefrombase64base64encodedimage_string_insertlocation_insertlocation\" title=\"Range \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (JavaScript API for Word)\" target=\"_blank\">Range\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306einsertInlinePictureFromBase64\u30e1\u30bd\u30c3\u30c9<\/a>\u3092\u4f7f\u3063\u3066\u3001\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u305f\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092Word\u6587\u66f8\u306b\u633f\u5165\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;meta charset=&quot;UTF-8&quot; \/&gt;\r\n  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=Edge&quot; \/&gt;\r\n  &lt;title&gt;Sample&lt;\/title&gt;\r\n  &lt;script src=&quot;https:\/\/ajax.aspnetcdn.com\/ajax\/jQuery\/jquery-2.2.1.min.js&quot;&gt;&lt;\/script&gt;\r\n  &lt;script src=&quot;https:\/\/appsforoffice.microsoft.com\/lib\/1\/hosted\/office.js&quot;&gt;&lt;\/script&gt;\r\n  &lt;script&gt;\r\n    Office.initialize = function(reason){\r\n      $(document).ready(function(){\r\n        if(Office.context.requirements.isSetSupported(&quot;WordApi&quot;, 1.2)){\r\n          $(&quot;#iptImg&quot;).change(insertPicture);\r\n        }else{\r\n          console.log(&quot;This code requires Word 2016 or greater.&quot;);\r\n        }\r\n      });\r\n    };\r\n    \r\n    function insertPicture(){\r\n      if(!this.files.length){return;}\r\n      var file = this.files&#x5B;0];\r\n      var fr = new FileReader();\r\n      fr.onload = function(event){\r\n        var base64 = event.target.result.split(&quot;,&quot;)&#x5B;1];\r\n        Word.run(function(ctx){\r\n          var rng = ctx.document.getSelection();\r\n          rng.insertInlinePictureFromBase64(base64, &quot;Start&quot;);\r\n          return ctx.sync().then(function(){\r\n            console.log(&quot;done.&quot;);\r\n          });\r\n        }).catch(function(error){\r\n          console.log(&quot;Error: &quot; + error);\r\n          if(error instanceof OfficeExtension.Error){\r\n            console.log(&quot;Debug info: &quot; + JSON.stringify(error.debugInfo));\r\n          }\r\n        });\r\n      }\r\n      fr.readAsDataURL(file);\r\n    }\r\n  &lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n  &lt;p&gt;&lt;input id=&quot;btnTest&quot; type=&quot;button&quot; value=&quot;Test&quot;&gt;&lt;\/p&gt;\r\n  &lt;p&gt;&lt;input id=&quot;iptImg&quot; type=&quot;file&quot;&gt;&lt;\/p&gt;\r\n  &lt;p&gt;&lt;textarea id=&quot;result&quot;&gt;&lt;\/textarea&gt;&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306binput type=&#8221;file&#8221;(iptImg)\u3067\u9078\u629e\u3057\u305f\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304cWord\u6587\u66f8\u306e\u9078\u629e\u4f4d\u7f6e\u306b\u633f\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/insertInlinePictureFromBase64_01.gif\" alt=\"insertInlinePictureFromBase64_01\" width=\"531\" height=\"492\" class=\"alignnone size-full wp-image-6809\" \/><\/p>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001File API\u3067\u30ed\u30fc\u30ab\u30eb\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092base64\u6587\u5b57\u5217\u3068\u3057\u3066\u53d6\u5f97\u3001\u53d6\u5f97\u3057\u305f\u6587\u5b57\u5217\u3092insertInlinePictureFromBase64\u30e1\u30bd\u30c3\u30c9\u306b\u6e21\u3057\u3066\u6587\u66f8\u306b\u633f\u5165\u3059\u308b\u3068\u3044\u3046\u3001\u975e\u5e38\u306b\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>VBA\u3067\u540c\u3058\u3053\u3068\u3092\u3084\u308d\u3046\u3068\u601d\u3063\u305f\u3089\u3001<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub Sample()\r\n  With Application.FileDialog(msoFileDialogFilePicker)\r\n    If .Show Then Selection.InlineShapes.AddPicture .SelectedItems(1)\r\n  End With\r\nEnd Sub<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u307b\u3093\u306e\u6570\u884c\u3067\u51fa\u6765\u3066\u3057\u307e\u3046\u4e8b\u306a\u306e\u3067\u3001\u3053\u308c\u3067\u3082\u307e\u3060\u5197\u9577\u306b\u601d\u3046\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4ee5\u524d\u306eOffice \u30a2\u30c9\u30a4\u30f3\u306b\u6bd4\u3079\u305f\u3089\u5927\u304d\u306a\u9032\u6b69\u3067\u3059\u3002<br \/>\n\u65e5\u3005\u9032\u5316\u3057\u3066\u3044\u308bOffice \u30a2\u30c9\u30a4\u30f3\u3001\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u662f\u975e\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002<\/p>\n<h4 class=\"style4a\">\u53c2\u8003Web\u30da\u30fc\u30b8<\/h4>\n<ul>\n<li>Deep Dive into Office Word Add-ins<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/github.com\/OfficeDev\/TrainingContent\/blob\/master\/O3652\/O3652-2%20Deep%20Dive%20in%20Office%20Word%20Add-ins\/Lab.md\" target=\"_blank\" title=\"Deep Dive into Office Word Add-ins\">https:\/\/github.com\/OfficeDev\/TrainingContent\/blob\/master\/O3652\/O3652-2%20Deep%20Dive%20in%20Office%20Word%20Add-ins\/Lab.md<\/a><\/li>\n<li>Deep Dive into Office Excel Add-ins<\/li>\n<li style=\"list-style-type:none;\"><a href=\"http:\/\/dev.office.com\/hands-on-labs\/1544\" target=\"_blank\" title=\"Deep Dive into Office Excel Add-ins\">http:\/\/dev.office.com\/hands-on-labs\/1544<\/a><\/li>\n<li>Word \u30a2\u30c9\u30a4\u30f3\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u6982\u8981<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt616486.aspx\" target=\"_blank\" title=\"Word \u30a2\u30c9\u30a4\u30f3\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u6982\u8981\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt616486.aspx<\/a><\/li>\n<li>Office \u306e\u30db\u30b9\u30c8\u3068 API \u306e\u8981\u4ef6\u3092\u6307\u5b9a\u3059\u308b<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/dn535871.aspx\" target=\"_blank\" title=\"Office \u306e\u30db\u30b9\u30c8\u3068 API \u306e\u8981\u4ef6\u3092\u6307\u5b9a\u3059\u308b\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/dn535871.aspx<\/a><\/li>\n<li>Office \u30a2\u30c9\u30a4\u30f3\u306e\u8981\u4ef6\u30bb\u30c3\u30c8<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt590206.aspx\" target=\"_blank\" title=\"Office \u30a2\u30c9\u30a4\u30f3\u306e\u8981\u4ef6\u30bb\u30c3\u30c8\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt590206.aspx<\/a><\/li>\n<li>Range \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (JavaScript API for Word)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt616492.aspx\" target=\"_blank\" title=\"Range \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (JavaScript API for Word)\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/mt616492.aspx<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u300cOfficeJS Snippet Explorer\u3092\u4f7f\u3063\u3066\u65b0\u3057\u3044Office \u30a2\u30c9\u30a4\u30f3\u3092\u4f53\u9a13\u3059\u308b\u300d\u3067\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u65b0\u3057\u304f\u306a\u3063\u305fJavaScript API(Word v2 JavaScript API \/ Exce [&hellip;]","protected":false},"author":1,"featured_media":7119,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[[Office\u30a2\u30c9\u30a4\u30f3]\u30ed\u30fc\u30ab\u30eb\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092Word\u6587\u66f8\u306b\u633f\u5165\u3059\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":[130,4,128],"tags":[],"class_list":["post-6808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apps-for-office","category-office","category-office2016"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-OfficeAddins.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1LO","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6808","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=6808"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6808\/revisions"}],"predecessor-version":[{"id":6811,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6808\/revisions\/6811"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7119"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}