スライドプロテクションプレビュー

PowerPoint プレゼンテーションには、タイトル、著者名、主題、ドキュメントのトピックや内容を特定するキーワードなど、プレゼンテーションに関する詳細を含むプロパティがあります。プレゼンテーションのプロパティ属性に関連する値を指定することは重要であり、これによりプレゼンテーションを特定するのに役立ちます。一方、プレゼンテーション内の個々のスライドには、高さ、幅、向き、プレゼンテーション内のスライドインデックス、サイズタイプなどのプロパティが関連付けられています。Aspose.Slides Cloud を使用すると、プログラムから PPTX 保護プロパティを設定できます。

クイックヒント

次のコマンドを使用して、現在ホストされている Aspose.Slides Cloud API のバージョンを特定します。

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

レスポンスボディ

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

今、私たちはこのブログで以下のトピックについて光を当てるつもりです。

スライドのプロパティを取得する

Aspose.Slides Cloud は、cURL コマンドを使用してスライドのプロパティを取得する機能を提供しており、同時に、要件を満たすために言語固有のプログラミング SDK を使用することもできます。

cURL コマンド

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

リクエスト URL

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

レスポンスボディ

{  "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

// 完全な例は 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);
    // スライドの高さの詳細を印刷します。
    Console.WriteLine(slideProperties.Height);
    // スライドの幅の詳細を印刷する
    Console.WriteLine(slideProperties.Width);
    // scaleType に関連する情報を出力します。
    Console.WriteLine(slideProperties.ScaleType);
}
catch (Exception e)
{
    Console.WriteLine("Exception while calling Api: " + e.ToString());
}

PPTX スライドプロパティの設定

それにもかかわらず、Aspose.Slides Cloud は PowerPoint スライドのプロパティを設定する完全な機能を持っており、次のセクションでは関連する手順を説明しています。

cURL コマンド

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());
}

スライド保護プロパティを取得します

API の GetSlidesProtectionProperties メソッドは、プレゼンテーション文書の保護プロパティを読み取る機能を提供します。

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);
    // Create 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 メソッドは非推奨となり、21.4 リリースで削除されます。POST fromHtml メソッドを使用してプレゼンテーションを作成し、新しいスライドを追加してください。

slideSize リソースは非推奨であり、21.4 リリースで削除されます。代わりに slideProperties リソースを使用してください。

結論

このアーティクルでは、Aspose.Slides Cloud の PPTX 保護プロパティを設定し、スライド保護プロパティを取得し、C# .NET および cURL コマンドを使用してスライドプロパティを取得する機能を探求しました。Aspose.Slides Cloud SDK for .NET の完全なソースコードは GitHub から簡単にダウンロードできます。SDK の機能についてもっと学ぶには、Developer Guide をご覧ください。

関連する記事