{"id":81,"date":"2026-02-24T17:46:19","date_gmt":"2026-02-24T09:46:19","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=81"},"modified":"2026-01-17T10:33:22","modified_gmt":"2026-01-17T10:33:22","slug":"how-to-set-face-properties-using-xlwings-multi-color-gradient-fill","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-set-face-properties-using-xlwings-multi-color-gradient-fill\/","title":{"rendered":"How To Set Face Properties Using xlwings? &#8211; Multi-Color Gradient Fill"},"content":{"rendered":"<h2>Method<\/h2>\n<p>shp1=sht.api.Shapes.AddShape(1, 100, 50, 200, 100)\u00a0\u00a0\u00a0 #Rectangular area<\/p>\n<p>ff1=shp1.Fill<\/p>\n<p>ff1.ForeColor.RGB= xw.utils.rgb_to_int((255,0,0))<\/p>\n<p>ff1.OneColorGradient(3, 1, 1)\u00a0\u00a0\u00a0 #One color gradient fill<\/p>\n<p>#Insert color nodes in gradient sequence.<\/p>\n<p>ff1.<b>GradientStops<\/b>.Insert(xw.utils.rgb_to_int((255,0,0)), 0.25)<\/p>\n<p>ff1.GradientStops.Insert(xw.utils.rgb_to_int((0,255,0)), 0.5)<\/p>\n<p>ff1.GradientStops.Insert(xw.utils.rgb_to_int((0,0,255)), 1)<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Area Properties - Pattern Fill\n\nimport xlwings as xw    #Import xlwings package\n\napp=xw.App()\nbk=app.books.active   #Get the active workbook\nsht=bk.sheets.active    #Get the active worksheet\n\nshp1=sht.api.Shapes.AddShape(1, 100, 50, 200, 100)    #Rectangular area\nff1=shp1.Fill\nff1.ForeColor.RGB= xw.utils.rgb_to_int((255,0,0))\nff1.Patterned(22)    #Pattern fill\nff1.BackColor.RGB= xw.utils.rgb_to_int((0,255,0))\n\nshp2=sht.api.Shapes.AddShape(9, 400, 50, 200, 100)    #Elliptical area\nff2=shp2.Fill\nff2.ForeColor.RGB= xw.utils.rgb_to_int((255,255,0))\nff2.Patterned(48)    #Pattern fill\nff2.BackColor.RGB= xw.utils.rgb_to_int((0,0,255))\n\n#bk.save()\n#bk.close()\n#app.kill()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"883\" height=\"482\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-9.png\" alt=\"Set Face Properties Using xlwings? - Multi-Color Gradient Fill\" class=\"wp-image-438\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-9.png 883w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-9-300x164.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-9-768x419.png 768w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-xlwings-shape"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/81","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":439,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/81\/revisions\/439"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}