{"id":557,"date":"2026-04-16T18:19:11","date_gmt":"2026-04-16T10:19:11","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=557"},"modified":"2026-03-23T11:46:19","modified_gmt":"2026-03-23T11:46:19","slug":"how-to-create-pattern-filled-simple-column-chart-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-create-pattern-filled-simple-column-chart-using-xlwings\/","title":{"rendered":"How To Create Pattern Filled Simple Column Chart Using xlwings?"},"content":{"rendered":"<p style=\"margin: 0in; font-size: 16.0pt;\"><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3010<\/span><span lang=\"en-US\" style=\"font-weight: bold; font-family: Calibri;\">Example<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3011<\/span><\/p>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"756\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-07-17.jpg\" alt=\"\" class=\"wp-image-1259\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-07-17.jpg 880w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-07-17-300x258.jpg 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-07-17-768x660.jpg 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/figure>\n\n\n\n<p>\u3010<strong>Code<\/strong>\u3011<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\nimport os\n\ndef set_style(cht):\n    cht.ChartArea.Format.Line.Visible=False\n    cht.PlotArea.Format.Fill.Visible = False\n    cht.PlotArea.Format.Line.Visible = True\n    cht.PlotArea.Format.Line.ForeColor.RGB=xw.utils.rgb_to_int((200,200,200))\n    #cht.PlotArea.Format.Line.ForeColor.ObjectThemeColor = msoThemeColorText1\n    ax1 = cht.Axes(1)\n    ax2 = cht.Axes(2)\n    ax1.HasTitle = True\n    ax1.AxisTitle.Text = 'Categories'\n    ax1.AxisTitle.Font.Size = 10\n    ax1.TickLabels.Font.Size = 8\n    #ax1.TickLabels.NumberFormat = '0.00'\n    ax1.HasMajorGridlines = True\n    ax2.HasTitle = True\n    ax2.AxisTitle.Text = 'Values'\n    ax2.AxisTitle.Font.Size = 10\n    ax2.TickLabels.Font.Size = 8\n    ax2.HasMajorGridlines = True\n    cht.HasTitle = True\n    #cht.ChartTitle.Caption = 'Plot'\n    #cht.ChartTitle.Font.Size = 12\n\nroot=os.getcwd()\napp=xw.App(visible=True,add_book=False)\nwb=app.books.open(root+r'\/data.xlsx',read_only=False)\nsht=wb.sheets('Sheet1')\n\nsht.api.Range('A2:B9').Select()  #\nshp=sht.api.Shapes.AddChart2(-1,xw.constants.ChartType.xlColumnClustered,20,20,350,250,True)\ncht=shp.Chart  #\ncht.ChartGroups(1).GapWidth=40\ncht.SeriesCollection(1).Format.Fill.Patterned(26)\ncht.SeriesCollection(1).Format.Line.ForeColor.RGB=xw.utils.rgb_to_int((0,0,0))\n\nset_style(cht)\n\ncht.Export(root+'\/cht.jpg')\ncht.Export(root+'\/cht.svg')\ncht.ExportAsFixedFormat(0,root+'\/cht.pdf')\n\n#wb.save()\n#app.kill()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"756\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-40.jpg\" alt=\"\" class=\"wp-image-1261\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-40.jpg 880w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-40-300x258.jpg 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-40-768x660.jpg 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-557","post","type-post","status-publish","format-standard","hentry","category-xlwings-chart"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=557"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/557\/revisions"}],"predecessor-version":[{"id":1262,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/557\/revisions\/1262"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}