{"id":2123,"date":"2026-06-14T07:26:19","date_gmt":"2026-06-13T23:26:19","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2123"},"modified":"2026-03-28T07:19:12","modified_gmt":"2026-03-28T07:19:12","slug":"how-to-use-applicationhighqualitymodeforgraphics-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationhighqualitymodeforgraphics-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.HighQualityModeForGraphics in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>Application.HighQualityModeForGraphics<\/code> property in Excel, when accessed through the xlwings library, provides control over a performance optimization setting specifically for graphics rendering. This feature is particularly relevant when dealing with workbooks that contain a large number of charts, shapes, or other graphic elements. Enabling high-quality mode can improve the visual fidelity of graphics during screen updates and printing, but it may come at the cost of increased memory usage and potentially slower performance, especially on complex documents. The property allows developers to programmatically balance visual quality against application responsiveness based on the specific needs of their automation script or add-in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax and Parameters<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, you interact with this property through the <code>Application<\/code> object. The property is a read\/write Boolean.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Getting the current setting\ncurrent_setting = xw.apps&#91;0].api.HighQualityModeForGraphics\n\n# Setting a new value\nxw.apps&#91;0].api.HighQualityModeForGraphics = True # or False<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Member Access:<\/strong> The property is accessed via the <code>.api<\/code> attribute of the xw.apps object. This <code>.api<\/code> gateway provides direct access to the underlying Excel object model, allowing you to use the native property names as defined in the VBA documentation.<\/li>\n\n\n\n<li><strong>Property Type:<\/strong> Boolean (<code>bool<\/code>).<\/li>\n\n\n\n<li><strong>Values:<\/strong><\/li>\n\n\n\n<li><code>True<\/code>: Enables high-quality mode for graphics. Excel uses more memory to cache graphic elements, aiming for better rendering quality.<\/li>\n\n\n\n<li><code>False<\/code> (Default): Disables high-quality mode, favoring performance and lower memory consumption. Graphics might be rendered with lower detail during rapid screen changes.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Code Examples<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are practical examples demonstrating how to use this property with xlwings:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Checking the Current Status:<\/strong><br>This is useful for diagnostics or for conditionally adjusting other settings.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active instance of Excel\napp = xw.apps.active\n\n# Get the current HighQualityModeForGraphics setting\nhq_setting = app.api.HighQualityModeForGraphics\nprint(f\"High Quality Mode for Graphics is currently: {hq_setting}\")<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Enabling High-Quality Mode for a Printing Routine:<\/strong><br>Temporarily enable high-quality graphics before a print job to ensure the best output, then restore the original setting.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\nwb = app.books.active\n\n# Store the original setting\noriginal_setting = app.api.HighQualityModeForGraphics\n\ntry:\n    # Enable high-quality mode for printing\n    app.api.HighQualityModeForGraphics = True\n    print(\"High-quality mode enabled for printing.\")\n\n    # Perform the print action (e.g., print the active sheet)\n    wb.api.ActiveSheet.PrintOut()\n\nfinally:\n    # Restore the original setting reliably, even if an error occurs during printing\n    app.api.HighQualityModeForGraphics = original_setting\n    print(f\"High-quality mode restored to: {original_setting}\")<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Optimizing Performance for a Data Processing Macro:<\/strong><br>If your script is primarily manipulating data and doesn&#8217;t require perfect graphic rendering during the process, disabling this mode can improve speed.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\noriginal_setting = app.api.HighQualityModeForGraphics\n\n# Disable high-quality mode for faster processing\napp.api.HighQualityModeForGraphics = False\n\n# ... Perform intensive data operations, chart updates, or shape manipulations ...\n\n# Restore the setting after operations are complete\napp.api.HighQualityModeForGraphics = original_setting<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The `Application.HighQualityModeForGraphics` property in Excel, when accessed through the xlwings li&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2123","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2123","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=2123"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2123\/revisions"}],"predecessor-version":[{"id":3246,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2123\/revisions\/3246"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}