{"id":7346,"date":"2020-04-20T11:12:22","date_gmt":"2020-04-20T03:12:22","guid":{"rendered":"https:\/\/aqzt.com\/7346.html"},"modified":"2020-10-29T21:03:59","modified_gmt":"2020-10-29T13:03:59","slug":"myexcel-3-7-3-%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83%ef%bc%8c%e6%bc%8f%e6%b4%9e%e4%bf%ae%e5%a4%8d%e7%ae%80%e5%8c%96","status":"publish","type":"post","link":"https:\/\/aqzt.com\/7346.html","title":{"rendered":"MyExcel 3.7.3 \u7248\u672c\u53d1\u5e03\uff0c\u6f0f\u6d1e\u4fee\u590d&amp;\u7b80\u5316"},"content":{"rendered":"<p><a href=\"https:\/\/www.oschina.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u6587\u7ae0\u8f6c\u8f7d\u5f00\u6e90\u4e2d\u56fd<\/a><\/p>\n<p style=\"text-align:left\">MyExcel\uff0c\u662f\u4e00\u4e2a\u96c6\u5bfc\u5165\u3001\u5bfc\u51fa\u3001\u52a0\u5bc6Excel\u7b49\u591a\u9879\u529f\u80fd\u7684Java\u5de5\u5177\u5305\u3002<\/p>\n<p style=\"text-align:left\">MyExcel\u91c7\u7528\u58f0\u660e\u5f0f\u8bed\u6cd5\u6765\u6784\u5efa\u3001\u8bfb\u53d6Excel\uff0c\u5c4f\u853dPOI\u7684\u5177\u4f53\u64cd\u4f5c\u7ec6\u8282\uff08\u5bf9POI\u65e0\u611f\u77e5\uff09\uff0c\u4ee5\u5f00\u53d1\u5e38\u7528\u7684\u6280\u672f\u66ff\u4ee3\uff0c\u4f7f\u5f97\u6784\u5efa\uff08\u4ece\u7b80\u5355\u5230\u9ad8\u5ea6\u590d\u6742Excel\uff09\u4ee5\u53ca\u8bfb\u53d6Excel\u53d8\u5f97\u6781\u4e3a\u4fbf\u5229\uff0c\u4e14\u6784\u5efa\u3001\u8bfb\u53d6\u6027\u80fd\u6781\u4e3a\u4f18\u5f02\uff0c\u5360\u7528\u5185\u5b58\u6781\u4f4e\uff08\u5177\u4f53\uff0c\u8bf7\u79fb\u6b65\u53c2\u8003<a href=\"https:\/\/www.oschina.net\/news\/113304\/myexcel-3-4-rc2-released\">MyExcel&amp;\u963f\u91ccEasyExcel\u6027\u80fd\u5bf9\u6bd4<\/a>\uff09\u3002<\/p>\n<p style=\"text-align:left\">\u5982\u5bfc\u5165\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/><\/div><\/td><td><div class=\"text codecolorer\">List&amp;lt;ArtCrowd&amp;gt; result = SaxExcelReader.of(ArtCrowd.class)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; .sheet(0) &lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;\/\/ 0\u4ee3\u8868\u7b2c\u4e00\u4e2asheet\uff0c\u5982\u679c\u4e3a0\uff0c\u53ef\u7701\u7565\u8be5\u64cd\u4f5c\uff0c\u4e5f\u53efsheet(&amp;quot;\u540d\u79f0&amp;quot;)\u8bfb\u53d6&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; .rowFilter(row -&amp;gt; row.getRowNum() &amp;gt; 0) &lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;\/\/ \u5982\u65e0\u9700\u8fc7\u6ee4\uff0c\u53ef\u7701\u7565\u8be5\u64cd\u4f5c\uff0c0\u4ee3\u8868\u7b2c\u4e00\u884c&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; .beanFilter(ArtCrowd::isDance) &lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;&lt;span style=&quot;color:#6a737d&quot;&gt;\/\/ bean\u8fc7\u6ee4&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; .read(path.toFile());<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p style=\"text-align:left\">\u672c\u6b21\u4e3b\u8981\u4e3a<strong><span style=\"color:#e74c3c\">\u6f0f\u6d1e\u4fee\u590d\u66f4\u65b0\uff0c\u5f3a\u70c8\u5efa\u8bae\u5df2\u7528\u7528\u6237\u8fdb\u884c\u5347\u7ea7<\/span><\/strong>\uff0c\u5177\u4f53\u66f4\u65b0\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">\u4fee\u590d\u8bfb\u53d6excel\u7a7a\u884c\u95ee\u9898\uff1b<\/span><\/li>\n<li style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">\u4fee\u590d\u8bfb\u53d6\u6570\u503c\u7cbe\u5ea6\u95ee\u9898\uff0c\u5982\u539f\u6570\u503c3.98\uff0c\u8bfb\u53d6\u540e\u53ef\u80fd\u4f1a\u662f3.9799999999999999998\uff1b<\/span><\/li>\n<li style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">\u4fee\u590d\u5728windows\u73af\u5883\u4e0b\uff0c\u4f7f\u7528\u96f6\u62f7\u8d1d\u672a\u91ca\u653e\u76f8\u5173\u8d44\u6e90\u5bfc\u81f4\u7684\u9519\u8bef\uff1b<\/span><\/li>\n<li style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">DefaultStreamExcelBuilder\u652f\u6301\u5728close\u65b9\u6cd5\u4e2d\u4e3b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6\uff0c\u907f\u514d\u7528\u6237\u624b\u52a8\u5220\u9664\uff1b<\/span><\/li>\n<li style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">\u90e8\u5206\u4ee3\u7801\u4f18\u5316\uff1b<\/span><\/li>\n<\/ol>\n<h4 style=\"text-align:left\"><span style=\"background-color:#ffffff;color:#24292e\">\u4e00\u3001\u7a7a\u884c\u95ee\u9898<\/span><\/h4>\n<p><span style=\"background-color:#ffffff;color:#24292e\">\u5728\u90e8\u5206\u573a\u666f\u4e0b\uff0c\u7528\u6237\u63d0\u4ea4\u7684Excel\u6587\u4ef6\u5b58\u5728\u5927\u91cf\u65e0\u5185\u5bb9\u7684\u7a7a\u884c\uff0c\u4f46\u53ef\u88ab\u89e3\u6790\uff0c\u8fd9\u6837\u7684\u7a7a\u884c\u5f80\u5f80\u96be\u4ee5\u53d1\u73b0\uff0c\u5982\u679c\u8bfb\u53d6\u4e3aList\u5904\u7406\uff0c\u53ef\u80fd\u51fa\u73b0OOM\u95ee\u9898\uff0c\u5f71\u54cd\u7cfb\u7edf\u7a33\u5b9a\u6027\uff0c\u4fee\u590d\u540e\uff0c\u9ed8\u8ba4\u4f1a\u8fc7\u6ee4\u8be5\u884c\u7684\u8bfb\u53d6\u3002<\/span><\/p>\n<h4><span style=\"background-color:#ffffff;color:#24292e\">\u4e8c\u3001\u96f6\u62f7\u8d1d\u8d44\u6e90\u91ca\u653e<\/span><\/h4>\n<p><span style=\"background-color:#ffffff;color:#24292e\">MyExcel\u4e3a\u8bfb\u53d6\u6d77\u91cf\u6570\u636e\u7684Excel\u80fd\u5360\u7528\u6781\u4f4e\u5185\u5b58\uff0c\u4f7f\u7528\u4e86\u5185\u5b58+\u6587\u4ef6\u7684\u65b9\u5f0f\u8fdb\u884c\u6570\u636e\u5b58\u653e\uff0c\u5176\u4e2d\u6587\u4ef6\u4f7f\u7528\u96f6\u62f7\u8d1d\u65b9\u5f0f\u8bfb\u53d6\uff0c\u53bb\u9664\u5185\u6838\u7a7a\u95f4\u4e0e\u7528\u6237\u7a7a\u95f4\u7684\u6587\u4ef6\u62f7\u8d1d\u8fc7\u7a0b\uff0c\u63d0\u5347\u6548\u7387\u4ee5\u53ca\u964d\u4f4e\u5185\u5b58\u5360\u7528\u3002<\/span><\/p>\n<p><span style=\"background-color:#ffffff;color:#24292e\">\u5728windows\u7cfb\u7edf\u4e0b\uff0c\u4ee5\u5f80\u7248\u672c\u56e0\u672a\u91ca\u653e\u76f8\u5173\u8d44\u6e90\uff0c\u5bfc\u81f4\u65e0\u6cd5\u6b63\u5e38\u5220\u9664\u7528\u4e8e\u4fdd\u5b58\u6570\u636e\u7684\u4e34\u65f6\u6587\u4ef6\uff0c\u4f1a\u51fa\u73b0\u5f02\u5e38\uff08\u4e0d\u5f71\u54cd\u5b9e\u9645\u4f7f\u7528\uff09\uff0c\u5982\u4e0b\uff1a<\/span><\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-java\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/><\/div><\/td><td><div class=\"text codecolorer\">java.nio.file.FileSystemException: E:\\BigData\\ztest\\myexcel\\s_c_62_1585896412480_24953102150115799386.data: \u53e6\u4e00\u4e2a\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528\u6b64\u6587\u4ef6\uff0c\u8fdb\u7a0b\u65e0\u6cd5\u8bbf\u95ee\u3002 at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) at <br \/>\nsun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at <br \/>\nsun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at <br \/>\nsun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) at <br \/>\nsun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) at <br \/>\njava.nio.file.Files.deleteIfExists(Files.java:1165) at <br \/>\ncom.github.liaochong.myexcel.utils.TempFileOperator.deleteTempFile(TempFileOperator.java:112) at <br \/>\ncom.github.liaochong.myexcel.utils.TempFileOperator.deleteTempFiles(TempFileOperator.java:98) at <br \/>\ncom.github.liaochong.myexcel.core.cache.StringsCache.clearAll(StringsCache.java:142) at <br \/>\ncom.github.liaochong.myexcel.core.SaxExcelReader.process(SaxExcelReader.java:269) at com.githu<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<h4 style=\"text-align:left\">\u4e09\u3001\u4e3b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6<\/h4>\n<p>\u5728\u4f7f\u7528DefaultStreamExcelBuilder\u6784\u5efaZIP\u6587\u4ef6\u65f6\uff0c\u5bf9\u5e94\u7684\u4e34\u65f6\u6587\u4ef6\u9700\u8981\u7528\u6237\u4e3b\u52a8\u5220\u9664\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-java\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/><\/div><\/td><td><div class=\"text codecolorer\">Path zipFile = null;<br \/>\ntry (DefaultStreamExcelBuilder&amp;lt;CommonPeople&amp;gt; excelBuilder = DefaultStreamExcelBuilder.of(CommonPeople.class)<br \/>\n&nbsp; &nbsp; &nbsp;.capacity(1000) \/\/ \u8bbe\u5b9azip\u6587\u4ef6\u4e2d\u6bcf\u4e2aexcel\u7684\u5bb9\u91cf\/\u884c<br \/>\n&nbsp; &nbsp; &nbsp;.start()) {<br \/>\n&nbsp; &nbsp; data(excelBuilder, 5000);<br \/>\n&nbsp; &nbsp; zipFile = excelBuilder.buildAsZip(&quot;xxxx&quot;);<br \/>\n&nbsp; &nbsp; \/\/ do something<br \/>\n&nbsp; &nbsp; ......<br \/>\n} finally {<br \/>\n&nbsp; &nbsp; Files.delete(zipFile);<br \/>\n}<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p style=\"text-align:left\">\u5728\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u4e3b\u52a8\u5220\u9664\u8fc7\u7a0b\u5f80\u5f80\u4f1a\u88ab\u4e0d\u5c0f\u5fc3\u5ffd\u7565\uff0c\u7531\u6b64\u53ef\u80fd\u5bfc\u81f4\u7cfb\u7edf\u4e34\u65f6\u6587\u4ef6\u5806\u79ef\u7684\u8d8a\u6765\u8d8a\u591a\uff0c\u4ece\u800c\u5f15\u53d1\u7cfb\u7edf\u95ee\u9898\uff08\u5982\u78c1\u76d8\u4e0d\u591f\u7b49\uff09\uff0c\u672c\u6b21\u5728\u5bf9\u5e94\u7684close\u65b9\u6cd5\u52a0\u5165\u4e86\u4e34\u65f6\u6587\u4ef6\u7684\u6e05\u7406\uff0c\u65e0\u9700finally\u6e05\u7406\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-java\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/><\/div><\/td><td><div class=\"text codecolorer\">Path zipFile = null;<br \/>\ntry (DefaultStreamExcelBuilder&amp;lt;CommonPeople&amp;gt; excelBuilder = DefaultStreamExcelBuilder.of(CommonPeople.class)<br \/>\n&nbsp; &nbsp; &nbsp;.capacity(1000) \/\/ \u8bbe\u5b9azip\u6587\u4ef6\u4e2d\u6bcf\u4e2aexcel\u7684\u5bb9\u91cf\/\u884c<br \/>\n&nbsp; &nbsp; &nbsp;.start()) {<br \/>\n&nbsp; &nbsp; data(excelBuilder, 5000);<br \/>\n&nbsp; &nbsp; zipFile = excelBuilder.buildAsZip(&quot;xxxx&quot;);<br \/>\n&nbsp; &nbsp; \/\/ do something<br \/>\n&nbsp; &nbsp; ......<br \/>\n}<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p style=\"text-align:left\">\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u751f\u6210\u7684\u4e34\u65f6\u6587\u4ef6\u5e76\u975e\u7acb\u5373\u4f7f\u7528\uff0c\u8fd9\u79cd\u573a\u666f\u4e0b\uff0c\u4ecd\u9700\u7528\u6237\u624b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6\u3002<\/p>\n<p style=\"text-align:left\">\u66f4\u591a\uff0c\u8bf7\u79fb\u6b65\u6587\u6863\uff1a<a href=\"https:\/\/github.com\/liaochong\/myexcel\/wiki\">https:\/\/github.com\/liaochong\/myexcel\/wiki<\/a><\/p>\n<p style=\"text-align:left\"><img loading=\"lazy\" decoding=\"async\" height=\"392\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/img\/up-e59abe1bd8935d53a60d8235f7cd382a137.png\" width=\"700\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u8f6c\u8f7d\u5f00\u6e90\u4e2d\u56fd MyExcel\uff0c\u662f\u4e00\u4e2a\u96c6\u5bfc\u5165\u3001\u5bfc\u51fa\u3001\u52a0\u5bc6Excel\u7b49\u591a\u9879\u529f\u80fd\u7684Java\u5de5\u5177\u5305\u3002 MyExcel\u91c7\u7528\u58f0\u660e\u5f0f\u8bed\u6cd5\u6765\u6784\u5efa\u3001\u8bfb\u53d6Excel\uff0c\u5c4f\u853dPOI\u7684\u5177\u4f53\u64cd\u4f5c\u7ec6\u8282\uff08\u5bf9POI\u65e0\u611f\u77e5\uff09\uff0c\u4ee5\u5f00\u53d1\u5e38\u7528\u7684\u6280\u672f\u66ff\u4ee3\uff0c\u4f7f\u5f97\u6784\u5efa\uff08\u4ece\u7b80\u5355\u5230\u9ad8\u5ea6\u590d\u6742Excel\uff09\u4ee5\u53ca\u8bfb\u53d6Excel\u53d8\u5f97\u6781\u4e3a\u4fbf\u5229\uff0c\u4e14\u6784\u5efa\u3001\u8bfb\u53d6\u6027\u80fd\u6781\u4e3a\u4f18\u5f02\uff0c\u5360\u7528\u5185\u5b58\u6781\u4f4e\uff08\u5177\u4f53\uff0c\u8bf7\u79fb\u6b65\u53c2\u8003MyExcel&amp;\u963f\u91ccEasyExcel\u6027\u80fd\u5bf9\u6bd4\uff09\u3002 \u5982\u5bfc\u5165\uff1a 12345List&amp;lt;ArtCrowd&amp;gt; result = SaxExcelRea<\/p>\n","protected":false},"author":1,"featured_media":6522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[27],"tags":[292,25,21,11],"collection":[319],"_links":{"self":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/7346"}],"collection":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/comments?post=7346"}],"version-history":[{"count":1,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/7346\/revisions"}],"predecessor-version":[{"id":11218,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/7346\/revisions\/11218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media\/6522"}],"wp:attachment":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media?parent=7346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/categories?post=7346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/tags?post=7346"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/collection?post=7346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}