Setting perspective shadow in PowerPoing using C# VSTO RRS feed

  • Question

  • Hello,

    I am trying to set perspective shadows for text using VSTO C# and am unable to do so. I tried to set msoTristate property of the text as below:


    This sets up only one kind of a shadow.

    I also tried to set the ShadowFormat properties as shown below:

    shape.TextFrame2.TextRange.Paragraphs[j].Font.Shadow.Blur //works fine

    shape.TextFrame2.TextRange.Paragraphs[j].Font.Shadow.Type //throws an exception

    I am able to get only one kind of shadow but am trying to get perspective shadows. Please help. Thanks in advance.

    Thursday, October 20, 2016 12:06 PM

All replies

  • Hi,

    To set perspective shadow, you could use like:

                 Microsoft.Office.Interop.PowerPoint.Shape sp= Globals.ThisAddIn.Application.ActivePresentation.Slides[1].Shapes[1];
                //set the shape shadow
                 sp.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;
                 Microsoft.Office.Interop.PowerPoint.TextFrame2 tf2 = sp.TextFrame2;
                 Microsoft.Office.Core.TextRange2 trg2 = tf2.TextRange;
                 var ch = trg2.Characters;
                //set the text shadow
                 ch.Font.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;

    And for MsoShadowType you could visit MsoShadowType Enumeration.

    Please see the picture, the number represents the shadow type of each perspective shadow.

    Friday, October 21, 2016 11:58 AM
  • Thanks for replying.

    What I am trying to achieve here is to copy the shadow style from a shape and apply it to another shape. Now, in case of perspective text shadow the source shape type come out to be "msoShadowMixed" which is not supported.

    Setting the shadow type as you stated sets the shadow as expected. But as I stated above that I want to copy shadow style from one shape to another. Is there a way I can get the shadow type of perspective shadows? As for all the cases: msoShadow39, msoShadow40, msoShadow41, msoShadow42, msoShadow43, the shadow type is showing to be msoShadowMixed.

    Thanks again.

    Monday, October 24, 2016 9:27 AM
  • Hi,

    After checking the object model, I think Office does not provide any properties to let us retrieve the shadow type for an existing shape if it is mixed.

    If using Open XML SDK is alternative, I would suggest you use this library, we could set the properties in the outerShdw node.

    The following XML is msoShadow39


                <a:outerShdw blurRad="60007" dist="310007" dir="7680000" sy="30000" kx="1300200" algn="ctr" rotWithShape="0">

                  <a:prstClr val="black">

                    <a:alpha val="32000" />




    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, October 25, 2016 9:05 AM