
Các bài thuyết trình PowerPoint có các thuộc tính chứa thông tin chi tiết về bài thuyết trình như tiêu đề, tên tác giả, chủ đề và từ khóa xác định chủ đề hoặc nội dung của tài liệu, v.v. Việc chỉ định các giá trị liên quan cho các thuộc tính thuộc tính của bài thuyết trình là rất quan trọng vì chúng giúp xác định bài thuyết trình. Trong khi đó, các slide riêng lẻ trong bài thuyết trình có các thuộc tính liên quan đến chúng như Chiều cao, Chiều rộng, Hướng, chỉ số slide trong bài thuyết trình, Loại kích thước, v.v. Aspose.Slides Cloud cho phép bạn lập trình Đặt các thuộc tính bảo vệ PPTX.
Mẹo Nhanh
Sử dụng lệnh sau để xác định phiên bản đang lưu trữ hiện tại của 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" }
Bây giờ chúng ta sẽ làm sáng tỏ một số chủ đề sau trong blog này.
- Lấy thuộc tính của trang trình bày
- Cài đặt thuộc tính slide PPTX
- Lấy thuộc tính bảo vệ trang chiếu
- Các phương pháp đã lỗi thời
Lấy thuộc tính của slide
Aspose.Slides Cloud cung cấp các tính năng để lấy Thuộc tính Slide bằng lệnh cURL và đồng thời, bạn có thể thử sử dụng SDK lập trình chuyên biệt cho ngôn ngữ để đáp ứng yêu cầu của mình.
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
{
// khởi tạo đối tượng SlidesAPI
Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret);
// Tạo đối tượng GetSlidesSlidePropertiesRequest và cung cấp tham chiếu PPTX đầu vào.
GetSlidesSlidePropertiesRequest request = new GetSlidesSlidePropertiesRequest { Name = "input.pptx" };
// Đọc thuộc tính Slide
SlideProperties slideProperties = slidesApi.GetSlidesSlideProperties(request);
// hiển thị chi tiết số trang đầu tiên
Console.WriteLine(slideProperties.FirstSlideNumber);
// in đ sæt chi tiết hướng của trang trình bày
Console.WriteLine(slideProperties.Orientation);
// print the height details for slide
Console.WriteLine(slideProperties.Height);
// print width details for slide
Console.WriteLine(slideProperties.Width);
// in thông tin liên quan đến scaleType
Console.WriteLine(slideProperties.ScaleType);
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Api: " + e.ToString());
}
Đặt thuộc tính slide PPTX
Tuy nhiên, Aspose.Slides Cloud hoàn toàn có khả năng thiết lập các thuộc tính cho các slide PowerPoint và trong phần tiếp theo, chúng tôi đã giải thích các bước liên quan.
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";
// khởi tạo đối tượng SlidesAPI
Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret);
// Tạo đối tượng PutSlidesSlidePropertiesRequest và cung cấp đầu vào PPTX làm đối số.
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);
// đọc thuộc tính width của slide
Console.WriteLine(response.Width);
// đọc thuộc tính chiều cao của slide
Console.WriteLine(response.Height);
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Api: " + e.ToString());
}
Lấy thuộc tính bảo vệ slide
Phương thức GetSlidesProtectionProperties của API cung cấp khả năng đọc các thuộc tính bảo vệ của tài liệu trình bày.
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";
// khởi tạo đối tượng SlidesAPI
SlidesApi slidesApi = new SlidesApi(Client_ID, Client_Secret);
// Tạo đối tượng PutSlidesSlidePropertiesRequest và cung cấp PPTX đầu vào làm tham số.
GetSlidesProtectionPropertiesRequest request = new GetSlidesProtectionPropertiesRequest
{
// speicfy input PowerPoint presentation
Name = "input.pptx",
};
ProtectionProperties slideProperties = slidesApi.GetSlidesProtectionProperties(request);
// đọc thuộc tính chiều rộng của trang trình chiếu
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());
}
Phương thức đã bị loại bỏ
PUT từ phương thức fromHtml đã bị loại bỏ và sẽ bị xóa trong phiên bản 21.4. Sử dụng phương thức POST fromHtml để tạo các bài thuyết trình và cũng thêm các trang mới vào chúng.
Tài nguyên slideSize đã lỗi thời và sẽ bị xóa trong bản phát hành 21.4. Sử dụng tài nguyên slideProperties thay thế.
Kết luận
Trong bài viết này, chúng tôi đã khám phá khả năng của Aspose.Slides Cloud để thiết lập các thuộc tính bảo vệ PPTX, lấy các thuộc tính bảo vệ Slide, Lấy các thuộc tính Slide bằng cách sử dụng C# .NET cũng như một lệnh cURL. Bạn có thể dễ dàng tải xuống mã nguồn hoàn chỉnh của Aspose.Slides Cloud SDK cho .NET từ GitHub. Để tìm hiểu thêm về các khả năng của SDK, xin vui lòng khám phá Developer Guide.