{"id":1126,"date":"2011-12-20T14:53:22","date_gmt":"2011-12-20T05:53:22","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=1126"},"modified":"2011-12-20T14:53:22","modified_gmt":"2011-12-20T05:53:22","slug":"excel-services-ecmascriptjprintarea%e3%81%a7%e5%9f%8b%e3%82%81%e8%be%bc%e3%82%93%e3%81%a0%e3%83%96%e3%83%83%e3%82%af%e9%83%a8%e5%88%86%e3%81%ae%e3%81%bf%e3%82%92%e5%8d%b0%e5%88%b7%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=1126","title":{"rendered":"[Excel Services ECMAScript]jPrintArea\u3067\u57cb\u3081\u8fbc\u3093\u3060\u30d6\u30c3\u30af\u90e8\u5206\u306e\u307f\u3092\u5370\u5237\u3059\u308b\u3002"},"content":{"rendered":"<p>jQuery + jPrintArea\u3092\u5229\u7528\u3057\u3066\u3001\u57cb\u3081\u8fbc\u3093\u3060Excel\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u90e8\u5206\u306e\u307f\u3092\u5370\u5237\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\n\u4e0b\u8a18\u30b3\u30fc\u30c9\u3067\u306f<a href=\"http:\/\/code.google.com\/intl\/ja\/apis\/libraries\/devguide.html#jquery\" title=\"Google Libraries API\" target=\"_blank\">Google Libraries API<\/a>\u3092\u5229\u7528\u3057\u3066jQuery\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u304c\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u30921.4\u306b\u3057\u3066\u3044\u308b\u7406\u7531\u306f\u7279\u306b\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u30ed\u30fc\u30ab\u30eb\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u30c6\u30b9\u30c8\u3057\u305f\u969b\u306b\u306f\u554f\u984c\u306a\u304f\u5370\u5237\u3067\u304d\u305f\u306e\u3067\u3059\u304c\u3001\u5f53\u30d6\u30ed\u30b0\u4e0a(WordPress\u4e0a)\u304b\u3089\u5370\u5237\u3057\u305f\u969b\u306f\u306a\u305c\u304b\u30ad\u30ec\u30a4\u306b\u51fa\u529b\u3055\u308c\u307e\u305b\u3093\u3002\u539f\u56e0\u306f\u672a\u8abf\u67fb\u3067\u3001\u4f55\u304b\u5206\u304b\u308a\u6b21\u7b2c\u5bfe\u5fdc\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/span><br \/>\n<!--more--><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">&lt;script type=&quot;text\/javascript&quot; src=&quot;http:\/\/www.google.com\/jsapi&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;google.load(&quot;jquery&quot;,&quot;1.4&quot;);&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot; src=&quot;http:\/\/r.office.microsoft.com\/r\/rlidExcelWLJS?v=1&amp;kip=1&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n    \/* \r\n     * jPrintArea(http:\/\/www.designerkamal.com\/jPrintArea\/)\u306bjs\u30d5\u30a1\u30a4\u30eb\u304c\u7121\u304b\u3063\u305f\u306e\u3067\r\n     * Internet Archive(http:\/\/j.mp\/rTnPBB)\u304b\u3089\u30b3\u30fc\u30c9\u53d6\u5f97\r\n     *\/\r\n    jQuery.jPrintArea = function(el) {\r\n        var iframe = document.createElement('IFRAME');\r\n        var doc = null;\r\n        $(iframe).attr('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');\r\n        document.body.appendChild(iframe);\r\n        doc = iframe.contentWindow.document;\r\n        var links = window.document.getElementsByTagName('link');\r\n        for (var i = 0; i &lt; links.length; i++) {\r\n            if (links&#x5B;i].rel.toLowerCase() == 'stylesheet') {\r\n                doc.write('&lt;link type=&quot;text\/css&quot; rel=&quot;stylesheet&quot; href=&quot;' + links&#x5B;i].href + '&quot;&gt;&lt;\/link&gt;');\r\n            }\r\n            doc.write('&lt;div class=&quot;' + $(el).attr(&quot;class&quot;) + '&quot;&gt;' + $(el).html() + '&lt;\/div&gt;');\r\n            doc.close();\r\n            iframe.contentWindow.focus();\r\n            iframe.contentWindow.print();\r\n            \/\/alert('Printing...'); thanks alex\r\n            alert('\u5370\u5237\u3057\u3066\u3044\u307e\u3059\u3002');\r\n            wait(1);\r\n            document.body.removeChild(iframe);;\r\n        }\r\n    }\r\n    \r\n    $(document).ready(function() {\r\n        $('#btnPrint').click(function(){$.jPrintArea('#myExcelDiv')});\r\n    });\r\n    var fileToken = &quot;SD92A165759188B352!260\/-7880906317294423214\/&quot;;\r\n\r\n    if (window.attachEvent) {\r\n        window.attachEvent(&quot;onload&quot;, loadEwaOnPageLoad);\r\n    } else {\r\n        window.addEventListener(&quot;DOMContentLoaded&quot;, loadEwaOnPageLoad, false);\r\n    }\r\n\r\n    function loadEwaOnPageLoad() {\r\n        var props = {\r\n            uiOptions: {\r\n                showGridlines: false,\r\n                showRowColumnHeaders: false\r\n            },\r\n            interactivityOptions: { }\r\n        };\r\n\r\n        Ewa.EwaControl.loadEwaAsync(fileToken, &quot;myExcelDiv&quot;, props, onEwaLoaded);\r\n    }\r\n\r\n    function onEwaLoaded(result) { }\r\n&lt;\/script&gt;\r\n\r\n&lt;input type=&quot;button&quot; id=&quot;btnPrint&quot; value=&quot;\u5370\u5237\u3059\u308b&quot;&gt;&lt;\/input&gt;\r\n&lt;div id=&quot;myExcelDiv&quot; style=&quot;width: 600px; height: 500px&quot;&gt;&lt;\/div&gt;<\/pre>\n<p><script type=\"text\/javascript\" src=\"http:\/\/www.google.com\/jsapi\"><\/script><br \/>\n<script type=\"text\/javascript\">google.load(\"jquery\",\"1.4\");<\/script><br \/>\n<script type=\"text\/javascript\" src=\"http:\/\/r.office.microsoft.com\/r\/rlidExcelWLJS?v=1&#038;kip=1\"><\/script><br \/>\n<script type=\"text\/javascript\">\n    \/* \n     * jPrintArea(http:\/\/www.designerkamal.com\/jPrintArea\/)\u306bjs\u30d5\u30a1\u30a4\u30eb\u304c\u7121\u304b\u3063\u305f\u306e\u3067\n     * Internet Archive(http:\/\/j.mp\/rTnPBB)\u304b\u3089\u30b3\u30fc\u30c9\u53d6\u5f97\n     *\/\n    jQuery.jPrintArea = function(el) {\n        var iframe = document.createElement('IFRAME');\n        var doc = null;\n        $(iframe).attr('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');\n        document.body.appendChild(iframe);\n        doc = iframe.contentWindow.document;\n        var links = window.document.getElementsByTagName('link');\n        for (var i = 0; i < links.length; i++) {\n            if (links[i].rel.toLowerCase() == 'stylesheet') {\n                doc.write('<link type=\"text\/css\" rel=\"stylesheet\" href=\"' + links[i].href + '\"><\/link>');\n            }\n            doc.write('<\/p>\n<div class=\"' + $(el).attr(\"class\") + '\">' + $(el).html() + '<\/div>\n<p>');\n            doc.close();\n            iframe.contentWindow.focus();\n            iframe.contentWindow.print();\n            \/\/alert('Printing...'); thanks alex\n            alert('\u5370\u5237\u3057\u3066\u3044\u307e\u3059\u3002');\n            wait(1);\n            document.body.removeChild(iframe);;\n        }\n    }<\/p>\n<p>    $(document).ready(function() {\n        $('#btnPrint').click(function(){$.jPrintArea('#myExcelDiv')});\n    });\n    var fileToken = \"SD92A165759188B352!260\/-7880906317294423214\/\";<\/p>\n<p>    if (window.attachEvent) {\n        window.attachEvent(\"onload\", loadEwaOnPageLoad);\n    } else {\n        window.addEventListener(\"DOMContentLoaded\", loadEwaOnPageLoad, false);\n    }<\/p>\n<p>    function loadEwaOnPageLoad() {\n        var props = {\n            uiOptions: {\n                showGridlines: false,\n                showRowColumnHeaders: false\n            },\n            interactivityOptions: { }\n        };<\/p>\n<p>        Ewa.EwaControl.loadEwaAsync(fileToken, \"myExcelDiv\", props, onEwaLoaded);\n    }<\/p>\n<p>    function onEwaLoaded(result) { }\n<\/script><\/p>\n<p><input type=\"button\" id=\"btnPrint\" value=\"\u5370\u5237\u3059\u308b\"><\/input><\/p>\n<div id=\"myExcelDiv\" style=\"width: 600px; height: 500px\"><\/div>\n<p><strong>\u30fb\u5370\u5237\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u308bjavascript\u300cjPrintArea\u300d<\/strong><br \/>\n<a href=\"http:\/\/www.skuare.net\/2007\/10\/javascriptjprintarea.html\" title=\"\u5370\u5237\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u308bjavascript\u300cjPrintArea\u300d\" target=\"_blank\">http:\/\/www.skuare.net\/2007\/10\/javascriptjprintarea.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"jQuery + jPrintArea\u3092\u5229\u7528\u3057\u3066\u3001\u57cb\u3081\u8fbc\u3093\u3060Excel\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u90e8\u5206\u306e\u307f\u3092\u5370\u5237\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u4e0b\u8a18\u30b3\u30fc\u30c9\u3067\u306fGoogle Libraries API\u3092\u5229\u7528\u3057\u3066jQuery\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u304c\u3001\u30d0 [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,41],"tags":[38,39,40,140],"class_list":["post-1126","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-services-ecmascript","tag-office-web-apps","tag-excel-web-app","tag-excelmashup","tag-excel-services-ecmascript"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-ia","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1126","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=1126"}],"version-history":[{"count":4,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1126\/revisions"}],"predecessor-version":[{"id":1130,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1126\/revisions\/1130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}