{"id":1084,"date":"2022-08-30T15:12:07","date_gmt":"2022-08-30T15:12:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/how-to-set-the-width-as-undefined-in-powerpoint-textbox-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:12:07","modified_gmt":"2022-08-30T15:12:07","slug":"how-to-set-the-width-as-undefined-in-powerpoint-textbox-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-set-the-width-as-undefined-in-powerpoint-textbox-collection-of-common-programming-errors\/","title":{"rendered":"How to set the width as undefined in powerpoint textbox-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to set the width of a textbox as undefined so it will behave as autofit in powerPoint 2007 I use the following:<\/p>\n<pre><code>shape = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, left, top, 0f, 0f);\n<\/code><\/pre>\n<p>And it look fine on the slide in pp-2007 But when I open the presentation in pp-2010 I get all the characters of the text wraped under each other. This is maybe to be expected when you set the width as 0 but it looks fine in pp-2007. I also use the following but it dose not help:<\/p>\n<pre><code>shape.AutoSize = PpAutoSize.ppAutoSizeShapeToFitText;\n<\/code><\/pre>\n<p>I tried it also like this:<\/p>\n<pre><code>shape = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, left, top, float.NaN, 0f);\n<\/code><\/pre>\n<p>But that only gives me a very long textbox<\/p>\n<p>Can anyone help me on this?<\/p>\n<ol>\n<li>\n<p>You should disable word wrap then PowerPoint will size the text box as required:<\/p>\n<pre><code>shape.TextFrame.AutoSize = ppAutoSizeShapeToFitText\nshape.TextFrame.WordWrap = msoFalse\nshape.TextFrame.TextRange.Text = \"Text\"\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:22:08. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am trying to set the width of a textbox as undefined so it will behave as autofit in powerPoint 2007 I use the following: shape = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, left, top, 0f, 0f); And it look fine on the slide in pp-2007 But when I open the presentation in pp-2010 I get all the characters of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1084","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1084"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1084\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}