locked
How to add shape with color ,line width and line pattern RRS feed

  • Question

  • Hi all:

    I found a way to insert some shapes into the word/PPT/Excel documents, but I can't control the object color, I want to set the background color with "No Fill", line width and so on. but I don't know how to write by C#, does anyone know about it?

    Thanks

    Emily

    sample code:

                            Single[,] myTab = new Single[4, 2];
                            myTab[0, 0] = 25;
                            myTab[0, 1] = 100;
                            myTab[1, 0] = 100;
                            myTab[1, 1] = 150;
                            myTab[2, 0] = 150;
                            myTab[2, 1] = 50;
                            myTab[3, 0] = 25;
                            myTab[3, 1] = 100;

                            pptPresentation.Slides[1].Shapes.AddPolyline(myTab);

    pptPresentation.Save();

    Monday, May 11, 2015 10:18 AM

Answers

  • Hi emily,

    We could change the shape color by using Shape.Fill property.

    To change the width and height, we could use Shape.Width and Height properties.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 12, 2015 6:21 AM
  • Hi Starain:

    Thank you for your answer,

    I use the Shape.Line.Weight to set shape outline width, and shape.Line.ForeColor.RGB to set the outline color, it works.

    Thanks

    Emily


    Wednesday, May 13, 2015 1:45 AM

All replies

  • I will give u example in PowerPoint files, when you finish the shapes, set the backgroundcolor,

    first download a free edition of this PPT API, then add reference (.dll)to your project.then refer this article.

    Set the outline and effects for shapes in PowePoint files.

    //Outline color
    shape.ShapeStyle.LineColor.Color = Color.Red;

    PresetShadow shadow = new PresetShadow();
    shadow.Preset = PresetShadowValue.FrontRightPerspective;
    shadow.Distance = 10.0;
    shadow.Direction = 225.0f;
    shape.EffectDag.PresetShadowEffect = shadow;





    Tuesday, May 12, 2015 3:24 AM
  • Hi emily,

    We could change the shape color by using Shape.Fill property.

    To change the width and height, we could use Shape.Width and Height properties.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 12, 2015 6:21 AM
  • Hi Starain:

    Thank you for your answer,

    I use the Shape.Line.Weight to set shape outline width, and shape.Line.ForeColor.RGB to set the outline color, it works.

    Thanks

    Emily


    Wednesday, May 13, 2015 1:45 AM