{"id":67677,"date":"2016-10-21T10:02:47","date_gmt":"2016-10-21T02:02:47","guid":{"rendered":"http:\/\/www.xiaoyebailong.com\/?p=67677"},"modified":"2016-10-21T10:02:47","modified_gmt":"2016-10-21T02:02:47","slug":"html%e9%a1%b5%e9%9d%a2%e8%a1%a8%e6%a0%bc%e5%af%bc%e5%87%baexcel%e5%87%ba%e7%8e%b0%e7%a7%91%e5%ad%a6%e8%ae%a1%e6%95%b0%e6%b3%95%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2016\/10\/21\/67677.htm","title":{"rendered":"html\u9875\u9762\u8868\u683c\u5bfc\u51faexcel\u51fa\u73b0\u79d1\u5b66\u8ba1\u6570\u6cd5\u95ee\u9898\u7684\u89e3\u51b3"},"content":{"rendered":"<p>\u7528IE\u7684\u7528\u6237\uff0c\u5982\u679c\u4e00\u4e2ahtml\u9875\u9762\u6709table\u7684\u8bdd\uff0c\u53ef\u4ee5\u628atable\u5bfc\u51fa\u5230excle\u6587\u4ef6\u91cc\u9762\uff0c\u4f46\u662f\u7ecf\u5e38\u9047\u5230\u4f1a\u628a\u8eab\u4efd\u8bc1\u7b49\u6570\u5b57\u6bd4\u8f83\u957f\u7684\u6570\u636e\u6539\u6210\u79d1\u5b66\u8ba1\u6570\u6cd5\u6765\u663e\u793a\u3002\u5f88\u662f\u5934\u75bc\u3002<br \/>\n\u6709\u8bf4\u52a0\u4e2a\u5355\u5f15\u53f7\u53ef\u4ee5\u89e3\u51b3\uff0c\u4f46\u662f\u6211\u8fd9\u91cc\u6d4b\u8bd5\uff0c\u663e\u793a\u548c\u5bfc\u51fa\u7684\u7ed3\u679c\u90fd\u6709\u5355\u5f15\u53f7\u3002\u6548\u679c\u4e0d\u597d\u3002<br \/>\n\u540c\u4e8b\u627e\u5230\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u6bd4\u8f83\u597d\u3002\u5728html\u9875\u9762\u91cc\u9762\u52a0\u4e0a\u4e00\u6bb5css<br \/>\n\u7136\u540e\u5728\u51fa\u73b0\u95ee\u9898\u7684\u5b57\u6bb5\u5e94\u7528\u8fd9\u79cdstyle\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n\u6d4b\u8bd5\u901a\u8fc7\u3002\u795e\u5947<\/p>\n<p>&lt;styletype=&#8221;text\/css&#8221;&gt;<br \/>\n&lt;!&#8211;<br \/>\ntd{<br \/>\nbackground-color:#FFFFFF;<br \/>\n}<\/p>\n<p>.txt<br \/>\n{padding-top:1px;<br \/>\npadding-right:1px;<br \/>\npadding-left:1px;<br \/>\nmso-ignore:padding;<br \/>\ncolor:black;<br \/>\nfont-size:11.0pt;<br \/>\nfont-weight:400;<br \/>\nfont-style:normal;<br \/>\ntext-decoration:none;<br \/>\nfont-family:\u5b8b\u4f53;<br \/>\nmso-generic-font-family:auto;<br \/>\nmso-font-charset:134;<br \/>\nmso-number-format:&#8221;\\@&#8221;;<br \/>\ntext-align:general;<br \/>\nvertical-align:middle;<br \/>\nmso-background-source:auto;<br \/>\nmso-pattern:auto;<br \/>\nwhite-space:nowrap;}<br \/>\n&#8211;&gt;<br \/>\n&lt;\/style&gt;<br \/>\n\u6211\u8bd5\u4e86\u53d1\u73b0\u4e0a\u9762\u7684\u4e0d\u7ba1\u7528\uff0c\u641c\u7d22\u53d1\u73b0\u7f51\u4e0a\u8fd8\u6709\u4e00\u79cd\u8bf4\u6cd5\uff1a<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>\u67e5\u4e86\u5927\u534a\u5929\u7ec8\u4e8e\u67e5\u5230\u4e86\u4e00\u70b9\u6709\u7528\u7684\u8d44\u6599\uff0c\u73b0\u5728\u6458\u6284\u5982\u4e0b\uff1a<\/p>\n<p>\u201c\u9996\u5148\uff0c\u6211\u4eec\u4e86\u89e3\u4e00\u4e0bexcel\u4eceweb\u9875\u9762\u4e0a\u5bfc\u51fa\u7684\u539f\u7406\u3002\u5f53\u6211\u4eec\u628a\u8fd9\u4e9b\u6570\u636e\u53d1\u9001\u5230\u5ba2\u6237\u7aef\u65f6\uff0c\u6211\u4eec\u60f3\u8ba9\u5ba2\u6237\u7aef\u7a0b\u5e8f\uff08\u6d4f\u89c8\u5668\uff09\u4ee5excel\u7684\u683c\u5f0f\u8bfb\u53d6\u5b83\uff0c\u6240\u4ee5\u628amime\u7c7b\u578b\u8bbe\u4e3a\uff1aapplication\/vnd.ms-excel\uff0c\u5f53excel\u8bfb\u53d6\u6587\u4ef6\u65f6\u4f1a\u4ee5\u6bcf\u4e2acell\u7684\u683c\u5f0f\u5448\u73b0\u6570\u636e\uff0c\u5982\u679ccell\u6ca1\u6709\u89c4\u5b9a\u7684\u683c\u5f0f\uff0c\u5219excel\u4f1a\u4ee5\u9ed8\u8ba4\u7684\u683c\u5f0f\u53bb\u5448\u73b0\u8be5cell\u7684\u6570\u636e\u3002\u8fd9\u6837\u5c31\u7ed9\u6211\u4eec\u63d0\u4f9b\u4e86\u81ea\u5b9a\u4e49\u6570\u636e\u683c\u5f0f\u7684\u7a7a\u95f4\uff0c\u5f53\u7136\u6211\u4eec\u5fc5\u987b\u4f7f\u7528excel\u652f\u6301\u7684\u683c\u5f0f\u3002\u4e0b\u9762\u5c31\u5217\u51fa\u5e38\u7528\u7684\u4e00\u4e9b\u683c\u5f0f\uff1a<br \/>\n1\uff09 \u6587\u672c\uff1avnd.ms-excel.numberformat:@<br \/>\n2\uff09 \u65e5\u671f\uff1avnd.ms-excel.numberformat:yyyy\/mm\/dd<br \/>\n3\uff09 \u6570\u5b57\uff1avnd.ms-excel.numberformat:#,##0.00<br \/>\n4\uff09 \u8d27\u5e01\uff1avnd.ms-excel.numberformat:\uffe5#,##0.00<br \/>\n5\uff09 \u767e\u5206\u6bd4\uff1avnd.ms-excel.numberformat: #0.00%<br \/>\n\u8fd9\u4e9b\u683c\u5f0f\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\uff0c\u6bd4\u5982\u5e74\u6708\u4f60\u53ef\u4ee5\u5b9a\u4e49\u4e3a\uff1ayy-mm\u7b49\u7b49\u3002\u90a3\u4e48\u77e5\u9053\u4e86\u8fd9\u4e9b\u683c\u5f0f\uff0c\u600e\u4e48\u53bb\u628a\u8fd9\u4e9b\u683c\u5f0f\u6dfb\u52a0\u5230cell\u4e2d\u5462\uff1f\u5f88\u7b80\u5355\uff0c\u6211\u4eec\u53ea\u9700\u8981\u628a\u6837\u5f0f\u6dfb\u52a0\u5230\u5bf9\u5e94\u7684\u6807\u7b7e\u5bf9\uff08\u5373\u95ed\u5408\u6807\u7b7e\uff09\u5373\u53ef\u3002\u5982&lt;td&gt;&lt;\/td&gt;\uff0c\u7ed9\u6807\u7b7e\u5bf9&lt;td&gt;&lt;\/td&gt;\u6dfb\u52a0\u6837\u5f0f\uff0c\u5982\u4e0b\uff1a &lt;td style=&#8221;vnd.ms-excel.numberformat:@&#8221;&gt;410522198402161833&lt;\/td&gt;<br \/>\n\u540c\u6837\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u7ed9&lt;div&gt;&lt;\/div&gt;\u6dfb\u52a0\u6837\u5f0f\uff0c\u4e5f\u53ef\u4ee5\u7ed9&lt;tr&gt;&lt;\/tr&gt;\uff0c&lt;table&gt;&lt;\/table&gt;\u6dfb\u52a0\u6837\u5f0f;\u5f53\u6211\u4eec\u5728\u7236\u6807\u7b7e\u5bf9\u548c\u5b50\u6807\u7b7e\u5bf9\u90fd\u6dfb\u52a0\u6837\u5f0f\u65f6\uff0c\u6570\u636e\u4f1a\u4ee5\u54ea\u4e00\u4e2a\u6837\u5f0f\u5448\u73b0\u5462\uff1f\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u4f1a\u4ee5\u79bb\u6570\u636e\u6700\u8fd1\u7684\u6837\u5f0f\u5448\u73b0.<\/p>\n<p>\u201d<\/p>\n<p>\u4e8e\u662f\u6309\u7167\u4ed6\u8bf4\u7684\u65b9\u6cd5\u8bbe\u7f6e\u4e86\u5bfc\u51fa\u6570\u636e\u65f6\u5bf9\u5e94\u7684\u8eab\u4efd\u8bc1\u5217\u7684&lt;td&gt;\u7684\u6837\u5f0f\uff1a<\/p>\n<p>echo &#8220;&lt;td style=&#8217;vnd.ms-excel.numberformat:@&#8217;&gt;&#8221;.$printable.&#8221;&lt;\/td&gt;\\n&#8221;;<\/p>\n<p>\u679c\u7136\u6210\u529f\u4e86\uff0c\u6ca1\u6709\u6789\u8d39\u4e86\u67e5\u534a\u5929\u7684\u8d44\u6599\u3002<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\u6211\u6d4b\u8bd5\u6b63\u786e\u7684\uff1a<\/p>\n<p>\u7ed3\u679c\u6d4b\u8bd5\u65f6\u53d1\u73b0\uff0c\u5728\u524d\u9762\u52a0\u4e2a &#8216; \u5c31\u53ef\u4ee5\u4e86\u3002\u53ea\u4e0d\u8fc7\u5728\u9875\u9762\u4e0a\u663e\u793a\u65f6\u8981\u9690\u85cf\u6389<\/p>\n<p>&lt;!DOCTYPE HTML PUBLIC &#8220;-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN&#8221;&gt;<br \/>\n&lt;HTML&gt;<br \/>\n&lt;HEAD&gt;<br \/>\n&lt;TITLE&gt; New Document &lt;\/TITLE&gt;<br \/>\n&lt;style&gt;<br \/>\n.txt{<br \/>\ndisplay:none;<br \/>\n}<br \/>\n&lt;\/style&gt;<br \/>\n&lt;SCRIPT LANGUAGE=&#8221;JavaScript&#8221;&gt;<\/p>\n<p>function ExpExcel(){<br \/>\n\/\/ Start Excel and get Application object.<br \/>\nvar oXL = new ActiveXObject(&#8220;Excel.Application&#8221;);<br \/>\n\/\/ Get a new workbook.<br \/>\nvar oWB = oXL.Workbooks.Add();<br \/>\nvar oSheet = oWB.ActiveSheet;<br \/>\n\/\/var table = document.all.data;<br \/>\nvar table=document.getElementById(&#8220;dataTab&#8221;);<br \/>\nvar hang = table.rows.length;<br \/>\nvar lie = table.rows(0).cells.length;<\/p>\n<p>\/\/ Add table headers going cell by cell.<br \/>\nfor (i=0;i&lt;hang;i++){<br \/>\nfor (j=0;j&lt;lie;j++){<br \/>\noSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;<br \/>\n}<br \/>\n}<br \/>\noXL.Visible = true;<br \/>\noXL.UserControl = true;<br \/>\n}<\/p>\n<p>&lt;\/script&gt;<br \/>\n&lt;\/HEAD&gt;<\/p>\n<p>&lt;BODY&gt;<br \/>\n&lt;input type=&#8221;button&#8221; value=&#8221;\u5bfc\u51faEXCEL&#8221; onclick=&#8221;ExpExcel()&#8221;\/&gt;<br \/>\n&lt;table border=&#8221;1&#8243; id=&#8221;dataTab&#8221;&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;th&gt;Month&lt;\/th&gt;<br \/>\n&lt;th&gt;Savings&lt;\/th&gt;<br \/>\n&lt;th&gt;mobile&lt;\/th&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;January&lt;\/td&gt;<br \/>\n&lt;td&gt;$100&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;font &gt;'&lt;\/font&gt;13633936220&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;January&lt;\/td&gt;<br \/>\n&lt;td&gt;$100&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;font &gt;'&lt;\/font&gt;13633936220&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;January&lt;\/td&gt;<br \/>\n&lt;td&gt;$100&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;font &gt;'&lt;\/font&gt;13633936220&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/table&gt;<br \/>\n&lt;\/BODY&gt;<br \/>\n&lt;\/HTML&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528IE\u7684\u7528\u6237\uff0c\u5982\u679c\u4e00\u4e2ahtml\u9875\u9762\u6709table\u7684\u8bdd\uff0c\u53ef\u4ee5\u628atable\u5bfc\u51fa\u5230excle\u6587\u4ef6\u91cc\u9762\uff0c\u4f46\u662f\u7ecf\u5e38\u9047\u5230\u4f1a\u628a\u8eab\u4efd\u8bc1\u7b49\u6570\u5b57\u6bd4\u8f83\u957f\u7684\u6570\u636e\u6539\u6210\u79d1\u5b66\u8ba1\u6570\u6cd5\u6765\u663e\u793a\u3002\u5f88\u662f\u5934\u75bc\u3002 \u6709\u8bf4\u52a0\u4e2a\u5355\u5f15\u53f7\u53ef\u4ee5\u89e3\u51b3\uff0c\u4f46\u662f\u6211\u8fd9\u91cc\u6d4b\u8bd5\uff0c\u663e\u793a\u548c\u5bfc\u51fa\u7684\u7ed3\u679c\u90fd\u6709\u5355\u5f15\u53f7\u3002\u6548\u679c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[237,11],"topic":[],"class_list":["post-67677","post","type-post","status-publish","format-standard","hentry","category-htmlcss","category-technology","tag-excel","tag-html"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=67677"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67677\/revisions"}],"predecessor-version":[{"id":67678,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67677\/revisions\/67678"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=67677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=67677"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=67677"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=67677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}