C# REST API के साथ PowerPoint में हाइपरलिंक कैसे जोड़ें के बारे में इस गाइड का पालन करें। आप प्रस्तुतियों के साथ काम करने के लिए सभी उन्नत सुविधाओं का समर्थन करने वाले .NET-आधारित क्लाउड SDK का उपयोग करके स्वचालित रूप से C# RESTful Service के साथ PowerPoint में हाइपरलिंक सम्मिलित करना सीखेंगे। यह कस्टम हाइपरलिंक जोड़ने के लिए एक विशेष स्लाइड और आकार का चयन करने में आपकी सहायता करेगा।
पूर्वावश्यकता
डाउनलोड करना Aspose.Slides Cloud SDK for Dotnet for inserting hyperlinks
किसी आकृति में लिंक जोड़ने के लिए उपरोक्त SDK के साथ C# प्रोजेक्ट सेटअप करें
C# .NET-आधारित API के साथ PowerPoint में एक लिंक जोड़ने के चरण
- प्रमाणीकरण के लिए एपीआई कुंजी और रहस्य के साथ स्लाइडएपीआई को इंस्टेंट करें
- इनपुट फ़ाइल को मेमोरी स्ट्रीम में पढ़ें और अपलोड करें
- हाइपरलिंक जोड़ने के लिए स्लाइडों और आकृतियों की अनुक्रमणिका सेट करें (1-आधारित अनुक्रमणिका)
- हाइपरलिंक के साथ एक आकृति ऑब्जेक्ट बनाएं
- Update हाइपरलिंक के साथ निर्दिष्ट स्लाइड पर आकृति
- सत्यापन के लिए अपडेटेड हाइपरलिंक के यूआरएल को कंसोल पर प्रिंट करें
- अपडेटेड प्रेजेंटेशन को क्लाउड से स्ट्रीम के रूप में डाउनलोड करें और डिस्क पर सेव करें
ये चरण बताते हैं C# REST API के साथ PowerPoint में हाइपरलिंक कैसे जोड़ें। आप एक आकृति बना सकते हैं और क्रिया प्रकार और बाहरी यूआरएल को परिभाषित करके एक हाइपरलिंक जोड़ सकते हैं। अंत में, नए बनाए गए आकार का उपयोग करके वांछित स्लाइड में लक्ष्य आकार को अपडेट करें और यदि आवश्यक हो तो आउटपुट को डिस्क पर सहेजें।
C# लो कोड एपीआई के साथ पावरपॉइंट में लिंक डालने के लिए कोड
using Aspose.Slides.Cloud.Sdk; // Import the Aspose.Slides Cloud SDK to work with PowerPoint presentations. | |
using Aspose.Slides.Cloud.Sdk.Model; // Import models used by the SDK. | |
using System; // Import the System namespace for basic functionalities. | |
using System.IO; // Import System.IO for file input/output operations. | |
namespace AsposeTestCodes | |
{ | |
class Program | |
{ | |
static void Main(string[] args) // Main method - the program's entry point. | |
{ | |
// Instantiate the SlidesApi with the API key and secret for authentication. | |
SlidesApi slidesApi = new SlidesApi("Client ID", "Client Secret"); | |
// Name of the PowerPoint file to work with. | |
string fileName = "PresentationWithoutHyperlink.pptx"; | |
// Read the file into a memory stream and upload it to the Aspose.Slides cloud storage. | |
FilesUploadResult uploadedPresResult = slidesApi.UploadFile(fileName, new MemoryStream(File.ReadAllBytes(fileName))); | |
// Index of the slide and shape where the target shape is located (1-based index). | |
int slideIndex = 2, shapeIndex = 2; | |
Shape shape = new Shape // Create a shape object with a hyperlink | |
{ | |
HyperlinkClick = new Hyperlink | |
{ | |
ActionType = Hyperlink.ActionTypeEnum.Hyperlink, // Set the action type as a hyperlink. | |
ExternalUrl = "https://docs.aspose.cloud/slides" // The URL for the hyperlink. | |
} | |
}; | |
// Update the shape on the specified slide with the hyperlink. | |
ShapeBase updatedShpWithHyperlink = slidesApi.UpdateShape(fileName, slideIndex, shapeIndex, shape); | |
// Print the updated hyperlink's URL to the console for verification. | |
Console.WriteLine(updatedShpWithHyperlink.HyperlinkClick.ExternalUrl); | |
// Download the updated presentation from the cloud as a stream. | |
Stream stream = slidesApi.DownloadFile(fileName); | |
// Save the downloaded presentation to the local file system with a new name. | |
var fs = new FileStream("PresWithHyperlinks.pptx", FileMode.Create, FileAccess.Write); | |
stream.CopyTo(fs); // Copy the content from the stream to the file. | |
} | |
} | |
} |
यह कोड दर्शाता है कि C# REST इंटरफ़ेस के साथ PowerPoint में हाइपरलिंक कैसे सम्मिलित करें। आप हाइपरलिंक के विभिन्न गुणों को सेट कर सकते हैं जैसे हाइपरलिंक को सक्षम/अक्षम करने के लिए ध्वज, टूलटिप, इतिहास, हाइलाइट क्लिक और क्लिक पर ध्वनि बंद करना। ध्यान दें कि ये सभी गुण हाइपरलिंक पर क्लिक करने के बजाय उस पर होवर करने पर उपलब्ध हैं।
इस आलेख ने हमें C# लो कोड API के साथ PowerPoint में हाइपरलिंक बनाना सिखाया है। किसी स्लाइड में स्मार्टआर्ट जोड़ने के लिए, C# REST API के साथ PowerPoint में स्मार्टआर्ट जोड़ें पर लेख देखें।