{"id":11853,"date":"2019-07-17T09:29:55","date_gmt":"2019-07-17T00:29:55","guid":{"rendered":"https:\/\/elleneast.com\/?p=11853"},"modified":"2019-08-22T19:27:05","modified_gmt":"2019-08-22T10:27:05","slug":"%e3%80%90vb-net%e3%80%91closedxml%ef%bc%9a%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/elleneast.com\/?p=11853","title":{"rendered":"\u3010VB.NET\u3011ClosedXML\uff1a\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"[include-page id=\u201d11760\u2033]\n<p>\u3053\u3053\u3067\u306f\u57fa\u672c\u7684\u306a\u51e6\u7406\u3092\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 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=11853\/#%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%81%A8%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88\" >\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3068\u30ef\u30fc\u30af\u30b7\u30fc\u30c8<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E6%96%B0%E8%A6%8F%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%81%AE%E4%BD%9C%E6%88%90%E3%81%A8%E4%BF%9D%E5%AD%98\" >\u65b0\u898f\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u306e\u4f5c\u6210\u3068\u4fdd\u5b58<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E6%97%A2%E5%AD%98%E3%81%AE%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%82%92%E9%96%8B%E3%81%8F\" >\u65e2\u5b58\u306e\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u958b\u304f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88%E3%81%AE%E8%BF%BD%E5%8A%A0\" >\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u8ffd\u52a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E6%97%A2%E5%AD%98%E3%81%AE%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88%E3%81%AE%E5%8F%96%E5%BE%97\" >\u65e2\u5b58\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u53d6\u5f97<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E6%93%8D%E4%BD%9C\" >\u30bb\u30eb\u306e\u64cd\u4f5c<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AB%E5%80%A4%E3%82%92%E8%A8%AD%E5%AE%9A\" >\u30bb\u30eb\u306b\u5024\u3092\u8a2d\u5b9a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AB%E5%BC%8F%E3%82%92%E8%A8%AD%E5%AE%9A\" >\u30bb\u30eb\u306b\u5f0f\u3092\u8a2d\u5b9a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\" >\u30bb\u30eb\u306e\u5024\u306e\u53d6\u5f97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%82%92%E3%82%A2%E3%82%AF%E3%83%86%E3%82%A3%E3%83%96%E3%81%AB%E3%81%99%E3%82%8B\" >\u30bb\u30eb\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E5%89%8A%E9%99%A4%E3%83%BB%E3%82%AF%E3%83%AA%E3%82%A2\" >\u524a\u9664\u30fb\u30af\u30ea\u30a2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/elleneast.com\/?p=11853\/#%EF%BC%92%E3%81%A4%E3%81%AE%E3%82%BB%E3%83%AB%E3%81%8B%E3%82%89%E7%9F%A9%E5%BD%A2%E7%AF%84%E5%9B%B2%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B\" >\uff12\u3064\u306e\u30bb\u30eb\u304b\u3089\u77e9\u5f62\u7bc4\u56f2\u3092\u53d6\u5f97\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%82%84%E7%AF%84%E5%9B%B2%E3%82%92%E5%8F%96%E5%BE%97%E3%83%BB%E9%81%B8%E6%8A%9E%E3%81%99%E3%82%8B\" >\u30bb\u30eb\u3084\u7bc4\u56f2\u3092\u53d6\u5f97\u30fb\u9078\u629e\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E7%89%B9%E5%AE%9A%E3%81%AE%E7%AF%84%E5%9B%B2%E3%81%AE%E3%82%BB%E3%83%AB%E3%82%92%EF%BC%91%E3%81%A4%E3%81%9A%E3%81%A4%E5%87%A6%E7%90%86%E3%81%99%E3%82%8B\" >\u7279\u5b9a\u306e\u7bc4\u56f2\u306e\u30bb\u30eb\u3092\uff11\u3064\u305a\u3064\u51e6\u7406\u3059\u308b<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E6%9B%B8%E5%BC%8F\" >\u30bb\u30eb\u306e\u66f8\u5f0f<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E5%89%8D%E6%99%AF%E8%89%B2%EF%BC%88%E6%96%87%E5%AD%97%E8%89%B2%EF%BC%89%E3%81%AE%E5%A4%89%E6%9B%B4\" >\u30bb\u30eb\u306e\u524d\u666f\u8272\uff08\u6587\u5b57\u8272\uff09\u306e\u5909\u66f4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E8%83%8C%E6%99%AF%E8%89%B2%E3%81%AE%E5%A4%89%E6%9B%B4\" >\u30bb\u30eb\u306e\u80cc\u666f\u8272\u306e\u5909\u66f4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%9C%E3%83%BC%E3%83%AB%E3%83%89\" >\u30dc\u30fc\u30eb\u30c9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E3%82%B5%E3%82%A4%E3%82%BA\" >\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E5%90%8D\" >\u30d5\u30a9\u30f3\u30c8\u540d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%AA%E3%83%83%E3%83%81%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88\" >\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%82%BB%E3%83%AB%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E5%9E%8B%E3%81%AE%E5%A4%89%E6%9B%B4\" >\u30bb\u30eb\u306e\u30c7\u30fc\u30bf\u578b\u306e\u5909\u66f4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%81%AE%E8%A1%A8%E7%A4%BA%E5%BD%A2%E5%BC%8F%E3%81%AE%E5%A4%89%E6%9B%B4\" >\u30c6\u30ad\u30b9\u30c8\u306e\u8868\u793a\u5f62\u5f0f\u306e\u5909\u66f4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E7%BD%AB%E7%B7%9A\" >\u7f6b\u7dda<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E8%A1%8C%E3%81%A8%E5%88%97\" >\u884c\u3068\u5217<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E5%88%97%E5%B9%85%E3%81%AE%E8%A8%AD%E5%AE%9A\" >\u5217\u5e45\u306e\u8a2d\u5b9a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E8%A1%8C%E3%83%BB%E5%88%97%E3%81%AE%E6%8C%BF%E5%85%A5\" >\u884c\u30fb\u5217\u306e\u633f\u5165<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E8%A1%8C%E3%83%BB%E5%88%97%E3%81%AE%E5%89%8A%E9%99%A4\" >\u884c\u30fb\u5217\u306e\u524a\u9664<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/elleneast.com\/?p=11853\/#%E8%A1%8C%E3%83%BB%E5%88%97%E3%83%BB%E3%82%BB%E3%83%AB%E3%81%AE%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%81%AF1%E3%83%99%E3%83%BC%E3%82%B9\" >\u884c\u30fb\u5217\u30fb\u30bb\u30eb\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f1\u30d9\u30fc\u30b9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/elleneast.com\/?p=11853\/#Property_value_%E3%81%A8_SetPropertyvalue_%E3%81%AE%E4%BD%BF%E3%81%84%E5%88%86%E3%81%91\" >.Property = value \u3068 .SetProperty(value) \u306e\u4f7f\u3044\u5206\u3051<\/a><\/li><\/ul><\/nav><\/div>\n<h2 id=\"i-0\"><span class=\"ez-toc-section\" id=\"%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%81%A8%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88\"><\/span>\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3068\u30ef\u30fc\u30af\u30b7\u30fc\u30c8<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 id=\"i-1\"><span class=\"ez-toc-section\" id=\"%E6%96%B0%E8%A6%8F%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%81%AE%E4%BD%9C%E6%88%90%E3%81%A8%E4%BF%9D%E5%AD%98\"><\/span>\u65b0\u898f\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u306e\u4f5c\u6210\u3068\u4fdd\u5b58<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">Dim workbook = New XLWorkbook \n\n'\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u4fdd\u5b58\u3059\u308b\u306b\u306f\u6700\u4f4e\uff11\u3064\u306e\u30b7\u30fc\u30c8\u304c\u5fc5\u8981\nworkbook.AddWorksheet(\"Sheet 1\") \n\nworkbook.SaveAs(\"D:\\test\\NewWorkbook.xlsx\")<\/pre>\n<h3 id=\"i-2\"><span class=\"ez-toc-section\" id=\"%E6%97%A2%E5%AD%98%E3%81%AE%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF%E3%82%92%E9%96%8B%E3%81%8F\"><\/span>\u65e2\u5b58\u306e\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u958b\u304f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">Dim workbook = New XLWorkbook(\"D:\\test\\NewWorkbook.xls\") \n\n'\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u8ffd\u52a0\nworkbook.AddWorksheet(\"New Sheet\") \n\nworkbook.SaveAs(\"D:\\test\\NewWorkbook.xlsx\")<\/pre>\n<h3 id=\"i-3\"><span class=\"ez-toc-section\" id=\"%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88%E3%81%AE%E8%BF%BD%E5%8A%A0\"><\/span>\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u8ffd\u52a0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">Dim ws As IXLWorksheet = workbook.AddWorksheet(\"New Worksheet\")<\/pre>\n<h3 id=\"i-4\"><span class=\"ez-toc-section\" id=\"%E6%97%A2%E5%AD%98%E3%81%AE%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88%E3%81%AE%E5%8F%96%E5%BE%97\"><\/span>\u65e2\u5b58\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u53d6\u5f97<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">Dim ws1 As IXLWorksheet = workbook.Worksheet(\"Sheet 1\")\nDim ws2 As IXLWorksheet = workbook.Worksheet(3)<\/pre>\n<h2 id=\"i-5\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E6%93%8D%E4%BD%9C\"><\/span>\u30bb\u30eb\u306e\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 id=\"i-6\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AB%E5%80%A4%E3%82%92%E8%A8%AD%E5%AE%9A\"><\/span>\u30bb\u30eb\u306b\u5024\u3092\u8a2d\u5b9a<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">ws.Cell(1, 1).Value = \"Hello, world!\"\nws.Cell(\"A2\").SetValue(\"Hello, world!\")\nws.Cell(\"A3\").SetValue(\"Hello, world!\").CellBelow.SetValue(\"Hello, world!\").CellRight.SetValue(\"Hello, world!\")<\/pre>\n<h3 id=\"i-7\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AB%E5%BC%8F%E3%82%92%E8%A8%AD%E5%AE%9A\"><\/span>\u30bb\u30eb\u306b\u5f0f\u3092\u8a2d\u5b9a<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.FormulaA1 = \"=A2*B2\"\ncell2.FormulaA1 = \"=\"\"\u5408\u8a08 \"\" &amp; SUM(A1:A2)\"<\/pre>\n<h3 id=\"i-8\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\"><\/span>\u30bb\u30eb\u306e\u5024\u306e\u53d6\u5f97<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true  \">Dim r1 = ws.Cell(\"C1\").Value\nDim r2 = ws.Cell(\"C2\").GetString\nDim r3 = ws.Cell(\"C3\").GetBoolean\nDim r4 = ws.Cell(\"C4\").GetDateTime<\/pre>\n<h3 id=\"i-9\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%82%92%E3%82%A2%E3%82%AF%E3%83%86%E3%82%A3%E3%83%96%E3%81%AB%E3%81%99%E3%82%8B\"><\/span>\u30bb\u30eb\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">ws.Cell(\"B2\").SetActive<\/pre>\n<h3 id=\"i-10\"><span class=\"ez-toc-section\" id=\"%E5%89%8A%E9%99%A4%E3%83%BB%E3%82%AF%E3%83%AA%E3%82%A2\"><\/span>\u524a\u9664\u30fb\u30af\u30ea\u30a2<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">range.Delete<\/pre>\n<pre class=\"lang:vbnet decode:true \">range.Clear<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_56.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12097 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_56.png\" alt=\"\" width=\"542\" height=\"308\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_56.png 542w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_56-300x170.png 300w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\"><\/a><\/p>\n<h3 id=\"i-11\"><span class=\"ez-toc-section\" id=\"%EF%BC%92%E3%81%A4%E3%81%AE%E3%82%BB%E3%83%AB%E3%81%8B%E3%82%89%E7%9F%A9%E5%BD%A2%E7%AF%84%E5%9B%B2%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B\"><\/span>\uff12\u3064\u306e\u30bb\u30eb\u304b\u3089\u77e9\u5f62\u7bc4\u56f2\u3092\u53d6\u5f97\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">Dim firstDataCell = ws.Cell(\"B4\") 'ws.FirstCellUsed\nDim lastDataCell = ws.LastCellUsed\nDim rngData = ws.Range(firstDataCell.Address, lastDataCell.Address)<\/pre>\n<h3 id=\"i-12\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%82%84%E7%AF%84%E5%9B%B2%E3%82%92%E5%8F%96%E5%BE%97%E3%83%BB%E9%81%B8%E6%8A%9E%E3%81%99%E3%82%8B\"><\/span>\u30bb\u30eb\u3084\u7bc4\u56f2\u3092\u53d6\u5f97\u30fb\u9078\u629e\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">ws.Cell(\"B2\").Select\nws.Range(\"D2:E2\").Select\nws.Ranges(\"C3, D4:E5\").Select\nws.Range(4, 1, 4, 2).Select '\u51e6\u7406\u901f\u5ea6\u306e\u9762\u3067\u306f\u304a\u3059\u3059\u3081<\/pre>\n<h3 id=\"i-13\"><span class=\"ez-toc-section\" id=\"%E7%89%B9%E5%AE%9A%E3%81%AE%E7%AF%84%E5%9B%B2%E3%81%AE%E3%82%BB%E3%83%AB%E3%82%92%EF%BC%91%E3%81%A4%E3%81%9A%E3%81%A4%E5%87%A6%E7%90%86%E3%81%99%E3%82%8B\"><\/span>\u7279\u5b9a\u306e\u7bc4\u56f2\u306e\u30bb\u30eb\u3092\uff11\u3064\u305a\u3064\u51e6\u7406\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">'\u6307\u5b9a\u7bc4\u56f2\u306e\u30bb\u30eb\u3092\uff11\u3064\u305a\u3064\u51e6\u7406\nDim rng = ws.Range(\"E4:F6\")\nFor Each cell in rng.Cells\n    cell.Value = \"(^_^)\"\nNext<\/pre>\n<h2 id=\"i-14\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E6%9B%B8%E5%BC%8F\"><\/span>\u30bb\u30eb\u306e\u66f8\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 id=\"i-15\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E5%89%8D%E6%99%AF%E8%89%B2%EF%BC%88%E6%96%87%E5%AD%97%E8%89%B2%EF%BC%89%E3%81%AE%E5%A4%89%E6%9B%B4\"><\/span>\u30bb\u30eb\u306e\u524d\u666f\u8272\uff08\u6587\u5b57\u8272\uff09\u306e\u5909\u66f4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.Style.Font.FontColor = XLColor.Red<\/pre>\n<h3 id=\"i-16\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E8%83%8C%E6%99%AF%E8%89%B2%E3%81%AE%E5%A4%89%E6%9B%B4\"><\/span>\u30bb\u30eb\u306e\u80cc\u666f\u8272\u306e\u5909\u66f4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.Style.Fill.BackgroundColor = XLColor.Yellow<\/pre>\n<h3 id=\"i-17\"><span class=\"ez-toc-section\" id=\"%E3%83%9C%E3%83%BC%E3%83%AB%E3%83%89\"><\/span>\u30dc\u30fc\u30eb\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.Style.Font.Bold = True<\/pre>\n<h3 id=\"i-18\"><span class=\"ez-toc-section\" id=\"%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E3%82%B5%E3%82%A4%E3%82%BA\"><\/span>\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.Style.Font.FontSize = 15<\/pre>\n<h3 id=\"i-19\"><span class=\"ez-toc-section\" id=\"%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E5%90%8D\"><\/span>\u30d5\u30a9\u30f3\u30c8\u540d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.Style.Font.FontName = \"Century\"<\/pre>\n<h3 id=\"i-20\"><span class=\"ez-toc-section\" id=\"%E3%83%AA%E3%83%83%E3%83%81%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88\"><\/span>\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">For Each richText In cell.RichText\n    If richText.FontColor = XLColor.Red Then\n\n    End If\nNext<\/pre>\n<h3 id=\"i-21\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E5%9E%8B%E3%81%AE%E5%A4%89%E6%9B%B4\"><\/span>\u30bb\u30eb\u306e\u30c7\u30fc\u30bf\u578b\u306e\u5909\u66f4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">cell.DataType = XLCellValues.Text<\/pre>\n<h3 id=\"i-22\"><span class=\"ez-toc-section\" id=\"%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%81%AE%E8%A1%A8%E7%A4%BA%E5%BD%A2%E5%BC%8F%E3%81%AE%E5%A4%89%E6%9B%B4\"><\/span>\u30c6\u30ad\u30b9\u30c8\u306e\u8868\u793a\u5f62\u5f0f\u306e\u5909\u66f4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">cell.Style.DateFormat.Format = \"yyyy\/MM\/dd\"<\/pre>\n<h3 id=\"i-23\"><span class=\"ez-toc-section\" id=\"%E7%BD%AB%E7%B7%9A\"><\/span>\u7f6b\u7dda<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">rng.Style.Border.OutsideBorder = XLBorderStyleValues.Double\nrng.Style.Border.OutsideBorderColor = XLColor.Brown\nrng.Style.Border.InsideBorder = XLBorderStyleValues.Thin\nrng.Style.Border.InsideBorderColor = XLColor.Green<\/pre>\n<h2 id=\"i-24\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E3%81%A8%E5%88%97\"><\/span>\u884c\u3068\u5217<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 id=\"i-25\"><span class=\"ez-toc-section\" id=\"%E5%88%97%E5%B9%85%E3%81%AE%E8%A8%AD%E5%AE%9A\"><\/span>\u5217\u5e45\u306e\u8a2d\u5b9a<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">'\u8907\u6570\u306e\u5217\u5e45\u306e\u8a2d\u5b9a\nws.Columns(\"A,G,I\").Width = 3\n\n'\u30b3\u30f3\u30c6\u30f3\u30c4\u306b\u5408\u308f\u305b\u3066\u5217\u5e45\u3092\u8abf\u6574\nws.Style.Font.FontName = \"\u6e38\u30b4\u30b7\u30c3\u30af\";\nws.Columns.AdjustToContents\n'\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u65e5\u672c\u8a9e\u306e\u5834\u5408\u306f\u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u306b\u3057\u3066\u304a\u304b\u306a\u3044\u3068 AdjustToContents \u304c\u6b63\u3057\u304f\u52d5\u4f5c\u3057\u306a\u3044<\/pre>\n<h3 id=\"i-26\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E3%83%BB%E5%88%97%E3%81%AE%E6%8C%BF%E5%85%A5\"><\/span>\u884c\u30fb\u5217\u306e\u633f\u5165<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">ws.Column(1).InsertColumnsAfter(1)\nws.Range(\"B2:B4\").InsertRowsAbove(2)<\/pre>\n<h3 id=\"i-27\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E3%83%BB%E5%88%97%E3%81%AE%E5%89%8A%E9%99%A4\"><\/span>\u884c\u30fb\u5217\u306e\u524a\u9664<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">range.Row(1).Delete\nrange.Column(1).Delete<\/pre>\n<h2 id=\"i-28\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E3%83%BB%E5%88%97%E3%83%BB%E3%82%BB%E3%83%AB%E3%81%AE%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%81%AF1%E3%83%99%E3%83%BC%E3%82%B9\"><\/span>\u884c\u30fb\u5217\u30fb\u30bb\u30eb\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f1\u30d9\u30fc\u30b9<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>VBA \u3068\u540c\u3058\u3053\u3068\u3067\u3059\u304c\u3001ClosedXML \u3067\u3082\u884c\u30fb\u5217\u30fb\u30bb\u30eb\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f1\u304b\u3089\u958b\u59cb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">Dim val = ws.Row(1).RowUsed.Cell(1).GetString<\/pre>\n<h2 id=\"i-29\"><span class=\"ez-toc-section\" id=\"Property_value_%E3%81%A8_SetPropertyvalue_%E3%81%AE%E4%BD%BF%E3%81%84%E5%88%86%E3%81%91\"><\/span>.Property = value \u3068 .SetProperty(value) \u306e\u4f7f\u3044\u5206\u3051<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Excel VBA \u3067\u306f .Property = value \u3068\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u304c\u304a\u99b4\u67d3\u307f\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">cell.Value = 3<\/pre>\n<p>\u305d\u306e\u30b9\u30bf\u30a4\u30eb\u306f\u3082\u3061\u308d\u3093 ClosedXML \u3067\u3082\u4f7f\u3048\u307e\u3059\u304c\u3001\u305d\u308c\u306b\u52a0\u3048\u3066\uff08\u591a\u304f\u306e\u5834\u5408\uff09ClosedXML \u306b\u306f .SetProperty(value) \u3068\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>.SetProperty(value) \u3068\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u306f\u3001\u8907\u6570\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u8a2d\u5b9a\u3092\u4e00\u5ea6\u306b\uff08\u4e00\u884c\u3067\uff09\u884c\u3046\u306e\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">cell.SetValue(3) _\n    .Style.Fill.SetBackgroundColor(XLColor.Yellow) _\n    .Border.SetOutsideBorder(XLBorderStyleValues.Thick)<\/pre>\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] \u3053\u3053\u3067\u306f\u57fa\u672c\u7684\u306a\u51e6\u7406\u3092\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002 \u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3068\u30ef\u30fc\u30af\u30b7\u30fc\u30c8 \u65b0\u898f\u30ef\u30fc\u30af\u30d6\u30c3\u30af\u306e\u4f5c\u6210\u3068\u4fdd\u5b58 Dim workbook = New XLWorkbook &#8216;\u30ef &#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-11853","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\/11853","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=11853"}],"version-history":[{"count":3,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/11853\/revisions"}],"predecessor-version":[{"id":12947,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/11853\/revisions\/12947"}],"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=11853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}