วิธีรักษาความปลอดภัยการนำเสนอ PowerPoint ใน C# .NET

งานนำเสนอ PowerPoint สามารถรักษาความปลอดภัยได้หลายวิธี เช่น ด้วยการใส่ลายน้ำ เพิ่มลายเซ็น หรือทำให้เป็นแบบอ่านอย่างเดียว ในคำแนะนำทีละขั้นตอนนี้ เราจะแสดงวิธีรักษาความปลอดภัยงานนำเสนอ PowerPoint ใน C# .NET โดยใช้รหัสผ่าน

Aspose.Slides for .NET API ช่วยให้คุณรักษาความปลอดภัยของ PowerPoint presentation โดยใช้ C# โดยไม่จำเป็นต้องใช้ Microsoft Interop และไม่ต้องติดตั้ง Microsoft PowerPoint

ขั้นตอนในการรักษาความปลอดภัยการนำเสนอ PowerPoint ใน C#

  1. ใช้แพ็คเกจ NuGet Aspose.Slides for .NET
  2. เพิ่มการอ้างอิงถึงเนมสเปซ Aspose.Slides และ Aspose.Slides.Export
  3. ใช้ใบอนุญาต Aspose ด้วยความช่วยเหลือของวิธี SetLicense
  4. เริ่มต้นอินสแตนซ์ Presentation Class
  5. ใช้วิธีการเข้ารหัสของคลาส ProtectionManager เพื่อรักษาความปลอดภัยการนำเสนอด้วยรหัสผ่าน
  6. สุดท้าย บันทึกงานนำเสนอที่ป้องกันด้วยรหัสผ่านโดยใช้วิธีบันทึกและคุณสมบัติ SaveFormat.Pptx

รหัสเพื่อความปลอดภัยในการนำเสนอ PowerPoint ใน 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);
}
}
}

ในขั้นตอนและโค้ดข้างต้น คุณได้เรียนรู้วิธีรักษาความปลอดภัย PPTX โดยใช้ C# API นี้ไม่จำกัดเพียงการป้องกันด้วยรหัสผ่าน แต่คุณสามารถล็อกและปลดล็อกไฟล์ PPTX ใน C# ได้เช่นกัน สิ่งนี้ทำให้การรักษาความปลอดภัย PPTX โดยใช้ C# เป็นเรื่องง่ายและสะดวกด้วยความช่วยเหลือของ Aspose.Slides สำหรับ .NET

 ไทย