Kaip apsaugoti PowerPoint pristatymą C#.NET

PowerPoint pristatymas gali būti apsaugotas įvairiais būdais, pvz., pritaikant vandens ženklą, pridedant parašą arba padarant jį tik skaitomą. Šiame žingsnis po žingsnio vadove parodysime, kaip apsaugoti PowerPoint pristatymą C# .NET naudojant slaptažodį.

Aspose.Slides for .NET API padeda apsaugoti PowerPoint presentation naudojant C#, nereikalaujant Microsoft Interop ir nereikia įdiegti Microsoft PowerPoint.

Veiksmai, kaip apsaugoti PowerPoint pristatymą C#

  1. Naudokite Aspose.Slides for .NET NuGet paketą
  2. Pridėkite nuorodą į Aspose.Slides ir Aspose.Slides.Export vardų erdves
  3. Taikykite Aspose licenciją naudodami SetLicense metodą
  4. Inicijuoti Presentation Class egzempliorių
  5. Norėdami apsaugoti pristatymą slaptažodžiu, naudokite ProtectionManager klasės šifravimo metodą
  6. Galiausiai išsaugokite slaptažodžiu apsaugotą pristatymą naudodami Įrašymo metodą ir SaveFormat.Pptx ypatybę

Kodas saugiam PowerPoint pristatymui 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);
}
}
}

Atlikdami aukščiau nurodytus veiksmus ir kodą, sužinojote, kaip apsaugoti PPTX naudojant C#. Ši API neapsiriboja slaptažodžio apsauga, o taip pat galite užrakinti ir atrakinti PPTX failą C#. Dėl to PPTX apsauga naudojant C# yra labai paprasta ir lengva užduotis naudojant Aspose.Slides, skirtą .NET.

 Latviski