AddMathShape()
Contents
[
Hide
]ShapeCollection::AddMathShape(float, float, float, float) method
Creates a new Autoshape tuned from default template to math content and adds it to the end of the collection.
System::SharedPtr<IAutoShape> Aspose::Slides::ShapeCollection::AddMathShape(float x, float y, float width, float height) override
Arguments
Parameter | Type | Description |
---|---|---|
x | float | The X-coordinate for a left side of shape’s frame. |
y | float | The Y-coordinate for a top side of shape’s frame. |
width | float | The width of shape’s frame. |
height | float | The height of shape’s frame. |
Return Value
Created AutoShape object.
Remarks
The following example shows how to add Mathematical Equation in PowerPoint Presentation.
auto pres = System::MakeObject<Presentation>();
auto mathShape = pres->get_Slides()->idx_get(0)->get_Shapes()->AddMathShape(0.0f, 0.0f, 720.0f, 150.0f);
auto mathPortion = mathShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0);
auto mathParagraph = (System::AsCast<MathPortion>(mathPortion))->get_MathParagraph();
auto fraction = System::MakeObject<MathematicalText>(u"x")->Divide(u"y");
mathParagraph->Add(System::MakeObject<MathBlock>(fraction));
auto a2 = System::MakeObject<MathematicalText>(u"a")->SetSuperscript(u"2");
auto b2 = System::MakeObject<MathematicalText>(u"b")->SetSuperscript(u"2");
auto c2 = System::MakeObject<MathematicalText>(u"c")->SetSuperscript(u"2");
auto mathBlock = c2->Join(u"=")->Join(a2)->Join(u"+")->Join(b2); // c^2 = a^2 + b^2
mathParagraph->Add(mathBlock);
pres->Save(u"math.pptx", SaveFormat::Pptx);
See Also
- Typedef SharedPtr
- Class IAutoShape
- Class ShapeCollection
- Namespace Aspose::Slides
- Library Aspose.Slides