{"id":76,"date":"2026-02-22T11:23:32","date_gmt":"2026-02-22T03:23:32","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=76"},"modified":"2026-01-17T10:27:06","modified_gmt":"2026-01-17T10:27:06","slug":"how-to-set-line-properties-using-xlwings-transparency","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-set-line-properties-using-xlwings-transparency\/","title":{"rendered":"How To Set Line Properties Using xlwings? &#8211; Transparency"},"content":{"rendered":"<h2>Method<\/h2>\n<p>You can set or get the line&#8217;s transparency using the `Transparency` property of the `LineFormat` object. The value ranges from 0.0 (opaque) to 1.0 (fully transparent).<\/p>\n<p>\u00a0<\/p>\n<p>shp2=sht.api.Shapes.AddLine(100, 125, 400, 125)\u00a0\u00a0\u00a0 #Second line segment<\/p>\n<p>shp2.Line.Weight=8\u00a0\u00a0\u00a0 #Line width<\/p>\n<p>shp2.Line.ForeColor.RGB=xw.utils.rgb_to_int((255,0,0))\u00a0\u00a0\u00a0 #Red<\/p>\n<p>shp2.Line.Transparency=0.7\u00a0\u00a0\u00a0 #Transparency 0.7<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Line properties - Transparency\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\nsht.api.Shapes.AddShape(9, 150, 50, 200, 100)    #Elliptical area\nshp=sht.api.Shapes.AddLine(100, 75, 400, 75)    #First line segment\nshp.Line.Weight=8    #Line width\nshp.Line.ForeColor.RGB=xw.utils.rgb_to_int((255,0,0))    #Red\n\nshp2=sht.api.Shapes.AddLine(100, 125, 400, 125)    #Second line segment\nshp2.Line.Weight=8    #Line width\nshp2.Line.ForeColor.RGB=xw.utils.rgb_to_int((255,0,0))    #Red\nshp2.Line.Transparency=0.7    #Transparency 0.7\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=\"792\" height=\"482\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-4.png\" alt=\"Set Line Properties Using xlwings? - Transparency\" class=\"wp-image-426\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-4.png 792w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-4-300x183.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/image-4-768x467.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/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-76","post","type-post","status-publish","format-standard","hentry","category-xlwings-shape"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/76","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=76"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":427,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/76\/revisions\/427"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}