{"id":11998,"date":"2019-07-17T09:28:28","date_gmt":"2019-07-17T00:28:28","guid":{"rendered":"https:\/\/elleneast.com\/?p=11998"},"modified":"2019-07-17T09:28:28","modified_gmt":"2019-07-17T00:28:28","slug":"%e3%80%90vb-net%e3%80%91closedxml%ef%bc%9a%e3%82%bb%e3%83%ab%e3%81%ae%e6%9b%b8%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/elleneast.com\/?p=11998","title":{"rendered":"\u3010VB.NET\u3011ClosedXML\uff1a\u30bb\u30eb\u306e\u66f8\u5f0f"},"content":{"rendered":"[include-page id=\u201d11760\u2033]\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=11998\/#%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88\" >\u30d5\u30a9\u30f3\u30c8<\/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=11998\/#%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\" >\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E3%82%BB%E3%83%AB%E3%81%AE%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\" >\u30bb\u30eb\u306e\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<\/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=11998\/#%E8%A1%8C%E5%85%A8%E4%BD%93%E3%80%81%E5%88%97%E5%85%A8%E4%BD%93%E3%81%AE%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\" >\u884c\u5168\u4f53\u3001\u5217\u5168\u4f53\u306e\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E3%82%AB%E3%83%A9%E3%83%BC\" >\u30ab\u30e9\u30fc<\/a><\/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=11998\/#%E3%83%AA%E3%83%83%E3%83%81%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88RichText%E3%81%AE%E6%93%8D%E4%BD%9C\" >\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8(RichText)\u306e\u64cd\u4f5c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E6%95%B0%E5%AD%97%E3%81%AE%E8%A1%A8%E7%A4%BA%E5%BD%A2%E5%BC%8F\" >\u6570\u5b57\u306e\u8868\u793a\u5f62\u5f0f<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/elleneast.com\/?p=11998\/#NumberFormatId_%E3%81%AE_ID_%E4%B8%80%E8%A6%A7\" >NumberFormatId \u306e ID \u4e00\u89a7<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E9%85%8D%E7%BD%AE%EF%BC%88%E3%82%A2%E3%83%A9%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%B3%E3%83%88%EF%BC%89\" >\u914d\u7f6e\uff08\u30a2\u30e9\u30a4\u30f3\u30e1\u30f3\u30c8\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E7%BD%AB%E7%B7%9A\" >\u7f6b\u7dda<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/elleneast.com\/?p=11998\/#%E3%82%BB%E3%83%AB%E3%81%AE%E6%9B%B8%E5%BC%8F%E3%82%92%E5%88%9D%E6%9C%9F%E5%8C%96%E3%81%99%E3%82%8B\" >\u30bb\u30eb\u306e\u66f8\u5f0f\u3092\u521d\u671f\u5316\u3059\u308b<\/a><\/li><\/ul><\/nav><\/div>\n<h2 id=\"i-0\"><span class=\"ez-toc-section\" id=\"%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88\"><\/span>\u30d5\u30a9\u30f3\u30c8<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_39.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12001 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_39.png\" alt=\"\" width=\"268\" height=\"305\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_39.png 268w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_39-264x300.png 264w\" sizes=\"auto, (max-width: 268px) 100vw, 268px\"><\/a><\/p>\n<pre class=\"lang:vbnet decode:true \">Dim workbook = new XLWorkbook\nDim ws = workbook.Worksheets.Add(\"\u30d5\u30a9\u30f3\u30c8\")\n\nDim co = 2\nDim ro = 1\n\nro += 1\nws.Cell(ro, co).Value = \"Bold\"\nws.Cell(ro, co).Style.Font.Bold = True\n\nro += 1\nws.Cell(ro, co).Value = \"FontColor - Red\"\nws.Cell(ro, co).Style.Font.FontColor = XLColor.Red\n\nro += 1\nws.Cell(ro, co).Value = \"FontFamilyNumbering - Script\"\nws.Cell(ro, co).Style.Font.FontFamilyNumbering = XLFontFamilyNumberingValues.Script\n\nro += 1\nws.Cell(ro, co).Value = \"FontName - Stencil\"\nws.Cell(ro, co).Style.Font.FontName = \"Stencil\"\n\nro += 1\nws.Cell(ro, co).Value = \"FontSize - 15\"\nws.Cell(ro, co).Style.Font.FontSize = 15\n\nro += 1\nws.Cell(ro, co).Value = \"Italic - True\"\nws.Cell(ro, co).Style.Font.Italic = True\n\nro += 1\nws.Cell(ro, co).Value = \"Shadow - True\"\nws.Cell(ro, co).Style.Font.Shadow = True\n\nro += 1\nws.Cell(ro, co).Value = \"Strikethrough - True\"\nws.Cell(ro, co).Style.Font.Strikethrough = True\n\nro += 1\nws.Cell(ro, co).Value = \"Underline - Double\"\nws.Cell(ro, co).Style.Font.Underline = XLFontUnderlineValues.Double\n\nro += 1\nws.Cell(ro, co).Value = \"VerticalAlignment = Superscript\"\nws.Cell(ro, co).Style.Font.VerticalAlignment = XLFontVerticalTextAlignmentValues.Superscript\n\nws.Column(co).AdjustToContents\n\nworkbook.SaveAs(\"D:\\test\\StylesFont.xlsx\")<\/pre>\n<h2 id=\"i-1\"><span class=\"ez-toc-section\" id=\"%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\"><\/span>\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 id=\"i-2\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\"><\/span>\u30bb\u30eb\u306e\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true \">Dim workbook = New XLWorkbook\nDim ws = workbook.Worksheets.Add(\"Style Fill\")\n\nDim co = 2\nDim ro = 1\n\nws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Red\nws.Cell(ro, co).CellRight.Value = \"BackgroundColor=Red\"\n\nro += 1\nws.Cell(ro, co).Style.Fill.PatternType = XLFillPatternValues.DarkTrellis\nws.Cell(ro, co).Style.Fill.PatternColor = XLColor.Orange\nws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Blue\nws.Cell(ro, co).CellRight.Value = \"PatternType=DarkTrellis; PatternColor=Orange; BackgroundColor=Blue\"\n\nworkbook.SaveAs(\"D:\\test\\Styles_Fill.xlsx\")<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_38.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11994 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_38.png\" alt=\"\" width=\"534\" height=\"79\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_38.png 534w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_38-300x44.png 300w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\"><\/a><\/p>\n<h3 id=\"i-3\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E5%85%A8%E4%BD%93%E3%80%81%E5%88%97%E5%85%A8%E4%BD%93%E3%81%AE%E5%A1%97%E3%82%8A%E3%81%A4%E3%81%B6%E3%81%97%EF%BC%88%E8%83%8C%E6%99%AF%E8%89%B2%EF%BC%89\"><\/span>\u884c\u5168\u4f53\u3001\u5217\u5168\u4f53\u306e\u5857\u308a\u3064\u3076\u3057\uff08\u80cc\u666f\u8272\uff09<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:vbnet decode:true\">ws.Row(6).Style.Fill.BackgroundColor = XLColor.Brown\nws.Rows(2, 3).Style.Fill.BackgroundColor = XLColor.Blue\nws.Column(\"E\").Style.Fill.BackgroundColor = XLColor.Gray\nws.Columns(3, 4).Style.Fill.BackgroundColor = XLColor.Orange<\/pre>\n<h2 id=\"i-4\"><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%83%A9%E3%83%BC\"><\/span>\u30ab\u30e9\u30fc<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u30ab\u30e9\u30fc\u306e\u69d8\u3005\u306a\u6307\u5b9a\u65b9\u6cd5\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">'Known color\nws.Cell(1, 1).Style.Fill.BackgroundColor = XLColor.Red\n\n'FromArgb\uff0816\u9032\u3067\u6307\u5b9a\uff09\nws.Cell(2, 1).Style.Fill.BackgroundColor = XLColor.FromArgb(&amp;HFF00FF)\n\n'FromArgb\uff08\u6574\u6570\u3067\u6307\u5b9a\uff09\nws.Cell(3, 1).Style.Fill.BackgroundColor = XLColor.FromArgb(16711935)\n\n'FromArgb(r, g, b)\nws.Cell(4, 1).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 0, 255)\n\n'FromArgb(a, r, g, b)\n'\u6ce8\u610f\uff1aExcel \u3067\u306f alpha \u5024\u304c\u7121\u8996\u3055\u308c\u307e\u3059\nws.Cell(5, 1).Style.Fill.BackgroundColor = XLColor.FromArgb(0, 255, 0, 255)\n\n'FromColor(Color)\nws.Cell(6, 1).Style.Fill.BackgroundColor = XLColor.FromColor(Color.Red)\n\n'FromHtml(htmlColor)\nws.Cell(7, 1).Style.Fill.BackgroundColor = XLColor.FromHtml(\"#FF996515\")\n\n'FromIndex(indexedColor)\nws.Cell(8, 1).Style.Fill.BackgroundColor = XLColor.FromIndex(25)\n\n'FromKnownColor(KnownColor)\nws.Cell(9, 1).Style.Fill.BackgroundColor = XLColor.FromKnownColor(KnownColor.Plum)\n\n'FromName(colorName)\nws.Cell(10, 1).Style.Fill.BackgroundColor = XLColor.FromName(\"PowderBlue\")\n\n\n'From Theme color\nws.Cell(11, 1).Style.Fill.BackgroundColor = XLColor.FromTheme(XLThemeColor.Accent1)\n\n'From Theme color\uff08\u8272\u5408\u3044\u3092\u6307\u5b9a\uff09\nws.Cell(12, 1).Style.Fill.BackgroundColor = XLColor.FromTheme(XLThemeColor.Accent1, 0.5)<\/pre>\n<p>\uff08\u53c2\u8003\uff09<a href=\"https:\/\/github.com\/closedxml\/closedxml\/wiki\/ClosedXML-Predefined-Colors\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub \u2013 ClosedXML \u2013 ClosedXML \u306e\u5b9a\u7fa9\u6e08\u307f\u30ab\u30e9\u30fc<\/a><\/p>\n<p>\uff08\u53c2\u8003\uff09<a href=\"https:\/\/github.com\/closedxml\/closedxml\/wiki\/Excel-Indexed-Colors\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub \u2013 ClosedXML \u2013 Excel \u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30ab\u30e9\u30fc<\/a><\/p>\n<h2 id=\"i-5\"><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%88RichText%E3%81%AE%E6%93%8D%E4%BD%9C\"><\/span>\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8(RichText)\u306e\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u307e\u305a\u30bb\u30eb\u306b\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true \">Dim cell1 = ws.Cell(1, 1).SetValue(\"The show must go on...\")<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_41.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12035 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_41.png\" alt=\"\" width=\"244\" height=\"68\"><\/a><\/p>\n<p>\u30bb\u30eb\u306e\u30c6\u30ad\u30b9\u30c8\u5168\u4f53\u3092\u9752\u8272\u306b\u3057\u3001\u305d\u306e\u5f8c\u3067 \u201cshow\u201d \u3092\u8d64\u8272\u306b\u3057\u3066\u30d5\u30a9\u30f3\u30c8\u3092 \u201cBroadway\u201d \u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true \">'\u30bb\u30eb\u306e\u30c6\u30ad\u30b9\u30c8\u5168\u4f53\u3092\u9752\u8272\u306b\ncell1.Style.Font.FontColor = XLColor.Blue\n' \"show\" \u306e\u8272\u3068\u30d5\u30a9\u30f3\u30c8\u3092\u5909\u66f4\ncell1.RichText.Substring(4, 4) _\n    .SetFontColor(XLColor.Red) _\n    .SetFontName(\"Broadway\")<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_42.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12037 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_42.png\" alt=\"\" width=\"254\" height=\"70\"><\/a><\/p>\n<p>\u5225\u306e\u30bb\u30eb\u306b\u5bfe\u3057\u3066\u3001\u30c6\u30ad\u30b9\u30c8\u306e\u5165\u529b\u3068\u88c5\u98fe\u3092\u540c\u6642\u306b\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">Dim cell2 = ws.Cell(3, 1)\n\ncell2.RichText _\n  .AddText(\"Hello\").SetFontColor(XLColor.Red) _\n  .AddText(\" BIG \").SetFontColor(XLColor.Blue).SetBold _\n  .AddText(\"World\").SetFontColor(XLColor.Red)<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_43.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12033 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_43.png\" alt=\"\" width=\"253\" height=\"122\"><\/a><\/p>\n<p>\u5165\u529b\u3057\u305f\u306e\u306f\uff13\u3064\u306e\u5358\u8a9e\u3067\u3059\u304c\u3001\u4e00\u7d9a\u304d\u306e\u6587\u5b57\u5217\u3068\u3057\u3066\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">cell2.RichText.Substring(4, 7).SetUnderline '\u4e0b\u7dda\u3092\u4ed8\u3051\u308b<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_44.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12034 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_44.png\" alt=\"\" width=\"255\" height=\"114\"><\/a><\/p>\n<p>\u73fe\u5728\u3001\u4e0a\u56f3\u306e A3 \u30bb\u30eb\u306e RichText \u306f\u6b21\u306e\uff15\u3064\u306e\u8981\u7d20\u304b\u3089\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u201cHell\u201d\uff08\u8d64\u8272\uff09<\/li>\n<li>\u201co\u201d\uff08\u8d64\u8272\u3001\u4e0b\u7dda\uff09<\/li>\n<li>\u201d BIG \u201c\uff08\u9752\u8272\u3001\u4e0b\u7dda\u3001\u30dc\u30fc\u30eb\u30c9\uff09<\/li>\n<li>\u201cW\u201d\uff08\u8d64\u8272\u3001\u4e0b\u7dda\uff09<\/li>\n<li>\u201corld\u201d\uff08\u8d64\u8272\uff09<\/li>\n<\/ol>\n<p>\u6b21\u306e\u30b3\u30fc\u30c9\u3067\u3053\u308c\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">Dim row As Integer = 3\nFor Each richText In cell2.RichText\n    If richText.FontColor = XLColor.Red Then\n        ws.Cell(row, 2).Value = $\"\"\"{richText.Text}\"\" \u306f\u8d64\u8272\"\n        row += 1\n    End If\n    If richText.FontColor = XLColor.Blue Then\n        ws.Cell(row, 2).Value = $\"\"\"{richText.Text}\"\" \u306f\u9752\u8272\"\n        row += 1\n    End If\n    If richText.Underline = XLFontUnderlineValues.Single Then\n        ws.Cell(row, 2).Value = $\"\"\"{richText.Text}\"\" \u306f\u4e0b\u7dda\u4ed8\u304d\"\n        row += 1\n    End If\n    If richText.Bold Then\n        ws.Cell(row, 2).Value = $\"\"\"{richText.Text}\"\" \u306f\u30dc\u30fc\u30eb\u30c9\"\n        row += 1\n    End If\nNext<\/pre>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_45.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12036 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_45.png\" alt=\"\" width=\"420\" height=\"317\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_45.png 420w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_45-300x226.png 300w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\"><\/a><\/p>\n<h2 id=\"i-6\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E5%AD%97%E3%81%AE%E8%A1%A8%E7%A4%BA%E5%BD%A2%E5%BC%8F\"><\/span>\u6570\u5b57\u306e\u8868\u793a\u5f62\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_40.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12007 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_40.png\" alt=\"\" width=\"137\" height=\"139\"><\/a><\/p>\n<pre class=\"lang:vbnet decode:true  \">Dim workbook = new XLWorkbook\nDim ws = workbook.Worksheets.Add(\"Style NumberFormat\")\n\nDim co = 2\nDim ro = 1\n\n'\u30ab\u30b9\u30bf\u30e0\u306e\u66f8\u5f0f\nro += 1\nws.Cell(ro, co).Value = \"123456.789\"\nws.Cell(ro, co).Style.NumberFormat.Format = \"$ #,##0.00\"\n\nro += 1\nws.Cell(ro, co).Value = \"12.345\"\nws.Cell(ro, co).Style.NumberFormat.Format = \"0000\"\n\n'OpenXML \u306e\u5b9a\u7fa9\u6e08\u307f\u66f8\u5f0f (.NumberFormatId)\nro += 1\nws.Cell(ro, co).Value = \"12.345\"\nws.Cell(ro, co).Style.NumberFormat.NumberFormatId = 3\n\n'XLPredefinedFormat \u5217\u6319\u578b\nro += 1\nws.Cell(ro, co).Value = \"123456789123\"\nws.Cell(ro, co).Style.NumberFormat.SetNumberFormatId(XLPredefinedFormat.Number.Integer)\n\nws.Column(co).AdjustToContents\n\nworkbook.SaveAs(\"D:\\test\\StylesNumberFormat.xlsx\")<\/pre>\n<p>NumberFormatId \u306b\u6307\u5b9a\u3067\u304d\u308b ID \u306e\u4e00\u89a7\u306b\u3064\u3044\u3066\u306f\u300cNumberFormatId \u306e ID \u4e00\u89a7\u300d\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3 id=\"i-7\"><span class=\"ez-toc-section\" id=\"NumberFormatId_%E3%81%AE_ID_%E4%B8%80%E8%A6%A7\"><\/span>NumberFormatId \u306e ID \u4e00\u89a7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>OpenXML \u3067\u306f\u65e5\u4ed8\u3068\u6570\u5024\u306b\u3064\u3044\u3066\u306e\u5b9a\u7fa9\u6e08\u307f\u66f8\u5f0f\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001.NumberFormatId \u306b\u305d\u306e ID \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">range.Style.NumberFormat.NumberFormatId = 2<\/pre>\n<p>\u5b9f\u969b\u306b\u8868\u793a\u3055\u308c\u308b\u30c6\u30ad\u30b9\u30c8\u306f\u305d\u306e\u74b0\u5883\u306e\u30ab\u30eb\u30c1\u30e3\u306b\u5f71\u97ff\u3055\u308c\u308b\u70b9\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305f\u3068\u3048\u3070 NumberFormatId = 2 \u306e\u5834\u5408\u3001\u30ab\u30eb\u30c1\u30e3\u304c JP\uff08\u65e5\u672c\uff09\u306e\u74b0\u5883\u3067\u306f\u5c0f\u6570\u70b9\u304c\u30c9\u30c3\u30c8\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u30ab\u30eb\u30c1\u30e3\u304c DE\uff08\u30c9\u30a4\u30c4\uff09\u306e\u74b0\u5883\u3067\u306f\u30ab\u30f3\u30de\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\">\n<thead>\n<tr>\n<th style=\"background-color: #cccccc;\">ID<\/th>\n<th style=\"background-color: #cccccc;\">\u8868\u793a\u5f62\u5f0f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0<\/td>\n<td>General<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>0.00<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>#,##0<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>#,##0.00<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>0%<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>0.00%<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>0.00E+00<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td># ?\/?<\/td>\n<\/tr>\n<tr>\n<td>13<\/td>\n<td># ??\/??<\/td>\n<\/tr>\n<tr>\n<td>14<\/td>\n<td>d\/m\/yyyy<\/td>\n<\/tr>\n<tr>\n<td>15<\/td>\n<td>d-mmm-yy<\/td>\n<\/tr>\n<tr>\n<td>16<\/td>\n<td>d-mmm<\/td>\n<\/tr>\n<tr>\n<td>17<\/td>\n<td>mmm-yy<\/td>\n<\/tr>\n<tr>\n<td>18<\/td>\n<td>h:mm tt<\/td>\n<\/tr>\n<tr>\n<td>19<\/td>\n<td>h:mm:ss tt<\/td>\n<\/tr>\n<tr>\n<td>20<\/td>\n<td>H:mm<\/td>\n<\/tr>\n<tr>\n<td>21<\/td>\n<td>H:mm:ss<\/td>\n<\/tr>\n<tr>\n<td>22<\/td>\n<td>m\/d\/yyyy H:mm<\/td>\n<\/tr>\n<tr>\n<td>37<\/td>\n<td>#,##0 ;(#,##0)<\/td>\n<\/tr>\n<tr>\n<td>38<\/td>\n<td>#,##0 ;[Red](#,##0)<\/td>\n<\/tr>\n<tr>\n<td>39<\/td>\n<td>#,##0.00;(#,##0.00)<\/td>\n<\/tr>\n<tr>\n<td>40<\/td>\n<td>#,##0.00;[Red](#,##0.00)<\/td>\n<\/tr>\n<tr>\n<td>45<\/td>\n<td>mm:ss<\/td>\n<\/tr>\n<tr>\n<td>46<\/td>\n<td>[h]:mm:ss<\/td>\n<\/tr>\n<tr>\n<td>47<\/td>\n<td>mmss.0<\/td>\n<\/tr>\n<tr>\n<td>48<\/td>\n<td>##0.0E+0<\/td>\n<\/tr>\n<tr>\n<td>49<\/td>\n<td>@<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"i-8\"><span class=\"ez-toc-section\" id=\"%E9%85%8D%E7%BD%AE%EF%BC%88%E3%82%A2%E3%83%A9%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%B3%E3%83%88%EF%BC%89\"><\/span>\u914d\u7f6e\uff08\u30a2\u30e9\u30a4\u30f3\u30e1\u30f3\u30c8\uff09<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:vbnet decode:true \">ws.Cell(\"A1\").SetValue(\"\u53f3\u63c3\u3048\u30fb\u4e0b\u63c3\u3048\").Style _\n    .Alignment.SetVertical(XLAlignmentVerticalValues.Bottom) _\n    .Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)<\/pre>\n<h2 id=\"i-9\"><span class=\"ez-toc-section\" id=\"%E7%BD%AB%E7%B7%9A\"><\/span>\u7f6b\u7dda<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:vbnet decode:true\">Dim workbook = new XLWorkbook\nDim ws = workbook.Worksheets.Add(\"\u7f6b\u7dda\")\n\nDim co = 2\nDim ro = 1\n\nro += 1\nws.Cell(ro, co).Value = \"LeftBorder=Thick; LeftBorderColor=Blue; BottomBorder=Thick; BottomBorderColor=Red\"\nws.Cell(ro, co).Style.Border.LeftBorder = XLBorderStyleValues.Thick\nws.Cell(ro, co).Style.Border.LeftBorderColor = XLColor.Blue\nws.Cell(ro, co).Style.Border.BottomBorder = XLBorderStyleValues.Thick\nws.Cell(ro, co).Style.Border.BottomBorderColor = XLColor.Red\n\nro += 2\nws.Cell(ro, co).Value = \"DiagonalBorder=Thin; DiagonalBorderColor=Red; DiagonalUp=True; DiagonalDown=True\"\nws.Cell(ro, co).Style.Border.DiagonalBorder = XLBorderStyleValues.Thin\nws.Cell(ro, co).Style.Border.DiagonalBorderColor = XLColor.Red\nws.Cell(ro, co).Style.Border.DiagonalUp = True\nws.Cell(ro, co).Style.Border.DiagonalDown = True\n\nro += 2\nDim rng = ws.Range(ro, co, ro+1, co+1)\nws.Cell(ro, co).Value = \"OutsideBorder=Double;\"\nws.Cell(ro, co).CellRight.Value = \"InsideBorder=Thin;\"\nws.Cell(ro, co).CellBelow.Value = \"OutsideBorderColor=Brown\"\nws.Cell(ro, co).CellBelow.CellRight.Value = \"InsideBorderColor=Green\"\nrng.Style.Border.OutsideBorder = XLBorderStyleValues.Double\nrng.Style.Border.OutsideBorderColor = XLColor.Brown\nrng.Style.Border.InsideBorder = XLBorderStyleValues.Thin\nrng.Style.Border.InsideBorderColor = XLColor.Green\n\nworkbook.SaveAs(\"D:\\test\\StylesBorder.xlsx\")<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_37b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11991 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_37b.png\" alt=\"\" width=\"915\" height=\"199\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_37b.png 915w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_37b-300x65.png 300w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/ClosedXML\/ClosedXml_37b-768x167.png 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\"><\/a><\/p>\n<h2 id=\"i-10\"><span class=\"ez-toc-section\" id=\"%E3%82%BB%E3%83%AB%E3%81%AE%E6%9B%B8%E5%BC%8F%E3%82%92%E5%88%9D%E6%9C%9F%E5%8C%96%E3%81%99%E3%82%8B\"><\/span>\u30bb\u30eb\u306e\u66f8\u5f0f\u3092\u521d\u671f\u5316\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u30bb\u30eb\u306e\u66f8\u5f0f\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30b9\u30bf\u30a4\u30eb\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">ws.Cell(2, 1).Style = XLWorkbook.DefaultStyle<\/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] \u30d5\u30a9\u30f3\u30c8 Dim workbook = new XLWorkbook Dim ws = workbook.Worksheets.Add(&#8220;\u30d5\u30a9\u30f3\u30c8&#8221;) Dim co = &#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-11998","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\/11998","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=11998"}],"version-history":[{"count":3,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/11998\/revisions"}],"predecessor-version":[{"id":12423,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/11998\/revisions\/12423"}],"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=11998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}