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

परिणाम स्लाइड पर संपादन योग्य गणित टेक्स्ट होता है:

Aspose.Slides उस गणित टेक्स्ट को तीन मुख्य वस्तुओं के माध्यम से बनाता है:
- एक गणितीय आकार, जो addMathShape द्वारा बनाया गया है, वह आकार है जो समीकरण को सम्मिलित करता है।
- MathPortion आकार के टेक्स्ट फ्रेम के भीतर गणितीय सामग्री संग्रहीत करता है।
- MathParagraph एक या अधिक MathBlock वस्तुओं को सम्मिलित करता है।
नीचे के अधिकांश उदाहरण MathematicalText और IMathElement की fluent विधियों का उपयोग करते हैं ताकि कोड छोटा और पठनीय रहे।
MathML निर्यात परिदृश्यों के लिए, देखें Export Math Equations from Presentations on Android।
एक समीकरण बनाएँ
c वर्ग a वर्ग प्लस b वर्ग के बराबर

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 120);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathBlock 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);
} finally {
presentation.dispose();
}
addMathShape एक आकार बनाता है जिसमें पहले से ही एक गणित पैराग्राफ़ होता है। पहला MathPortion प्राप्त करें, उसका MathParagraph ले और उसमें गणित ब्लॉक्स या गणित तत्व जोड़ें।
भिन्न जोड़ें
divide का उपयोग करके एक भिन्न बनाएं। आप एक भिन्न शैली MathFractionTypes से चुन सकते हैं।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathFraction fraction = new MathematicalText("1")
.divide("x", MathFractionTypes.Skewed);
mathParagraph.add(new MathBlock(fraction));
presentation.save("fraction.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
एक स्टैक्ड भिन्न के लिए, MathFractionTypes.Bar का प्रयोग करें:
IMathFraction stackedFraction = new MathematicalText("x + 1").divide("y - 1", MathFractionTypes.Bar);
मूल जोड़ें
radical का उपयोग करके वर्गमूल, घनमूल या अन्य मूल बनाएं। वर्तमान तत्व आधार बन जाता है, और तर्क डिग्री बन जाता है।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathRadical radical = new MathematicalText("x")
.radical("n");
mathParagraph.add(new MathBlock(radical));
presentation.save("radical.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
फ़ंक्शन और सीमाएँ जोड़ें
asArgumentOfFunction या function का उपयोग sin(x), log(x) जैसी फ़ंक्शनों या कस्टम फ़ंक्शन नामों के लिए करें। सीमाओं के लिए, lim को एक MathLimit में रखें या setLowerLimit प्रयोग करें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathFunction limit = new MathematicalText("lim")
.setLowerLimit("x→∞")
.function("x");
mathParagraph.add(new MathBlock(limit));
presentation.save("functions-and-limits.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
कस्टम फ़ंक्शन नाम के लिए, फ़ंक्शन नाम को वर्तमान तत्व बनाएं:
IMathFunction customFunction = new MathematicalText("f").function("x + 1");
N-ary ऑपरेटर और इंटेग्रल जोड़ें
सम्पूर्ण, संघ, प्रतिच्छेद और अन्य बड़े ऑपरेटरों के लिए nary का उपयोग करें। इंटेग्रल के लिए integral का उपयोग करें। दोनों विधियों से आप निचली और ऊपरी सीमाएँ निर्धारित कर सकते हैं।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 120);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathBlock summationBase = new MathematicalText("x")
.setSuperscript("k")
.join(new MathematicalText("a").setSuperscript("n-k"));
IMathNaryOperator summation = summationBase.nary(MathNaryOperatorTypes.Summation, "k=0", "n");
mathParagraph.add(new MathBlock(summation));
presentation.save("nary-operators.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
N-ary ऑपरेटर बड़े ऑपरेटर होते हैं जिनमें वैकल्पिक सीमाएँ हो सकती हैं। +, -, = जैसे सरल ऑपरेटर आमतौर पर MathematicalText के रूप में जोड़े जाते हैं और अभिव्यक्ति में सम्मिलित होते हैं।
इंटेग्रल के लिए, integral का प्रयोग करें:
IMathBlock integralBase = new MathematicalText("x").join(new MathematicalText("dx").toBox());
IMathNaryOperator integral = integralBase.integral(MathIntegralTypes.Simple, "0", "1");
मैट्रिक्स जोड़ें
पंक्तियों और स्तंभों के लिए MathMatrix का उपयोग करें। मैट्रिक्स में डिफ़ॉल्ट रूप से कोष्ठक नहीं होते, इसलिए जब आपको कोष्ठक, ब्रैकेट या ब्रेसेस चाहिए तो मैट्रिक्स को उन में घेरें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 120);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
MathMatrix matrix = new MathMatrix(2, 3);
matrix.set_Item(0, 0, new MathematicalText("1"));
matrix.set_Item(0, 1, new MathematicalText("x"));
matrix.set_Item(1, 0, new MathematicalText("x"));
matrix.set_Item(1, 1, new MathematicalText("2"));
matrix.set_Item(1, 2, new MathematicalText("y"));
mathParagraph.add(new MathBlock(matrix));
presentation.save("matrix.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
समीकरण एरे जोड़ें
जब आपको संरेखित समीकरण या अभिव्यक्तियों की ऊर्ध्वाधर स्टैक चाहिए, तो toMathArray का उपयोग करें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 140);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathArray equationArray = new MathematicalText("x")
.join("y")
.toMathArray();
mathParagraph.add(new MathBlock(equationArray));
presentation.save("equation-array.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
त्रिकोणमितीय फ़ंक्शन जोड़ें
जब तर्क वर्तमान तत्व हो और फ़ंक्शन नाम ज्ञात हो, तो asArgumentOfFunction का उपयोग करें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathFunction cosine = new MathematicalText("2x")
.asArgumentOfFunction(MathFunctionsOfOneArgument.Cos);
mathParagraph.add(new MathBlock(cosine));
presentation.save("trigonometric-function.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
सबस्क्रिप्ट और सुपरस्क्रिप्ट जोड़ें
इंडेक्स और घातों के लिए सबस्क्रिप्ट और सुपरस्क्रिप्ट हेल्पर का उपयोग करें। जब इंडेक्स बेस के बाएँ पक्ष पर दिखना चाहिए, तो setSubSuperscriptOnTheLeft का प्रयोग करें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathLeftSubSuperscriptElement scripts = new MathematicalText("Y")
.setSubSuperscriptOnTheLeft("1", "n");
mathParagraph.add(new MathBlock(scripts));
presentation.save("subscript-superscript.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
डिलिमिटर जोड़ें
एक अभिव्यक्ति को डिलिमिटर के भीतर रखने के लिए enclose का उपयोग करें। कई तत्वों वाली डिलिमिटर अभिव्यक्तियों के लिए आप एक विभाजक अक्षर भी सेट कर सकते हैं।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathDelimiter delimiter = new MathematicalText("x")
.join("y")
.join("z")
.enclose('<', '>');
delimiter.setSeparatorCharacter('|');
mathParagraph.add(new MathBlock(delimiter));
presentation.save("delimiters.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
बॉर्डर बॉक्स जोड़ें
जब स्वयं समीकरण को फ्रेम किया जाना हो, तो toBorderBox का उपयोग करें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathBorderBox 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);
} finally {
presentation.dispose();
}
टर्म समूहित करें
एक समूहिंग चर को अभिव्यक्ति के ऊपर या नीचे रखने के लिए group का उपयोग करें। समूहित टर्म को लेबल करने हेतु एक सीमा जोड़ें।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 120);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathLimit 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);
} finally {
presentation.dispose();
}
गणित तत्व स्वरूपित करें
फ़ॉर्मेटिंग हेल्पर केवल तब उपयोग करें जब वह सूत्र को स्पष्ट करे। उदाहरण के लिए, overbar एक गणितीय तत्व के ऊपर बार रखता है।

Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape mathShape = slide.getShapes().addMathShape(20, 20, 700, 100);
IMathParagraph mathParagraph = ((MathPortion) mathShape.getTextFrame().getParagraphs()
.get_Item(0).getPortions().get_Item(0)).getMathParagraph();
IMathBar overbar = new MathematicalText("ABC").overbar();
mathParagraph.add(new MathBlock(overbar));
presentation.save("overbar.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
त्वरित संदर्भ
| कार्य | मुख्य 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 डायलैक्ट में परिवर्तित करें।