{"id":77,"date":"2026-02-22T17:49:39","date_gmt":"2026-02-22T09:49:39","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=77"},"modified":"2026-01-17T10:28:18","modified_gmt":"2026-01-17T10:28:18","slug":"how-to-set-line-properties-using-xlwings-pattern-fill","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-set-line-properties-using-xlwings-pattern-fill\/","title":{"rendered":"How To Set Line Properties Using xlwings? &#8211; Pattern Fill"},"content":{"rendered":"<h2>Method<\/h2>\n<p>You can apply a pattern fill to a line object using the `Pattern` property of the `LineFormat` object. This property sets or returns an `MsoPatternType` enumeration value, which defines the pattern of the fill.<\/p>\n<p>\u00a0<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p>Name<\/p>\n<\/td>\n<td>\n<p>Value<\/p>\n<\/td>\n<td>\n<p>Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternCross<\/p>\n<\/td>\n<td>\n<p>51<\/p>\n<\/td>\n<td>\n<p>Crosshatch pattern<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternDarkDownwardDiagonal<\/p>\n<\/td>\n<td>\n<p>15<\/p>\n<\/td>\n<td>\n<p>Dark downward diagonal<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternDarkHorizontal<\/p>\n<\/td>\n<td>\n<p>13<\/p>\n<\/td>\n<td>\n<p>Dark horizontal lines<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternDarkUpwardDiagonal<\/p>\n<\/td>\n<td>\n<p>16<\/p>\n<\/td>\n<td>\n<p>Dark upward diagonal<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternDarkVertical<\/p>\n<\/td>\n<td>\n<p>14<\/p>\n<\/td>\n<td>\n<p>Dark vertical lines<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternHorizontal<\/p>\n<\/td>\n<td>\n<p>49<\/p>\n<\/td>\n<td>\n<p>Horizontal lines<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternVertical<\/p>\n<\/td>\n<td>\n<p>50<\/p>\n<\/td>\n<td>\n<p>Vertical lines<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternSmallGrid<\/p>\n<\/td>\n<td>\n<p>23<\/p>\n<\/td>\n<td>\n<p>Small grid pattern<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>msoPatternWave<\/p>\n<\/td>\n<td>\n<p>48<\/p>\n<\/td>\n<td>\n<p>Wavy lines<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u2026\u2026<\/p>\n<\/td>\n<td>\n<p>\u00a0<\/p>\n<\/td>\n<td>\n<p>\u00a0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p>\n<p>shp=sht.api.Shapes.AddLine(100, 55, 400, 125)<\/p>\n<p>shp.Line.Weight=8<\/p>\n<p>shp.Line.Pattern=16\u00a0\u00a0\u00a0 #Set pattern fill for line segments<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Line 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\nshp=sht.api.Shapes.AddLine(100, 55, 400, 125)\nshp.Line.Weight=8\nshp.Line.Pattern=16    #Set pattern fill for line segments\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=\"790\" height=\"482\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-5.png\" alt=\"How To Set Line Properties Using xlwings? - Pattern Fill\" class=\"wp-image-428\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-5.png 790w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-5-300x183.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-5-768x469.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/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-77","post","type-post","status-publish","format-standard","hentry","category-xlwings-shape"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/77","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=77"}],"version-history":[{"count":3,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":430,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/77\/revisions\/430"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}