Note that there are some explanatory texts on larger screens.

plurals
  1. POSet overflow in a powerpoint shape
    primarykey
    data
    text
    <p>So, I have a shape I'm programatically generating, when it has a small amount of text, it looks like this:</p> <p><img src="https://i.stack.imgur.com/0794k.png" alt="Style is correct, vertically aligned to top"></p> <p>If I add a huge amount of text however, it flows out of the shape, like so:</p> <p><img src="https://i.stack.imgur.com/5r6t4.png" alt="Vertical alignment starts outside of boundaries"></p> <p>What I want to do is to hide the overflow and to force the text to start from the top of the shape (currently the text starts from a position higher than the top of the shape)</p> <p>I haven't found much information about this so far, here is the code I'm using for the text inside the shape:</p> <pre><code>var shape = slide.Shapes.AddShape(MsoAutoShapeType.msoShapeRectangle, left, top, width, height); var textRange2 = shape.TextFrame.TextRange.InsertAfter(description); textRange2.Font.Size = 10; shape.TextFrame.TextRange.Paragraphs().ParagraphFormat.Alignment = PpParagraphAlignment.ppAlignLeft; shape.TextFrame.TextRange.Paragraphs().Font.Name = "Consolas"; shape.TextFrame.TextRange.Paragraphs().Font.Color.RGB = foregroundColor; </code></pre> <p>One last thing, I know I could just limit the string, but this would impose problems for the user. I want him to be able to resize the shape manually if there is too much text, so that's a no-go. Basically, I just want the equivalent of the css overflow:hidden rule.</p> <p>One option for some users may be to use the following:</p> <pre><code>shape.TextFrame.AutoSize = PpAutoSize.ppAutoSizeShapeToFitText; </code></pre> <p>This will resize the shape to fit the text, there should also be an option to resize TEXT to fit the shape instead (resizing of fonts), I can't seem to find the function however.</p> <p>Thanks guys</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload