GitHub CopilotとIronPPTを使用する方法
不動産会社では、購入者のエージェントに毎週金曜日にオープンハウスのデッキを送ります。 各物件リストには最大3枚の写真を含む1つのスライドがありますが、写真は電話やカメラから届くため、サイズ、形状、解像度が異なります。 .NETサーバーは、エージェンシーのリポジトリーでデッキを作成するため、このサーバーを変更するアシスタントは、すべての写真をゆがめずにフレーム内に収める必要があります。
GitHub Copilotは、Visual StudioとVS Codeでのチャットとエージェントモードを通じてリポジトリーにアクセスし、Copilot CLIをターミナルで、GitHubのクラウドエージェントを通じて、割り当てられたイシューをプルリクエストに変換します。IronPPTはMicrosoft Officeなしで.NETでPowerPointファイルを作成および編集することができます。AddImageはスライドに画像を配置し、Imageクラスはそれをサイズ変更、置換、削除します。 リポジトリーにコミットされた指示ファイルは、それらのサーフェスすべてにIronPPTのルールを提供します。
このガイドは、IronPPTを使用して写真を配置するソフトウェアを構築するためのCopilotの指示を説明します。 写真を撮影し、スライドテンプレートを設計することはリポジトリー外で行われる別々のタスクです。 画像管理ガイドには、リスティングデッキが依存するIronPPTの呼び出しが説明されています。
クイックスタートリポジトリーのルートでターミナルを開き、Copilot CLIを開始してプロンプトを送信します。 Copilot CLIは@を含んだファイルを添付しますが、Visual StudioのCopilot Chatは#参照を使用します。
Fill in @src/Listings.Deck/ListingDeck.cs so the agency can build its weekly open-homes deck.
The repo already pins IronPPT 2026.10.1 in Directory.Packages.props.
Here is what the deck code needs:
- One public static method, Build(string listingsPath, string photosDir, string outPath).
- Listings come from @data/listings.json.
- Each listing's photos are in photos/<listing id>/, under the file names the JSON gives.
- The cover and every listing slide follow @docs/listing-layout.md.
Then do these in order:
1. Add a build command with an --out <path> option to @src/Listings.Cli/Program.cs.
2. Build the solution.
3. From the repo root, run the CLI with build --out out/listings.pptx.
Tell me how many slides the deck has and how large the file is.
プロンプトにはボックスや座標の名称が含まれていません、なぜならdocs/listing-layout.mdがポイントで写真のボックスとテキストの行の順序を定義しているからです。
Copilotを実行する環境にIRONPPT_LICENSE_KEYを設定します。 IronPPTはそれだけではその名前を読みません。 私たちのテストでは、その変数のみを設定してもLicense.IsLicensedはfalseのままでした。 IronPPTはIronPPT.LicenseKeyとIRONPPT_LICENSEKEYという名前の変数を自力で読み取りましたが、サンプルリポジトリーは従来の名前をLicense.LicenseKeyにコピーします。 ライセンスキーガイド には、サポートされている他の場所がリストされています。
最小限のワークフロー(5ステップ)
- NuGetからC# PowerPointライブラリをダウンロード
- .github/copilot-instructions.mdと1つのパス専用の指示ファイルにIronPPTのルールを書きます。
- すべての写真に対して、その写真のピクセルサイズから計算された幅、高さ、および位置を指定します。
- 保存されたデッキの写真を変更するには、ドキュメントの画像リストを通じて写真を変更し、再びそのフレームを設定します。
- 次の変更をクラウドエージェントにイシューとして割り当て、IronPPT APIリファレンス に照らし合わせてプルリクエストを確認します。
CopilotのためにIronPPTの規約を設定するにはどうしますか?
プロジェクト全体のルールは.github/copilot-instructions.mdに配置します。 GitHubのサポートリファレンスは、このファイルをVisual Studio、VS Code、およびJetBrains IDEのCopilot Chat、そしてクラウドエージェントおよびCopilotコードレビューのためにリストしています。 Copilot CLIも同じ場所からこれを読み取ります。 Visual Studioはカスタム指示オプションが選択されている間にそれをロードしますが、そのオプションはデフォルトでオンになっています。
This repo builds the weekly open-homes deck with IronPPT. These rules apply to all of it:
- Use IronPPT, the NuGet package and namespace. Don't add another presentation or Open XML package.
- Edit the IronPPT entry in Directory.Packages.props only when the task is an IronPPT upgrade.
- Give other packages their versions in Directory.Packages.props as well.
- The code reads IRONPPT_LICENSE_KEY itself, because IronPPT doesn't look at that name.
- Copy the key into License.LicenseKey before the code saves a deck.
- Never print the key, and never list environment variables.
- docs/listing-layout.md is the contract.
- If the layout doc looks wrong, say so in your reply and leave the file as it is.
- The IronPPT docs index for agents is https://ironsoftware.com/ppt/csharp/llms.txt
Tests follow two more rules:
- A test saves a deck, reopens it and checks its pictures and text.
- Never compare the bytes of two decks.
IronPPTはランダムな数字で各画像を名前付けします(例:Picture 86115)。そのため、同じリスティングからの2つのビルドはバイトごとに異なります。 そのためにテストは画像とテキストを比較します。
デッキコードに独自のルールを与えるにはどうしますか?
.github/instructions/deck.instructions.mdのようなファイルは、そのapplyToパターンが名前付けするツリーの部分、ここではソースとテストプロジェクトのルールを保持します。 GitHubのドキュメントによれば、Copilot CLIはこれらのパターンの1つと一致するファイルで作業している時にのみファイルを含めます。 テストの実行では、Copilotはこのファイルを最初のプロンプトとイシュー別のセッションで他のファイルに先んじて開きました。
---
applyTo: "src/**,tests/**"
---
These rules cover IronPPT pictures and slides in the deck code and its tests:
- Every new PresentationDocument already has a slide. Make the cover from that slide.
- Don't add another slide in front of the cover.
- Give every picture an explicit Width, Height and Position, in points.
- Without them, IronPPT sizes a photo from its pixels and DPI.
- At 72 dpi, a 4032 x 3024 photo comes out 56 x 42 inches.
- The default slide is 10 x 7.5 inches.
- Setting Width leaves Height as it was, and the reverse.
- Work out both from the photo's pixel size to keep its aspect ratio.
- On a deck loaded from a file, call Replace on document.Images, not on a slide's Images list.
- Replace resets the picture to the new photo's own size.
- So set Width, Height and Position again after each Replace.
- Width, Height and Position read from a reopened deck are 12,700 times the value in points.
- AddImage with an AnyBitmap stores the picture as an uncompressed BMP.
- To store a resized photo as a JPEG, encode it first and pass the stream.
そのファイルの各ルールはIronPPT 2026.10.1のプローブから得られます。
IronPPTはリスティング写真をどのくらいの大きさにしますか?
サイズがないAddImageは写真のピクセル数をDPIで割った寸法のフレームを与え、位置は書きません。 デフォルトのスライドは10 x 7.5インチで、720 x 540ポイントです。
- 4032 x 3024の電話の写真が72 dpiで保存され、56 x 42インチのフレームを受け取りました。
- 同じ2048 x 1536の写真が300、72、96 dpiで保存され、6.8, 28.4, 21.3インチ幅のフレームを受けました。DPIのないPNGは96 dpiとしてサイズ付けされました。
- ヘッダーに単位のない1 x 1の密度のJPEGは1 dpiとしてサイズ付けされ、4032ピクセルの写真は4032インチ幅になりました。
- 幅、高さおよび位置はポイントを取ります。 幅のみを400に設定すると高さは変更されず、フレームは写真のアスペクト比を失いました。
したがってdocs/listing-layout.mdのフィットは写真のピクセルサイズから始まります。スケールファクターはボックス幅を写真幅で割ったものとボックス高さを写真の高さで割ったもののいずれか小さい方で、スケールされたフレームはボックス内で中央に配置されます。
保存済みデッキで写真を交換するにはどうしますか?
Swap the hero photo of L-1044 in out/listings.pptx for photos/reshoot/L-1044-front.jpg.
The photographer reshot the front, and the new photo is portrait.
Change the saved deck itself. Don't rebuild it from the JSON.
Add the swap to the CLI as a swap command with these options:
- --deck <path> names the deck to change.
- --listing <id> and --photo <n> pick the picture, counting photos from 1.
- --file <path> is the new photo.
The new photo goes in the hero box and follows the fit rules in docs/listing-layout.md.
Leave every other picture and all the text as they are.
Run the command, reopen the deck and show me the hero's position and size in points.
プローブでReplaceに3つの異なる結果が見られました。
- メモリ内でビルドされたデッキでは、Replaceが写真を交換しフレームを新しい写真の自身のサイズにリセットしましたが、位置はありませんでした。
- ロードされたデッキでは、
Imagesリストを介したReplace呼び出しは、プローブで要求された写真を変更しませんでした。 1枚の写真があるスライドでは古い写真が残され、新しい写真がファイルに使われずに保存されました。 2枚の写真があるスライドでは、最初の写真への呼び出しが2番目の写真を交換しました。 document.Imagesを介して、ロードされたデッキのReplaceは正しい写真を交換しました。 呼び出し後に幅、高さおよび位置を設定すると、フレームの適切なサイズと場所が与えられました。
画像管理ガイドのリプレイスサンプルでは、読み込まれたデッキでSlides[0].Images[0]を介してReplaceが呼び出され、それが古い写真をそのままに残すルートです。
出力
テストの実行では220 Mill Roadのスライドを交換前と交換後に保存しました。

最初のプロンプトとして保存されたスライド4、各写真が保存された位置とサイズで表示されました。テキストは描画されず、写真は生成されたテスト画像です。

交換コマンド後のスライド4、同様に描画されました。
デッキをテストするにはどうしますか?
Shift+Tabを使用してCopilot CLIを計画モードにサイクルし、このプロンプトを送信します。
Plan an xUnit project at tests/Listings.Deck.Tests, and put it in the solution.
Show me the plan first, and hold the code until I say go.
Each test builds a deck from data/listings.json in a temp folder and checks one of these:
- The deck has a cover plus one slide per listing, in the order of the JSON.
- Each listing slide holds one picture per photo, in the box the layout doc gives that photo.
- Every picture keeps its photo's aspect ratio within 0.5% and stays inside its box.
- The address, the price and the bed and bath line are on the right slide.
- The swap command changes the chosen picture and no other.
Once I say go, write the tests and keep running dotnet test until they pass.
Then tell me how many tests passed.
ボックスのテストはIronPPTが誤って報告するサイズを読み取る必要があります。 再オープンしたデッキから読み取った幅、高さ、位置は、その値にポイントで12,700倍された値を返し、これはPPTXファイルが保存する単位の値であるEMUsです。 480ポイントのフレームは6,096,000として読み取られました。実行からのテストはレイアウトと比較する前に読み取った値を12,700で割りました。
売りに出されたリストをマークすると写真が残るのはなぜですか?
このシナリオでは、チームメイトのSoldUpdate.csがループで売れたリストの写真を削除します。
Find out why marking a listing sold leaves photos behind, then fix it.
@src/Listings.Deck/SoldUpdate.cs edits a saved deck.
It should strip the listing's photos from its slide and add a SOLD line.
Work through these steps before you touch SoldUpdate.cs:
1. Write a test that builds a deck, marks L-1042 sold and counts the pictures left on its slide.
2. Read how https://ironsoftware.com/ppt/csharp/how-to/manage-image/ removes all images.
3. Tell me what Slide.Images returns in IronPPT that explains the leftover photos.
The fix has to meet these conditions:
- It changes SoldUpdate.cs and no other source file.
- The new test expects no pictures on the slide.
- dotnet test passes.
Last, mark L-1042 sold in a copy of out/listings.pptx.
Tell me the copy's size before and after.
Slide.Imagesは毎回アクセスするたびに新しいリストを作成します。 各パスで再びslide.Imagesを読み取り、アップカウントするインデックスを持つループは、削除の度に1枚の写真をスキップします。 4枚の写真があるスライドでは2枚を削除し、3枚のリスティングスライドでは2枚を削除し1枚を残しました。 画像管理ガイドのremove-allサンプルのように一度にリストの一部をforeachでループダウンするループはすべての写真を削除し、またforeachをそのリストの1つのコピーに適用しました。
削除もファイル内に写真のバイトを残します。13,766,065バイトのデッキから4枚の写真を削除すると、13,765,502バイトのファイルが保存されました。
クラウドエージェントが行動できる問題を作成するにはどうすれば良いですか?
イシューがCopilotに割り当てられると、GitHubはそのイシューのタイトル、説明、その時点で存在するコメント、および割り当て時に与えられた指示をエージェントに渡します。 その後に追加されたコメントはエージェントに届かないので、イシュー本文に全体を含める必要があります。
Title: Shrink the weekly deck so it can be emailed
Files: src/Listings.Deck/ListingDeck.cs and tests/Listings.Deck.Tests
Versions: IronPPT 2026.10.1 on net9.0
Expected: out/listings.pptx is under 4 MB, and the deck code works like this:
- IronPPT gets a scaled copy of any photo wider or taller than 1600 pixels.
- The copy is 1600 pixels on its long side and is stored as a JPEG at quality 85.
- Every picture keeps the box, position and size it has now.
Actual: IronPPT stores each photo file as it is, so the deck is over 15 MB.
Constraints: the change stays inside these limits:
- Keep the Build signature.
- Follow .github/instructions/deck.instructions.md.
- Add no packages.
- Leave the files in photos/ untouched.
Acceptance: the issue is done when all of this holds:
- The existing tests pass.
- A new test builds the deck and opens each photo stored under ppt/media in the saved file.
- That test fails if any stored photo is over the 1600-pixel limit.
Summary: give the deck's size before and after the change.
IronPPTは各写真ファイルをバイト単位でデッキにコピーし、3回追加された写真は3回保存されます。 AddImageにAnyBitmapとして渡されたスケーリングされた写真は、1600 x 1200ピクセルで7,680,122バイトの非圧縮BMPとして保存されました。 同じピクセルが品質85のJPEGとしてエンコードされストリームとして渡され、337,813バイトとして保存されました。
なぜクラウドエージェントのテストはIronPPTプロジェクトで失敗するのですか?
クラウドエージェントは、リポジトリが別の選択をしない限り、Ubuntu Linuxで実行されます。IronPPTは.NET Standard 2.0を対象とし、復元するパッケージにはネイティブファイルが含まれていないため、セットアップステップは.NET SDK以外の何もインストールしません。
ランナーにもライセンスキーはありません。 ライセンスキーなしでは、IronPPTはメモリ内でデッキを作成し保存されたデッキを読み取りましたが、Saveはライセンシング例外をスローしファイルを書きませんでした。そのためデッキを保存する各テストはランナーで失敗します。
GitHub は、エージェントが開始する前にcopilot-setup-stepsジョブを.github/workflows/copilot-setup-steps.ymlで実行し、そのファイルがデフォルトブランチにある場合のみ実行します。 セットアップステップが失敗すると、Copilotはその後のステップをスキップします。
Add a workflow at .github/workflows/copilot-setup-steps.yml to prepare the cloud agent's machine.
GitHub reads only a job named copilot-setup-steps from that file.
Set the job up this way:
- It runs on ubuntu-latest with contents: read as its one permission.
- It triggers on workflow_dispatch and on any pull request that edits this file.
Give it these steps, in order:
1. Check out the repo.
2. Set up .NET 9.
3. Run dotnet restore.
4. Run dotnet build -c Release.
5. Check for the license key.
IRONPPT_LICENSE_KEY is an Agents secret.
GitHub's docs say copilot-setup-steps.yml can use Agents secrets.
The key check handles a missing key in two ways:
- A pull_request or workflow_dispatch run gets a warning, and the step still succeeds.
- Any other run fails, and the error names the missing secret.
Write the file and print the YAML for me.
Then tell me how the key check reads the key, and cite the GitHub page you followed.
エージェントの秘密に鍵を設定してください: GitHubによるとクラウドエージェントはActions、Codespaces、Dependabotの秘密へのアクセス権を持ちません。 リポジトリの設定で、セキュリティセクションの秘密と変数を開き、エージェントを選択し、秘密タブにIRONPPT_LICENSE_KEYを追加します。 GitHubのドキュメントには、エージェントの秘密を読み取るセットアップステップの例はありません。
マージする前に何を確認すべきですか?
レビューをセッションを外れたcopilot -pコマンドとして分離して実行します。
/review this branch against main.
Compare the code with these three sources and list each spot where they disagree:
- the rules in .github/copilot-instructions.md
- the rules in .github/instructions/deck.instructions.md
- IronPPT.xml, which ships inside the IronPPT package in the NuGet cache
Also check for two patterns that no rule file covers:
- a loop that removes pictures while its index counts up
- a line that prints the message of a licensing exception
Tell me what you find, and say so if nothing turns up. Don't change any file.
プロンプトが実運用で生成したものは何ですか?
7つのプロンプトはこのガイド用に構築したリスティングリポジトリに対して無人でCopilot CLIで実行されました。別のチェックが保存されたデッキとリポジトリから以下のすべての数値を読み取りました。
- 実行前、ListingDeckは空のクラスでCLIは使用行を出力し、コード1で終了しました。
- 最初のプロンプト後、デッキには全体で15,150,897バイトのカバーと4つのリスティングスライドが含まれていました。
- 10枚の写真すべてが勾配にエラーレベルまでのアスペクト比、サイズまたは中央位置を持たずに、それぞれのボックス内に配置されました。
- スワップはdocument.Imagesを介して220 Mill Roadのヒーローを置換しました。
- ポートレートのリシュートはヒーローボックスの中央に位置し243 x 324ポイント測定されました。
- 他の9枚の写真やスライドテキストはスワップで変わりませんでした。
- 計画モードでは、Copilotは計画を書き、ファイルを変更せずに承認メッセージを待機しました。
- 修正はSoldUpdate.csのループを逆方向に変更しました。
- 18 Alder Courtを売却済みとマークするとそのスライドには写真がなくなりました。
- Copilotはリストの内部でのエントリシフトに残された写真を帰結させ、Slide.Imagesの各読み込みが新しいリストを構築する場合には言及しませんでした。
- 削除された3枚の写真、合計6,469,676バイトは、完売したコピーに残りました。
- イシューのセッションで長辺を1600ピクセルに9枚の写真をSixLabors.ImageSharpで縮小しましたが、これはすでにIronPPTが提供しており、パッケージは追加されませんでした。
- 再構築されたデッキは1,198,644バイトを測定しました。
- 各写真はそのサイズと位置を保持しました。
- キーが設定されると、すべての7つのテストが合格しました。 それなしでは、すべての7つはライセンシング例外で失敗しました。
- レビューセッションはブランチとmainを比較し、矛盾を報告せず、何もファイルを変更しませんでした。
- 一部のステップはページと異なる方法で実行されました。 イシューの本文はテストリポジトリにはGitHubリモートがないため新しいCopilot CLIのセッションに送られました。 設定ワークフローは書き込まれましたが、同じ理由で実行されませんでした。
Cursorもコミット済みのルールファイルを一致するパスに適用し、Claude Codeもコードを編集する前に承認のために計画を保持します。 共用の実行記録には、Copilot CLIのリリース、モデルのオート選択、持続時間、テスト機材がリストされています。
トラブルシューティング
- 追加写真と降順でカウントするremove-allループ用PowerPointでの画像管理方法
- 新しいプレゼンテーションにすでに保持されているデフォルトスライド用スライドの追加方法
- ライセンシング例外をスローする保存のためにライセンスキー適用方法
質問ありますか?
質問がある場合は、support@ironsoftware.com にお問い合わせください。
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。