การดูตัวอย่างการป้องกันสไลด์

PowerPoint Presentations มีคุณสมบัติที่ประกอบด้วยรายละเอียดเกี่ยวกับงานนำเสนอ เช่น ชื่อ, ชื่อผู้เขียน, หัวข้อ, และคำสำคัญที่ระบุหัวข้อหรือเนื้อหาของเอกสาร เป็นต้น การระบุค่าที่เกี่ยวข้องสำหรับคุณสมบัติ Property ของงานนำเสนอเป็นสิ่งสำคัญ เพราะช่วยให้สามารถระบุงานนำเสนอได้ ขณะที่สไลด์แต่ละสไลด์ภายในงานนำเสนอมีคุณสมบัติที่เกี่ยวข้องกับพวกเขา เช่น สูง, กว้าง, การจัดแนว, ดัชนีสไลด์ในงานนำเสนอ, SizeType ฯลฯ Aspose.Slides Cloud ช่วยให้คุณสามารถตั้งค่า PPTX Protection Properties ทางโปรแกรมได้

เคล็ดลับด่วน

ใช้คำสั่งต่อไปนี้เพื่อระบุเวอร์ชันที่โฮสต์อยู่ในปัจจุบันของ Aspose.Slides Cloud API,

curl -X GET "https://api.aspose.cloud/v3.0/slides/info" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"

Response Body

{  "name":  "Aspose.Slides for Cloud",  "version":  "21.1.0"  }

ตอนนี้เราจะให้ข้อมูลเกี่ยวกับหัวข้อต่อไปนี้ในบล็อกนี้

รับคุณสมบัติของสไลด์

Aspose.Slides Cloud ให้ความสามารถในการรับคุณสมบัติของสไลด์โดยใช้คำสั่ง cURL และในเวลาเดียวกัน คุณสามารถลองใช้ SDK การเขียนโปรแกรมเฉพาะภาษาเพื่อให้ตรงตามความต้องการของคุณได้

cURL command

curl -X GET "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"

Request URL

https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties

Response Body

{  "firstSlideNumber":  **1**,  "orientation":  "Landscape",  "sizeType":  "Widescreen",  "width":  **960**,  "height":  **540**,  "selfUri":  {  "href":  "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties",  "relation":  "self"  }  }

C# .NET

// complete examples can be found over https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet
string MyAppKey = "xxxxxxxx";    // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppKey and AppSID from https://dashboard.aspose.cloud/

try
{
    // สร้างวัตถุ SlidesAPI
    Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret);
    // สร้างอ็อบเจ็กต์ GetSlidesSlidePropertiesRequest  และระบุการอ้างอิง PPTX
    GetSlidesSlidePropertiesRequest request = new GetSlidesSlidePropertiesRequest { Name = "input.pptx" };
    // อ่านคุณสมบัติของสไลด์
    SlideProperties slideProperties = slidesApi.GetSlidesSlideProperties(request);
    // แสดงรายละเอียดหมายเลขสไลด์แรก
    Console.WriteLine(slideProperties.FirstSlideNumber);
    // พิมพ์รายละเอียดการจัดแนวของสไลด์
    Console.WriteLine(slideProperties.Orientation);
    // print the height details for slide
    Console.WriteLine(slideProperties.Height);
    // print width details for slide
    Console.WriteLine(slideProperties.Width);
    // print information related to scaleType
    Console.WriteLine(slideProperties.ScaleType);
}
catch (Exception e)
{
    Console.WriteLine("Exception while calling Api: " + e.ToString());
}

ตั้งค่าคุณสมบัติของสไลด์ PPTX

Nevertheless, Aspose.Slides Cloud สามารถตั้งค่า properties สำหรับสไลด์ PowerPoint ได้อย่างเต็มที่ และในส่วนถัดไป เราได้อธิบายขั้นตอนที่เกี่ยวข้อง

cURL command

curl -X PUT "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>" \
-H "Content-Type: application/json" \
-d "{ \"FirstSlideNumber\": 0, \"Orientation\": \"Portrait\", \"ScaleType\": \"DoNotScale\", \"SizeType\": \"OnScreen\", \"Width\": 600, \"Height\": 900, \"SelfUri\": { \"Href\": \"https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties\", \"Relation\": \"self\", \"LinkType\": \"\", \"Title\": \"Hello\" }, \"AlternateLinks\": [ { \"Href\": \"string\", \"Relation\": \"string\", \"LinkType\": \"string\", \"Title\": \"string\" } ]}"

C# .NET

// please viist following link for complete source code  https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet
try
{
    String Client_ID = "xxxxxxxx-1c8e-4ea4-a948-3857547232fa";
    String Client_Secret = "xxxxxxxx237f013e329cdf5694cc96a";
    // สร้างออบเจ็กต์ SlidesAPI
    Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret);
    // สร้างวัตถุ PutSlidesSlidePropertiesRequest และให้ PPTX เป็นอาร์กิวเมนต์ 
    PutSlidesSlidePropertiesRequest request = new PutSlidesSlidePropertiesRequest {
        // speicfy input PowerPoint presentation
        Name = "input.pptx",
        Dto = new SlideProperties {
            Width = 900,
            Height = 600,
            Orientation = SlideProperties.OrientationEnum.Portrait,
            ScaleType = SlideProperties.ScaleTypeEnum.DoNotScale,
            SizeType = SlideProperties.SizeTypeEnum.OnScreen,
        }
    };
    SlideProperties response = slidesApi.PutSlidesSlideProperties(request);
    // อ่านคุณสมบัติความกว้างของสไลด์
    Console.WriteLine(response.Width);
    // อ่านคุณสมบัติสูงของสไลด์
    Console.WriteLine(response.Height);
 }
catch (Exception e)
{
    Console.WriteLine("Exception while calling Api: " + e.ToString());
}

รับคุณสมบัติการป้องกันสไลด์

วิธี GetSlidesProtectionProperties ของ API ให้ความสามารถในการอ่านคุณสมบัติการป้องกันของเอกสารการนำเสนอ。

curl -X GET "https://api.aspose.cloud/v3.0/slides/input.pptx/protectionProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"

C# .NET

// please viist following link for complete source code  https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet

try
{
    String Client_ID = "xxxxxxx-1c8e-4ea4-a948-3857547232fa";
    String Client_Secret = "xxxxxxxx237f013e329cdf5694cc96a";
    // สร้างออบเจ็กต์ SlidesAPI
    SlidesApi slidesApi = new SlidesApi(Client_ID, Client_Secret);
    // สร้างวัตถุ PutSlidesSlidePropertiesRequest และให้ไฟล์ PPTX เป็นอาร์กิวเมนต์
    GetSlidesProtectionPropertiesRequest request = new GetSlidesProtectionPropertiesRequest
    {
        // speicfy input PowerPoint presentation
        Name = "input.pptx",   
    };
    ProtectionProperties slideProperties = slidesApi.GetSlidesProtectionProperties(request);
    // อ่านคุณสมบัติความกว้างของสไลด์
    Console.WriteLine("Encrypted Document Properties = "+slideProperties.EncryptDocumentProperties);
    Console.WriteLine("Read Only Recommended = "+slideProperties.ReadOnlyRecommended);
    Console.WriteLine("Self URi = " + slideProperties.SelfUri);
}
catch (Exception e)
{
    Console.WriteLine("Exception while calling Api: " + e.ToString());
}

วิธีที่เลิกใช้งานแล้ว

PUT fromHtml method ถูกระบุว่าไม่แนะนำให้ใช้และจะถูกลบออกในเวอร์ชัน 21.4 ใช้ POST fromHtml method เพื่อสร้างการนำเสนอและยังเพิ่มสไลด์ใหม่ให้กับการนำเสนอเหล่านั้น

slideSize resource is deprecated and will be deleted in the 21.4 release. Use slideProperties resource instead.

บทสรุป

ในบทความนี้ เราได้สำรวจความสามารถของ Aspose.Slides Cloud ในการตั้งค่า PPTX Protection Properties, รับคุณสมบัติการป้องกันสไลด์, รับคุณสมบัติสไลด์โดยใช้ C# .NET รวมถึงคำสั่ง cURL คุณสามารถดาวน์โหลดซอร์สโค้ดเต็มรูปแบบของ Aspose.Slides Cloud SDK สำหรับ .NET ได้จาก GitHub เพื่อเรียนรู้เพิ่มเติมเกี่ยวกับความสามารถของ SDK โปรดสำรวจ Developer Guide.

บทความที่เกี่ยวข้อง