AddMathShape

ShapeCollection.AddMathShape method

Crea una nueva Autoshape ajustada desde la plantilla predeterminada al contenido matemático y la agrega al final de la colección.

public IAutoShape AddMathShape(float x, float y, float width, float height)
ParámetroTipoDescripción
xSingleLa coordenada X para el lado izquierdo del marco de la forma.
ySingleLa coordenada Y para el lado superior del marco de la forma.
widthSingleEl ancho del marco de la forma.
heightSingleLa altura del marco de la forma.

Valor de Retorno

Objeto AutoShape creado.

Ejemplos

El siguiente ejemplo muestra cómo agregar una Ecuación Matemática en una Presentación de PowerPoint.

[C#]
using (Presentation pres = new Presentation())
{
   IAutoShape mathShape = pres.Slides[0].Shapes.AddMathShape(0, 0, 720, 150);
   var mathParagraph = (mathShape.TextFrame.Paragraphs[0].Portions[0] as MathPortion).MathParagraph;
   var fraction = new MathematicalText("x").Divide("y");
   mathParagraph.Add(new MathBlock(fraction));
   var mathBlock = new MathematicalText("c")
        .SetSuperscript("2")
        .Join("=")
        .Join(new MathematicalText("a").SetSuperscript("2"))
        .Join("+")
        .Join(new MathematicalText("b").SetSuperscript("2"));
    mathParagraph.Add(mathBlock);
    pres.Save("math.pptx", SaveFormat.Pptx);
}

Ver También