.NET में PowerPoint प्रस्तुतियों के लिए गणितीय समीकरण जोड़ें
अवलोकन
PowerPoint समीकरणों को Office Math Markup Language (OMML) के रूप में संग्रहीत करता है। Aspose.Slides for .NET के साथ, आप प्रोग्रामेटिक रूप से वही प्रकार की गणितीय सामग्री बना सकते हैं: भिन्न, मूल, फ़ंक्शन, सीमाएँ, N-ary ऑपरेटर्स, मैट्रिक्स, एरे, और फ़ॉर्मेटेड गणितीय ब्लॉक्स।
In PowerPoint, users normally add equations from Insert > Equation:

The result is editable math text on the slide:

Aspose.Slides builds that math text through three main objects:
- एक गणितीय आकार, जिसे AddMathShape के साथ बनाया गया है, वह आकार है जिसमें समीकरण शामिल है।
- MathPortion आकार के टेक्स्ट फ्रेम के भीतर गणितीय सामग्री को संग्रहित करता है।
- MathParagraph एक या अधिक MathBlock वस्तुओं को सम्मिलित करता है।
नीचे के अधिकांश उदाहरण MathematicalText और IMathElement की फ़्लुएंट विधियों का उपयोग करके कोड को संक्षिप्त और पठनीय रखते हैं।
MathML निर्यात परिदृश्यों के लिए, देखें प्रस्तुतियों से गणितीय समीकरण निर्यात करें .NET में।
समीकरण बनाएं
This example creates a math shape and adds the Pythagorean theorem:

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 120);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var equation = new MathematicalText("c")
.SetSuperscript("2")
.Join("=")
.Join(new MathematicalText("a").SetSuperscript("2"))
.Join("+")
.Join(new MathematicalText("b").SetSuperscript("2"));
mathParagraph.Add(equation);
presentation.Save("pythagorean-theorem.pptx", SaveFormat.Pptx);
AddMathShape एक आकार बनाता है जिसमें पहले से ही एक गणितीय पैराग्राफ शामिल होता है। पहला MathPortion प्राप्त करें, उसका MathParagraph ले, और उसमें गणितीय ब्लॉक या गणितीय तत्व जोड़ें।
भिन्न जोड़ें
Divide का प्रयोग करके एक भिन्न बनाएं। आप एक भिन्न शैली चुन सकते हैं MathFractionTypes।

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var fraction = new MathematicalText("1")
.Divide("x", MathFractionTypes.Skewed);
mathParagraph.Add(new MathBlock(fraction));
presentation.Save("fraction.pptx", SaveFormat.Pptx);
For a stacked fraction, use MathFractionTypes.Bar:
var stackedFraction = new MathematicalText("x + 1").Divide("y - 1", MathFractionTypes.Bar);
मूल जोड़ें
Radical का उपयोग करके वर्गमूल, घनमूल, या अन्य मूल बनाएं। वर्तमान तत्व आधार बन जाता है, और तर्क घातांक बन जाता है।

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var radical = new MathematicalText("x")
.Radical("n");
mathParagraph.Add(new MathBlock(radical));
presentation.Save("radical.pptx", SaveFormat.Pptx);
फ़ंक्शन और सीमाएँ जोड़ें
Use AsArgumentOfFunction or Function for functions such as sin(x), log(x), or custom function names. For limits, put lim in a MathLimit or use SetLowerLimit.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var limit = new MathematicalText("lim")
.SetLowerLimit("x→∞")
.Function("x");
mathParagraph.Add(new MathBlock(limit));
presentation.Save("functions-and-limits.pptx", SaveFormat.Pptx);
For a custom function name, make the function name the current element:
var customFunction = new MathematicalText("f").Function("x + 1");
N-ary ऑपरेटर और इंटीग्रल जोड़ें
Use Nary for summations, unions, intersections, and other large operators. Use Integral for integrals. Both methods let you set lower and upper limits.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 120);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var summationBase = new MathematicalText("x")
.SetSuperscript("k")
.Join(new MathematicalText("a").SetSuperscript("n-k"));
var summation = summationBase.Nary(MathNaryOperatorTypes.Summation, "k=0", "n");
mathParagraph.Add(new MathBlock(summation));
presentation.Save("nary-operators.pptx", SaveFormat.Pptx);
N-ary ऑपरेटर्स बड़े ऑपरेटर्स के लिए होते हैं जिनमें वैकल्पिक सीमाएँ होती हैं। +, -, और = जैसे सरल ऑपरेटर्स आमतौर पर MathematicalText के रूप में जोड़े जाते हैं और अभिव्यक्ति में मिलते हैं।
For an integral, use Integral:
var integralBase = new MathematicalText("x").Join(new MathematicalText("dx").ToBox());
var integral = integralBase.Integral(MathIntegralTypes.Simple, "0", "1");
मैट्रिक्स जोड़ें
Use MathMatrix for rows and columns. Matrices do not include brackets by default, so enclose the matrix when you need parentheses, brackets, or braces.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 120);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var matrix = new MathMatrix(2, 3);
matrix[0, 0] = new MathematicalText("1");
matrix[0, 1] = new MathematicalText("x");
matrix[1, 0] = new MathematicalText("x");
matrix[1, 1] = new MathematicalText("2");
matrix[1, 2] = new MathematicalText("y");
mathParagraph.Add(new MathBlock(matrix));
presentation.Save("matrix.pptx", SaveFormat.Pptx);
समीकरण एरे जोड़ें
Use ToMathArray when you need aligned equations or a vertical stack of expressions.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 140);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var equationArray = new MathematicalText("x")
.Join("y")
.ToMathArray();
mathParagraph.Add(new MathBlock(equationArray));
presentation.Save("equation-array.pptx", SaveFormat.Pptx);
त्रिकोणमितीय फ़ंक्शन जोड़ें
Use AsArgumentOfFunction when the argument is the current element and the function name is known.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var cosine = new MathematicalText("2x")
.AsArgumentOfFunction(MathFunctionsOfOneArgument.Cos);
mathParagraph.Add(new MathBlock(cosine));
presentation.Save("trigonometric-function.pptx", SaveFormat.Pptx);
सबस्क्रिप्ट और सुपरस्क्रिप्ट जोड़ें
Use the subscript and superscript helpers for indexes and powers. When the indexes must appear on the left side of the base, use SetSubSuperscriptOnTheLeft.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var scripts = new MathematicalText("Y")
.SetSubSuperscriptOnTheLeft("1", "n");
mathParagraph.Add(new MathBlock(scripts));
presentation.Save("subscript-superscript.pptx", SaveFormat.Pptx);
डिलिमीटर जोड़ें
Use Enclose to put an expression inside delimiters. You can also set a separator character for delimiter expressions that contain several elements.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var delimiter = new MathematicalText("x")
.Join("y")
.Join("z")
.Enclose('<', '>');
delimiter.SeparatorCharacter = '|';
mathParagraph.Add(new MathBlock(delimiter));
presentation.Save("delimiters.pptx", SaveFormat.Pptx);
बॉर्डर बॉक्स जोड़ें
Use ToBorderBox when the equation itself should be framed.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var boxedEquation = new MathematicalText("a")
.SetSuperscript("2")
.Join("=")
.Join(new MathematicalText("b").SetSuperscript("2"))
.Join("+")
.Join(new MathematicalText("c").SetSuperscript("2"))
.ToBorderBox();
mathParagraph.Add(new MathBlock(boxedEquation));
presentation.Save("border-box.pptx", SaveFormat.Pptx);
टर्म्स को समूहित करें
Use Group to place a grouping character above or below an expression. Add a limit to label the grouped terms.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 120);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var grouped = new MathematicalText("x + y")
.Group('\u23DF', MathTopBotPositions.Bottom, MathTopBotPositions.Top)
.SetLowerLimit("any text");
mathParagraph.Add(new MathBlock(grouped));
presentation.Save("grouped-terms.pptx", SaveFormat.Pptx);
गणितीय तत्वों को फॉर्मेट करें
Use formatting helpers only where they clarify the formula. For example, Overbar places a bar above a math element.

using var presentation = new Presentation();
var slide = presentation.Slides[0];
var mathShape = slide.Shapes.AddMathShape(20, 20, 700, 100);
var mathParagraph = ((MathPortion)mathShape.TextFrame.Paragraphs[0].Portions[0]).MathParagraph;
var overbar = new MathematicalText("ABC").Overbar();
mathParagraph.Add(new MathBlock(overbar));
presentation.Save("overbar.pptx", SaveFormat.Pptx);
त्वरित संदर्भ
| कार्य | मुख्य API |
|---|---|
| गणितीय टेक्स्ट बनाएं | MathematicalText |
| तत्वों को मिलाएँ | IMathElement.Join |
| भिन्न बनाएं | IMathElement.Divide |
| सुपरस्क्रिप्ट या सबस्क्रिप्ट जोड़ें | SetSuperscript, SetSubscript |
| फ़ंक्शन जोड़ें | Function, AsArgumentOfFunction |
| मूल जोड़ें | IMathElement.Radical |
| सीमाएँ जोड़ें | SetLowerLimit, SetUpperLimit |
| बाएँ‑साइड स्क्रिप्ट जोड़ें | SetSubSuperscriptOnTheLeft |
| योग और इंटीग्रल जोड़ें | Nary, Integral |
| मैट्रिक्स जोड़ें | MathMatrix |
| समीकरण एरे जोड़ें | ToMathArray |
| डिलिमीटर जोड़ें | Enclose |
| बार और बॉर्डर जोड़ें | Overbar, ToBorderBox |
| टर्म्स को समूहित करें | Group |
अक्सर पूछे जाने वाले प्रश्न
क्या मैं मौजूदा PowerPoint समीकरण को संपादित कर सकता हूँ?
हां। प्रस्तुति खोलें, वह आकार खोजें जिसमें MathPortion हो, उसका MathParagraph प्राप्त करें, और उस पैराग्राफ में गणितीय ब्लॉकों को अपडेट करें।
क्या समीकरण संपादन योग्य PowerPoint गणित के रूप में सहेजे जाते हैं?
हां। जब आप PPTX में सहेजते हैं, Aspose.Slides समीकरण को संपादन योग्य Office गणित सामग्री के रूप में लिखता है।
क्या मैं समीकरणों को LaTeX में निर्यात कर सकता हूँ?
Aspose.Slides गणितीय समीकरणों को MathML में निर्यात करता है। यदि आपको LaTeX चाहिए, तो पहले MathML में निर्यात करें और फिर MathML को एक ऐसे उपकरण से परिवर्तित करें जो आपके लक्ष्य LaTeX संस्करण का समर्थन करता हो।