يمكن تأمين عرض PowerPoint التقديمي بطرق مختلفة مثل تطبيق علامة مائية أو إضافة توقيع أو جعله للقراءة فقط. في هذا الدليل خطوة بخطوة ، سنوضح لك كيفية تأمين عرض PowerPoint التقديمي في C# .NET باستخدام كلمة مرور.
يساعدك Aspose.Slides for .NET API على تأمين PowerPoint presentation باستخدام C# دون الحاجة إلى Microsoft Interop ولا يتطلب تثبيت Microsoft PowerPoint.
خطوات لتأمين عرض PowerPoint التقديمي في C#
- استخدم حزمة Aspose.Slides for .NET NuGet
- أضف مرجعًا إلى مساحات الأسماء Aspose.Slides و Aspose.Slides.Export
- تطبيق رخصة Aspose بمساعدة طريقة SetLicense
- بدء مثيل Presentation Class
- استخدم طريقة التشفير لفئة ProtectionManager لتأمين العرض التقديمي بكلمة مرور
- أخيرًا ، احفظ العرض التقديمي المحمي بكلمة مرور باستخدام طريقة الحفظ وخاصية 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#. لا تقتصر واجهة برمجة التطبيقات هذه على حماية كلمة المرور ، بل يمكنك أيضًا قفل ملف PPTX وفتحه في C# أيضًا. هذا يجعل تأمين PPTX باستخدام C# مهمة بسيطة وسهلة للغاية بمساعدة Aspose.Slides for .NET.