none
How to change fill type to gradient for shape in PowerPoint using c#?

الإجابات

  • You can try something like below.  I used a converter from VB.Net to C# so I can't attest to the conversion accuracy.

    public void WorkWithShape()
    {
    	PowerPoint.Presentation ppt = Globals.ThisAddIn.Application;
    	ppt.Slides(3).Shapes(1).Name = "My Name";
    	ppt.Slides(3).Shapes(1).Fill.PresetGradient(Office.MsoGradientStyle.msoGradientVertical, 1, Office.MsoPresetGradientType.msoGradientBrass);
    }


    Kind Regards, Rich ... http://greatcirclelearning.com

    • تم وضع علامة كإجابة بواسطة AkashKale 25/جمادى الأولى/1433 07:26 ص
    24/جمادى الأولى/1433 08:01 م
  • Thanks Rich,
    It works, I also tried this one

    rectangle.Fill.OneColorGradient(Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal, 1, 0.1f);

    Regards,
    Akash

    • تم وضع علامة كإجابة بواسطة AkashKale 25/جمادى الأولى/1433 07:26 ص
    25/جمادى الأولى/1433 07:26 ص

جميع الردود

  • You can try something like below.  I used a converter from VB.Net to C# so I can't attest to the conversion accuracy.

    public void WorkWithShape()
    {
    	PowerPoint.Presentation ppt = Globals.ThisAddIn.Application;
    	ppt.Slides(3).Shapes(1).Name = "My Name";
    	ppt.Slides(3).Shapes(1).Fill.PresetGradient(Office.MsoGradientStyle.msoGradientVertical, 1, Office.MsoPresetGradientType.msoGradientBrass);
    }


    Kind Regards, Rich ... http://greatcirclelearning.com

    • تم وضع علامة كإجابة بواسطة AkashKale 25/جمادى الأولى/1433 07:26 ص
    24/جمادى الأولى/1433 08:01 م
  • Thanks Rich,
    It works, I also tried this one

    rectangle.Fill.OneColorGradient(Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal, 1, 0.1f);

    Regards,
    Akash

    • تم وضع علامة كإجابة بواسطة AkashKale 25/جمادى الأولى/1433 07:26 ص
    25/جمادى الأولى/1433 07:26 ص