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 դասի Encrypt մեթոդը՝ գաղտնաբառով ներկայացումն ապահովելու համար
- Վերջապես, պահպանեք գաղտնաբառով պաշտպանված ներկայացումը` օգտագործելով Save մեթոդը և 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#-ում: Սա C#-ի միջոցով PPTX-ի ապահովումը դարձնում է շատ պարզ և հեշտ գործ Aspose.Slides-ի օգնությամբ .NET-ի համար: