{"id":261,"date":"2020-06-24T19:51:47","date_gmt":"2020-06-24T11:51:47","guid":{"rendered":"http:\/\/robot.tanxiaodian.com\/?p=261"},"modified":"2020-06-24T19:51:47","modified_gmt":"2020-06-24T11:51:47","slug":"phpspreadsheet-%e5%86%99%e5%85%a5%e5%a4%a7%e6%95%b0%e6%8d%ae%e9%87%8f%e6%96%87%e4%bb%b6%e6%97%b6%e5%bb%ba%e8%ae%ae%e5%85%b3%e9%97%ad%e9%a2%84%e5%a4%84%e7%90%86%e5%85%ac%e5%bc%8fprecalculateformulas","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=261","title":{"rendered":"PhpSpreadsheet  \u5199\u5165\u5927\u6570\u636e\u91cf\u6587\u4ef6\u65f6\u5efa\u8bae\u5173\u95ed\u9884\u5904\u7406\u516c\u5f0fpreCalculateFormulas"},"content":{"rendered":"<h3 id=\"phpofficephpspreadsheetwriterxlsx\">\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx<\/h3>\n<h4 id=\"writing-a-spreadsheet\">Writing a spreadsheet<\/h4>\n<p>You can write an .xlsx file using the following code:<\/p>\n<pre><code class=\"php hljs\"><span class=\"hljs-variable\">$writer<\/span> = <span class=\"hljs-keyword\">new<\/span> \\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx(<span class=\"hljs-variable\">$spreadsheet<\/span>);\r\n<span class=\"hljs-variable\">$writer<\/span>-&gt;save(<span class=\"hljs-string\">\"05featuredemo.xlsx\"<\/span>);\r\n<\/code><\/pre>\n<h4 id=\"formula-pre-calculation\">Formula pre-calculation<\/h4>\n<p>By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:<\/p>\n<pre><code class=\"php hljs\"><span class=\"hljs-variable\">$writer<\/span> = <span class=\"hljs-keyword\">new<\/span> \\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx(<span class=\"hljs-variable\">$spreadsheet<\/span>);\r\n<span class=\"hljs-variable\">$writer<\/span>-&gt;setPreCalculateFormulas(<span class=\"hljs-keyword\">false<\/span>);\r\n<span class=\"hljs-variable\">$writer<\/span>-&gt;save(<span class=\"hljs-string\">\"05featuredemo.xlsx\"<\/span>);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\\PhpOffice\\PhpSpreadsheet&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=261\">Continue reading<span class=\"screen-reader-text\">PhpSpreadsheet  \u5199\u5165\u5927\u6570\u636e\u91cf\u6587\u4ef6\u65f6\u5efa\u8bae\u5173\u95ed\u9884\u5904\u7406\u516c\u5f0fpreCalculateFormulas<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/261"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=261"}],"version-history":[{"count":1,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}