{"id":12272,"date":"2019-07-17T09:23:12","date_gmt":"2019-07-17T00:23:12","guid":{"rendered":"https:\/\/elleneast.com\/?p=12272"},"modified":"2019-07-17T09:23:12","modified_gmt":"2019-07-17T00:23:12","slug":"%e3%80%90vb-net%e3%80%91closedxml%ef%bc%9a%e3%82%aa%e3%83%bc%e3%83%88%e3%83%95%e3%82%a3%e3%83%ab%e3%82%bf%e3%83%bc","status":"publish","type":"post","link":"https:\/\/elleneast.com\/?p=12272","title":{"rendered":"\u3010VB.NET\u3011ClosedXML\uff1a\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc"},"content":{"rendered":"[include-page id=\u201d11760\u2033]\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/elleneast.com\/?p=12272\/#%E7%AF%84%E5%9B%B2%E3%81%AB%E3%82%AA%E3%83%BC%E3%83%88%E3%83%95%E3%82%A3%E3%83%AB%E3%82%BF%E3%83%BC%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B\" >\u7bc4\u56f2\u306b\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/elleneast.com\/?p=12272\/#%E5%80%A4%E3%82%92%E6%8A%BD%E5%87%BA%E3%81%99%E3%82%8B\" >\u5024\u3092\u62bd\u51fa\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/elleneast.com\/?p=12272\/#%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%95%E3%82%A3%E3%83%AB%E3%82%BF\" >\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30eb\u30bf<\/a><\/li><\/ul><\/nav><\/div>\n<h2 id=\"i-0\"><span class=\"ez-toc-section\" id=\"%E7%AF%84%E5%9B%B2%E3%81%AB%E3%82%AA%E3%83%BC%E3%83%88%E3%83%95%E3%82%A3%E3%83%AB%E3%82%BF%E3%83%BC%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B\"><\/span>\u7bc4\u56f2\u306b\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:vbnet decode:true \">Dim wb = New XLWorkbook\nDim ws = wb.Worksheets.Add(\"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\")\n\nws.Cell(\"A1\").Value = \"\u30bf\u30a4\u30c8\u30eb\"\nws.Cell(\"A2\").Value = \"\u3046\u3057\u304a\u3068\u3068\u3089\"\nws.Cell(\"A3\").Value = \"\u9032\u6483\u306e\u5de8\u4eba\"\nws.Cell(\"A4\").Value = \"GS\u7f8e\u795e \u6975\u697d\u5927\u4f5c\u6226!!\"\nws.Cell(\"B1\").Value = \"\u4eba\u7269\"\nws.Cell(\"B2\").Value = \"\u3046\u3057\u304a\"\nws.Cell(\"B3\").Value = \"\u30df\u30ab\u30b5\"\nws.Cell(\"B4\").Value = \"\u304a\u30ad\u30cc\"\n\nws.RangeUsed.SetAutoFilter\n\n'\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u89e3\u9664\u3059\u308b\u306b\u306f\uff1a\n'ws.AutoFilter.Clear\n'  \u307e\u305f\u306f\n'ws.SetAutoFilter(False)\n'  \u307e\u305f\u306f\n'\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u9069\u5f53\u306a\u7bc4\u56f2(Range)\u306b\u5bfe\u3057\u3066\u4e0a\u8a18\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\n\nwb.SaveAs(\"D:\\test\\AutoFilter.xlsx\")<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_131.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12274 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_131.png\" alt=\"\" width=\"270\" height=\"126\"><\/a><\/p>\n<h2 id=\"i-1\"><span class=\"ez-toc-section\" id=\"%E5%80%A4%E3%82%92%E6%8A%BD%E5%87%BA%E3%81%99%E3%82%8B\"><\/span>\u5024\u3092\u62bd\u51fa\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:vbnet decode:true\">Dim wb = New XLWorkbook\nDim ws = wb.Worksheets.Add(\"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\")\n\n'\u30c7\u30fc\u30bf\u306e\u7528\u610f\nws.Cell(\"A1\").SetValue(\"\u6570\u5b57\") _\n  .CellBelow.SetValue(2) _\n  .CellBelow.SetValue(3) _\n  .CellBelow.SetValue(3) _\n  .CellBelow.SetValue(5) _\n  .CellBelow.SetValue(1) _\n  .CellBelow.SetValue(4)\nws.Cell(\"B1\").SetValue(\"\u6570\u5b57\") _\n  .CellBelow.SetValue(7) _\n  .CellBelow.SetValue(8) _\n  .CellBelow.SetValue(10) _\n  .CellBelow.SetValue(9) _\n  .CellBelow.SetValue(7) _\n  .CellBelow.SetValue(6)\n\n'\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\uff12\u5217\u76ee\u3067\u6570\u5b57\u306e 7, 8, 6 \u3092\u62bd\u51fa\nws.RangeUsed.SetAutoFilter.Column(2) _\n    .AddFilter(7) _\n    .AddFilter(8) _\n    .AddFilter(6)\n\n'\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\uff11\u5217\u76ee\u3067\u6607\u9806\u30bd\u30fc\u30c8\nws.AutoFilter.Sort(1)\n\nwb.SaveAs(\"D:\\test\\AutoFilter.xlsx\")<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_132b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12277 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_132b.png\" alt=\"\" width=\"207\" height=\"173\"><\/a><\/p>\n<h2 id=\"i-2\"><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%95%E3%82%A3%E3%83%AB%E3%82%BF\"><\/span>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30eb\u30bf<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:vbnet decode:true\">Dim wb = New XLWorkbook\nDim ws = wb.Worksheets.Add(\"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\")\n\n'\u30c7\u30fc\u30bf\u306e\u7528\u610f\nws.Cell(\"A1\").SetValue(\"\u6587\u5b57\") _\n  .CellBelow.SetValue(\"B\") _\n  .CellBelow.SetValue(\"C\") _\n  .CellBelow.SetValue(\"C\") _\n  .CellBelow.SetValue(\"E\") _\n  .CellBelow.SetValue(\"A\") _\n  .CellBelow.SetValue(\"D\")\nws.Cell(\"B1\").SetValue(\"\u6587\u5b57\") _\n  .CellBelow.SetValue(\"G\") _\n  .CellBelow.SetValue(\"J\") _\n  .CellBelow.SetValue(\"F\") _\n  .CellBelow.SetValue(\"K\") _\n  .CellBelow.SetValue(\"I\") _\n  .CellBelow.SetValue(\"H\")\n\n'\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\uff11\u5217\u76ee\u3067\u300cB \u4ee5\u4e0a D \u4ee5\u4e0b\u300d\u306e\u6761\u4ef6\u3092\u8a2d\u5b9a\nws.RangeUsed.SetAutoFilter.Column(1).Between(\"B\", \"D\")\n\n'\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\uff12\u5217\u76ee\u3067\u964d\u9806\u30bd\u30fc\u30c8\nws.AutoFilter.Sort(2, XLSortOrder.Descending)\n\nwb.SaveAs(\"D:\\test\\AutoFilter.xlsx\")<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u306f\u4e0b\u56f3\u306e\u3088\u3046\u306b\u306a\u308b\u306f\u305a\u3067\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_135.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12281 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_135.png\" alt=\"\" width=\"199\" height=\"147\"><\/a><\/p>\n<p>\u3057\u304b\u3057\u3001\u5b9f\u969b\u306b\u306f\u4e0b\u56f3\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\uff08A \u5217\u306b \u201cE\u201d \u304c\u3042\u3063\u3066\u306f\u3044\u3051\u306a\u3044\u306f\u305a\u3067\u3059\uff09<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_133.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12279 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_133.png\" alt=\"\" width=\"201\" height=\"193\"><\/a><\/p>\n<p>\u3044\u308d\u3044\u308d\u8a66\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001Excel \u4e0a\u3067\u30d5\u30a3\u30eb\u30bf\u306e\uff3b\u518d\u9069\u7528\uff3d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068 \u201cE\u201d \u304c\u6d88\u3048\u3066\u60f3\u5b9a\u901a\u308a\u306e\u7d50\u679c\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_134.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12280 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_134.png\" alt=\"\" width=\"472\" height=\"161\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_134.png 472w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_134-300x102.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\"><\/a><\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u30b3\u30fc\u30c9\u306e\u4e2d\u306b ws.AutoFilter.Reapply \u3092\u5165\u308c\u3066\u3082\u30c0\u30e1\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304b\u3089\u3001\u4eca\u56de\u306f\uff12\u5217\u306e\u30c7\u30fc\u30bf\u3067\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u3092\u8a66\u3057\u305f\u3089\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3061\u3087\u3063\u3068\u5909\u306a\u7d50\u679c\u306b\u306a\u3063\u305f\u308f\u3051\u3067\u3059\u304c\u3001\uff11\u5217\u306e\u30c7\u30fc\u30bf\u306e\u5834\u5408\u306f\u6700\u521d\u304b\u3089\u6b63\u3057\u3044\u7d50\u679c\u3067\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30eb\u30bf\u306e\u8a2d\u5b9a\u72b6\u614b\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\u30d5\u30a3\u30eb\u30bf\u3092\u30af\u30ea\u30c3\u30af\uff1e\uff3b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\uff3d\uff1e\uff3b\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\u30d5\u30a3\u30eb\u30bf\u30fc\uff3d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12282 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136.png\" alt=\"\" width=\"464\" height=\"464\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136.png 464w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136-150x150.png 150w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136-300x300.png 300w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136-125x125.png 125w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_136-160x160.png 160w\" sizes=\"auto, (max-width: 464px) 100vw, 464px\"><\/a><\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_137.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12283\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_137.png\" alt=\"\" width=\"657\" height=\"259\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_137.png 657w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_137-300x118.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/elleneast.com\/?cat=90\">\u300c\u3010VB.NET\u3011ClosedXML \u306e\u4f7f\u3044\u65b9\u300d\u306e\u4e00\u89a7\u3092\u8868\u793a<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[include-page id=\u201d11760\u2033] \u7bc4\u56f2\u306b\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u8a2d\u5b9a\u3059\u308b Dim wb = New XLWorkbook Dim ws = wb.Worksheets.Add(&#8220;\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc&#8221;) ws.C &#8230; <\/p>\n","protected":false},"author":1,"featured_media":2656,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[90],"tags":[],"class_list":{"0":"post-12272","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-closedxml"},"_links":{"self":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/12272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12272"}],"version-history":[{"count":3,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/12272\/revisions"}],"predecessor-version":[{"id":12286,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/12272\/revisions\/12286"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/media\/2656"}],"wp:attachment":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}