C# REST API के साथ PowerPoint में कस्टम आकार बनाएं

C# REST API के साथ PowerPoint में कस्टम आकार बनाने के लिए इस लेख का अनुसरण करें। आप C# RESTful Service** के साथ PowerPoint के लिए **कस्टम आकार स्वचालित रूप से बनाना और जोड़ना सीखेंगे। यह एक आकृति बनाने, उसके पैरामीटर सेट करने और एक विशेष स्लाइड में जोड़ने के लिए सभी विवरण साझा करता है।

पूर्वावश्यकता

C# REST API के साथ PPT आकार जोड़ने के चरण

  1. SlidesApi ऑब्जेक्ट बनाएं और उसमें आकृतियाँ जोड़ने के लिए स्रोत प्रस्तुति अपलोड करें
  2. निर्दिष्ट करें कि संशोधित करने के लिए स्लाइड प्रकार एक मास्टर स्लाइड है
  3. विशिष्ट गुणों के साथ एक नया आकार ऑब्जेक्ट बनाएं
  4. CreateSpecialSlideShape() विधि का उपयोग करके निर्दिष्ट स्लाइड में नया आकार जोड़ें
  5. अद्यतन प्रस्तुति फ़ाइल को नए आकार के साथ डाउनलोड करें

ये चरण बताते हैं कि C# REST API* के साथ *प्रस्तुति आकार कैसे उत्पन्न करें। SlidesApi ऑब्जेक्ट बनाएं, प्रेजेंटेशन को क्लाउड स्टोरेज पर अपलोड करें, संशोधित किए जाने वाले स्लाइड के प्रकार को निर्दिष्ट करें, और वांछित मापदंडों का उपयोग करके शेप ऑब्जेक्ट को इंस्टेंट करें। आकृति को मास्टर स्लाइड में जोड़ें और नए आकार के साथ अद्यतन प्रस्तुतिकरण डाउनलोड करें।

C# REST इंटरफ़ेस के साथ PPT के लिए आकार जोड़ने के लिए कोड

using Aspose.Slides.Cloud.Sdk;
using Aspose.Slides.Cloud.Sdk.Model;
using System.IO;
namespace AsposeTestCodes
{
class Program
{
static void Main(string[] args) // For adding custom shape
{
SlidesApi slidesApi = new SlidesApi("API Key", "Secret");
// Upload the presentation file to Aspose cloud storage
FilesUploadResult uploadResult = slidesApi.UploadFile("SamplePresentation.pptx", new MemoryStream(File.ReadAllBytes("SamplePresentation.pptx")));//Source presentation
// Define the file name of the uploaded presentation
string fileName = "SamplePresentation.pptx";
// Specify that the slide type to modify is a Master Slide
SpecialSlideType slideType = SpecialSlideType.MasterSlide;
// Create a new shape object with specific properties
Shape dto = new Shape
{
X = 100, // X-coordinate for the position of the shape
Y = 100, // Y-coordinate for the position of the shape
Width = 500, // Width of the shape
Height = 200, // Height of the shape
ShapeType = GeometryShape.ShapeTypeEnum.Rectangle, // Define the shape type as a rectangle
Text = "New shape" // Text content to be displayed within the shape
};
// Add the new shape to the specified slide (master slide at index 1) and retrieve the created shape
Shape shape = (Shape)slidesApi.CreateSpecialSlideShape(fileName, 1, slideType, dto);
Stream stream = slidesApi.DownloadFile(fileName);
// Save the downloaded presentation file locally with a new name ("PresWithShape.pptx")
var fs = new FileStream("PresWithShape.pptx", FileMode.Create, FileAccess.Write); // Create a file stream for saving
stream.CopyTo(fs); // Copy the content of the downloaded file into the file stream
}
}
}

यह कोड दर्शाता है कि C# RESTful Service* के साथ स्लाइड के लिए *आकारों को कैसे संभालना है। आप एन्यूमरेटर ज्योमेट्रीशेप.शेपटाइपएनम का उपयोग करके रेखाएं, त्रिभुज, आयत और डायमंड आदि सहित किसी भी प्रकार की आकृतियाँ जोड़ सकते हैं। विकल्प अन्य विशेष प्रकार की स्लाइड्स जैसे लेआउटस्लाइड और नोट्सस्लाइड का चयन करने के लिए भी उपलब्ध है।

इस लेख ने हमें स्लाइड पर आकृतियाँ बनाना सिखाया है। चित्र जोड़ने के लिए, लेख C# REST API के साथ PowerPoint में चित्र जोड़ें देखें।

 हिन्दी