Cara Mengamankan Presentasi PowerPoint di C# .NET

Presentasi PowerPoint dapat diamankan dengan berbagai cara seperti dengan menerapkan tanda air, menambahkan tanda tangan, atau membuatnya hanya dapat dibaca. Dalam panduan langkah demi langkah ini, kami akan menunjukkan cara mengamankan presentasi PowerPoint di C# .NET menggunakan kata sandi.

Aspose.Slides for .NET API membantu Anda mengamankan PowerPoint presentation menggunakan C# tanpa memerlukan Microsoft Interop dan tidak memerlukan Microsoft PowerPoint untuk diinstal.

Langkah-langkah untuk Mengamankan Presentasi PowerPoint di C#

  1. Gunakan Aspose.Slides for .NET paket NuGet
  2. Tambahkan referensi ke Aspose.Slides dan Aspose.Slides.Export namespaces
  3. Terapkan lisensi Aspose dengan bantuan metode SetLicense
  4. Mulai instance Presentation Class
  5. Gunakan metode Enkripsi kelas ProtectionManager untuk mengamankan presentasi dengan kata sandi
  6. Terakhir, simpan presentasi yang dilindungi kata sandi menggunakan metode Simpan dan properti SaveFormat.Pptx

Kode untuk Mengamankan Presentasi PowerPoint di C#

using System;
//Install Aspose.Slides for .NET NuGet package
//and then utilize the following namespace to
//secure PowerPoint presentation
using Aspose.Slides;
using Aspose.Slides.Export;
namespace SecurePowerPointPresentation
{
class Program
{
static void Main(string[] args)
{
//Set Aspose license before securing PowerPoint presentation
//using Aspose.Slides for .NET
Aspose.Slides.License AsposeSlidesLicense = new Aspose.Slides.License();
AsposeSlidesLicense.SetLicense(@"c:\asposelicense\license.lic");
//create an object of Presentation class from Aspose.Slides namespace
//and provide the PowerPoint presentation to secure in the constructor
Presentation PowerPointPresentationToSecure = new Presentation("PowerPointPresentationToSecure.pptx");
//specify the password with which you want to secure the presentation
//this can be taken as input password from the user/admin etc.
String PasswordForPresentationSecurity = "8ma2bzdqgo";
//Encrypt or secure the presentation with the password using Encrypt method
//with the help of ProtectionManager
PowerPointPresentationToSecure.ProtectionManager.Encrypt(PasswordForPresentationSecurity);
//Finally, save the output presentation secured with password
//provide PPTX as save format
PowerPointPresentationToSecure.Save("PresentationSecuredWithPassword.pptx",Aspose.Slides.Export.SaveFormat.Pptx);
}
}
}

Pada langkah dan kode di atas, Anda telah mempelajari cara mengamankan PPTX menggunakan C#. API ini tidak terbatas pada perlindungan kata sandi, tetapi Anda juga dapat mengunci dan membuka kunci file PPTX di C# juga. Ini membuat mengamankan PPTX menggunakan C# menjadi tugas yang sangat sederhana dan mudah dengan bantuan Aspose.Slides untuk .NET.

 Indonesian