“shrink text on overflow” when creating powerpoint presentation from C# RRS feed

  • Question

  • I have a small but annoying problem concerning maniupulating powerpoint presentations from C# (via Microsoft.Office.Interop.Powerpoint v1.1.4322).

    In our application there is a button that the user clicks, and it creates a power point presentation by opening a certain template and filling it with some data from the database. The presentation is then saved and sent to server, and so on.

    The template consists of text boxes that we fill with data. they all have "shrink text on overflow" option checked, but doesnt always work.

    the way we do it is the following:

    open the presentation:

    PowerPoint.Application ppApp = new PowerPoint.Application();
    PowerPoint.Presentation ppPresentation = ppAp.Presentations.Open(path, 
               MsiTriState.msoFalse , MsiTriState.msoFalse, MsiTriState.msoFalse);
    PowerPoint.Slides = ppPresentation.Slides;

    ... then filling data by:

    TextRange range = Slides[slide_idx].Shapes[textRangeName].TextFrame.TextRange;
    range.Text = ...

    As I said, the "shrink text on overflow" does not work - if the text is big, it "slides" out of the text box, sometimes over other data. The interesting thing is, that if I open the presentation by specifying the last parameter as true :

             MsiTriState.msoFalse , MsiTriState.msoFalse, MsiTriState.msoTrue);

    The text DOES shrink to fit in the textbox, as desired - but it causes the powerpoint screen to open on the user's machine, and i don't want that...

    any help regarding this issue will be appriciated,


    Monday, May 7, 2012 12:10 PM

All replies

  • Hi Joseph,

    Would you please tell me your PowerPoint version for further research?

    Have a good day,


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 8, 2012 2:52 AM
  • Hi,

    We use Office 2007

    the version of the dll is Microsoft.Office.Interop.Poerpoint v1.1.4322

    we save the presentation in .pptm format (if it's relevant)



    Tuesday, May 8, 2012 12:32 PM
  • Hi joseph,

    I think you might misunderstand the last parameter of the Presetations.Open. The parameter will set the visiable propertry of the presentation. It has no relationship with "shrink text on overflow".

    Best Regards,


    Monday, May 14, 2012 11:51 AM
  • I understand what the last parameter means...

    i just wanted to say that when I open the presentation with Visible = true , "shrink text on overflow" works, 

    when i open with visible = false, it does not work. And I am interested in opening it with visible=false...

    Monday, May 21, 2012 1:04 PM
  • Hi

    I still have'nt found any solution or good workaround for this issue...

    Any ideas or help is still needed...


    Sunday, June 3, 2012 11:52 AM