如何使用IronPPT與ChatGPT Codex
營運團隊每週一發送相同的簡報。 範本提供投影片,並填入本週數據。 單一區域投影片變成每個區域一張,舊的促銷投影片被移除,附錄仍在文件中但不在簡報裡。 當投影片操作失敗時,簡報仍會保存,工作日誌仍報告成功。 區域經理人隨後收到6月30日結束的促銷回顧,在本週亮點之前的一張投影片。
ChatGPT Codex是由OpenAI開發的編程代理。 它在儲存庫中運作,編輯檔案,執行命令,例如dotnet run並報告更改內容。 相同的代理在終端中運行,也在IDE擴展、ChatGPT桌面應用程式和雲端中運行。 IronPPT是Iron Software用於PowerPoint的.NET程式庫,能在無Microsoft Office的情況下創建、開啟、編輯和保存.pptx檔案。
Codex獲取每週銷售範本、規則文件和兩週的區域數據。 它報告的每個投影片計數都來自相同輪次寫入的CSV,每個投影片操作在批次代碼依賴前都在已保存的簡報上測試。
快速開始在一個包含Templates和Data資料夾的.NET 9主控專案中啟動Codex。
$ironppt Install IronPPT 2026.10.1 in this console app and list the slides of the sales template.
Program.cs opens Templates/weekly-sales-template.pptx and saves nothing.
Each slide gets a row in out/quickstart.csv, with these columns:
- number, counting from 1
- heading, the first text on the slide
- texts, how many text items the slide holds
- shown, yes or no from the slide's Show property
Program.cs reads IRONPPT_LICENSE_KEY itself and copies it into License.LicenseKey.
Never print the key or write it to a file or log, and don't list environment variables.
If three builds or runs fail, stop and show me the last error.
Otherwise, read the slide count back from the CSV and tell me the number.
提及$ironppt會在Codex寫代碼前加載IronPPT的技能。
最小工作流程(5 個步驟)
- 從NuGet下載C# PowerPoint程式庫
- 將IronPPT的技能保存為.agents/skills/ironppt/SKILL.md,以便
$ironppt提及能解決 - 提交一份命名為AGENTS.md的文件,指定簡報規則,並僅接受重新打開的簡報作為證明
- 使用
Remove()來移除範本投影片,將移動或重複的投影片構建為新投影片 - 重新打開保存的簡報並比較每張投影片與計劃
ChatGPT Codex是什麼,它如何適用於.NET簡報工作?
當Codex編輯檔案或執行命令時,/permissions命令設置。Codex CLI文件涵蓋安裝和終端使用,其開源庫發布了版本。
Codex對IronPPT的了解來自於其訓練數據和所提供的文件。 IronPPT缺失的成員名稱導致構建失敗。
IronPPT提供.NET Standard 2.0程序集,其NuGet包支持Windows、Linux和macOS。 測試運行在Windows上構建了專案。
如何為IronPPT編寫提示,並為其設置Codex?
以下提示中名稱為範本與數據(Templates/weekly-sales-template.pptx 和 Data/week-41.csv),以及規則(Data/README.md,設定順序、省略和隱藏的投影片和主題風格)。
Codex在工作的目錄中查找.agents/skills每個文件夾直到儲存庫根目錄上。 每個技能是一個包含SKILL.md的文件夾,SKILL.md的前置資料定義名稱和描述。 將IronPPT的skill.md保存為.agents/skills/IronPPT/SKILL.md可以解決$ironppt提及。 技能聲明它經過IronPPT 2026.8.1檢查,而本指南安裝2026.10.1。
Codex在開始任何工作前讀取AGENTS.md。 它從儲存庫根路徑走到工作資料夾,最多取每個目錄一個文件,讓更深層的文件覆蓋較淺層的文件。 /init命令生成初稿。
Write an AGENTS.md in the repository root, under a heading called Weekly sales deck.
Put these rules in it, one per line:
- IronPPT 2026.10.1 is the only PowerPoint library here. Package and namespace are both IronPPT.
- Don't add DocumentFormat.OpenXml or any other Office package.
- Data/README.md defines the deck, and it wins over anything else.
- Templates/ and Data/ are read-only.
- Look up IronPPT members in the ironppt skill under .agents/skills/ironppt/.
- A probe on a saved deck outranks both the skill and the installed IronPPT.xml.
- A deck counts as built only once it's saved, reopened from disk and checked.
- Every count you report comes from a CSV written in that turn. The reply names that CSV.
- The key stays in IRONPPT_LICENSE_KEY.
Show me the finished file.
如何請求Codex添加IronPPT並檢查授權?
Show me the IronPPT PackageReference in WeeklySalesDeck.csproj and the version NuGet resolved.
Then quote the full output of dotnet list package with --include-transitive.
Don't change any package references.
IronPPT 2026.10.1依賴於IronSoftware.Common 2026.4.2與IronSoftware.System.Drawing 2026.8.2,測試運行的包清單顯示了30個瞬間包,其中有SixLabors.ImageSharp 3.1.12和Grpc.Net.Client 2.62.0。釘版本釋出前檢閱IronPPT更新日誌。
沒有金鑰的話,IronPPT可以開啟簡報,讀取其文字,添加投影片和文字,並隱藏投影片。 只有Save失敗,出現生產授權要求例外,無法寫入文件。 IronPPT自行從IronPPT.LicenseKey或IRONPPT_LICENSEKEY環境變數中讀取金鑰,但忽略IRONPPT_LICENSE_KEY。 仍將金鑰保存在該名稱下的代碼在第一次保存前指定License.LicenseKey。 在IronPPT 2026.10.1中,授權例外類型不是公共的,所以處理器捕捉Exception並檢查類型名稱。
Move the key line into Startup.ApplyIronPptKey and call that method first in Program.cs.
It sets License.LicenseKey from IRONPPT_LICENSE_KEY, then prints License.IsLicensed.
Next, test what IronPPT does without a key.
Start the program three times as child processes, each with a --licence-check option:
1. Clear IRONPPT_LICENSE_KEY for that child only.
2. Keep the variable set, and pass a --no-startup flag that skips the Startup call.
3. Keep the variable set and the Startup call in place.
Each child opens the template, replaces {{WEEK}} with 41 and saves out/licence-check-N.pptx.
Write each call to out/licence-check.csv, with run, call, result, exception type and message.
Add a column that says whether each pptx file exists afterwards.
If three repair attempts fail, stop there.
Tell me which of the three runs saved a file.
授權金鑰頁面列出了提供金鑰的其他方式。
為什麼指南的投影片代碼不改變簡報?
管理投影片指南用Slides.RemoveAt移除投影片,用Slides.Remove加Slides.Insert移動投影片,IronPPT技能描述Slides為可變名單。在IronPPT 2026.10.1中,PresentationDocument.Slides每次被讀取時返回新的名單,那些調用僅更改那個副本。 在校準時,Slides.RemoveAt(0)在一個加載的六張投影片簡報上留下計數為六,並且一個保存的簡報在移動後保留其原始順序。 代碼編譯、未拋出異常並保存應移除的投影片。
對現有投影片的三個操作達到簡報。 自己調用Remove()會把它從保存的文件中刪除,Show = false寫入一個仍保存在文件中的隱藏投影片。設置Slide.Index移動投影片,一個分開的探針重新打開了已保存的簡報以新的順序。
Probe which slide operations survive a save, in a console app at scratch/slides-probe/.
Run it yourself on a copy of the template in scratch/, and apply the key the way Startup does.
Add a Compile Remove item that keeps scratch/** out of WeeklySalesDeck.csproj.
Give each case its own try block and its own saved file.
Reopen each saved file and measure these cases:
- Slides.RemoveAt(4), and whether the slide count drops
- Slides.Remove, then Slides.Insert(1, ...) on Highlights, and the order that results
- Remove() on the Q2 Promotion Recap slide itself
- Clone() on the region slide
- AddSlide(new Slide()) with AddText, and where the new slide ends up
- Show = false on the appendix
Then have the explorer agent read IronPPT.xml and the ironppt skill, writing nothing.
It reports what each source says about the Slides collection and about Clone.
Put every finding in out/slides-probe.csv, quoting the probe output, the XML or the skill.
Mark the rows where the skill and the probe disagree, and tell me which they are.
檢查編輯過的名單物件是通過的,因為該副本確實更改了。
您如何從範本組裝每周的簡報?
管理投影片指南未涵蓋複製投影片。在IronPPT 2026.10.1中,Clone()在投影片上會引發MissingMethodException,且兩次添加相同的投影片對象使得保存的文件中沒有多餘投影片。刪除後再接著在末尾添加留下了其舊位置的空投影片。 工作的方法是每個輸出投影片添加一個新的Slide,用新的文本填滿它,按簡報需要的順序,然後在範本原件上調用Remove()。
從已加載的簡報複製樣式也失敗了。 在校準時,一個36 pt的標題被逐個屬性複製寫成3,600 pt,顏色#1F4E79變為黑色。 因此,提示把README的主題風格設置於每個文本上。
範本按照README的投影片列表,第五個是Q2促銷回顧,第六個是亮點。
測試運行中使用的每週銷售範本,擁有一張持有區域標記的區域投影片。
Have the worker agent write Services/DeckAssembler.cs. It builds the deck Data/README.md describes.
DeckAssembler accepts these options:
- --week, which picks Data/week-NN.csv and Data/week-NN.tokens
- --template, defaulting to Templates/weekly-sales-template.pptx
- --plan, which writes out/deck-plan.csv and saves no deck
- --build, which saves out/week-NN.pptx
The probe showed which calls reach the saved file.
Build the deck with those calls, in these steps:
1. Open the template and find each slide by its heading.
2. For every output slide, add a new slide with AddSlide and write its texts with AddText.
3. Set the README's house style on every text you write.
4. Set Show = false on the new appendix slide.
5. Call Remove() on the eight template slides, then save.
The plan CSV has one row per output slide, with position, template heading, final heading and shown.
Run --plan --week 41, then give me the row count and the hidden slides from the CSV.
如何檢查Codex保存的簡報?
Run --build --week 41, then check the saved deck with code that's separate from the build.
The check reopens out/week-41.pptx and writes out/week-41-check.csv with these columns:
- position and heading
- shown
- the slide's full text, joined with " | "
- whether any {{ is left
Compare the check CSV with out/deck-plan.csv row by row.
Tell me which rows differ, and whether Q2 Promotion Recap appears anywhere in the deck.
輸出
DeckAssembler在測試運行中保存了下面週41的簡報,且其發佈未經改變。
IronPPT保存的週41銷售簡報。
當範本發生變更時會如何?
Show me that DeckAssembler refuses Templates/weekly-sales-template-v2.pptx.
Marketing sent it with Highlights renamed to Wins This Week.
Run --build --week 41 --template Templates/weekly-sales-template-v2.pptx.
The existing out/week-41.pptx has to stay the same, byte for byte.
Record the attempt in out/template-check.csv with these columns:
- exit code and message
- the headings the build found
- the SHA-256 of out/week-41.pptx before and after
Tell me whether the two hashes match.
如何檢查截圖中的投影片?
Codex接受圖像作為上下文。 啟動或恢復會話時,傳遞一個含-i旗標(長格式--image),或者將其粘貼到互動作曲家中。
Check the screenshot I attached with -i against the data and the deck.
A regional manager sent it and says the West revenue is wrong.
Don't change any code, and work through these steps:
1. Read the region and its three figures from the image.
2. Compare them with Data/week-41.csv and Data/week-40.csv.
3. Compare them with the West slide in out/week-41.pptx, using its text in out/week-41-check.csv.
4. Write the comparison to out/screenshot-check.csv.
Tell me which week the screenshot shows, and whether out/week-41.pptx is right.
如何對不正確的簡報輸出進行端到端調試?
Find out why the week 40 deck went out wrong. Data/week-40-complaint.md lists four problems.
Logs/week-40/deck.log says every step worked. Output/week-40.pptx is the deck that was sent.
Have the explorer agent read Jobs/LegacyWeeklyDeck.cs, the log and the deck before anything else.
A throwaway script under scratch/ may read the deck.
Don't edit any code outside scratch/.
Write out/week-40-diagnosis.md and cover these points in it:
- the line behind each of the four problems
- why the log reported success anyway
- the smallest fix for each, based on what the probe showed
Then give me one line per problem.
在允許任何編輯之前檢查診斷。 遺留工作在每次調用返回後都寫入日誌行,從未重新打開簡報。
如何將一次性代碼轉變為可重用的、經過測試的組件?
Ask the worker agent for a DeckService class that meets these conditions:
- It resolves from a Microsoft.Extensions.DependencyInjection container.
- A DeckOptions record configures it, with week, template, plan-only and output folder.
- It keeps the README rules, the heading check and the house style from DeckAssembler.
- DeckService.cs stays below 150 lines, and its public members have XML doc comments.
- Nothing calls Jobs/LegacyWeeklyDeck.cs.
Then build week 41 with DeckService into out/final/week-41.pptx.
Check that deck the way you checked out/week-41.pptx, into out/final/week-41-check.csv.
Compare the two check files and list every difference.
重構可以丟掉標題檢查並依然編譯。
Add an xUnit project at tests/WeeklySalesDeck.Tests, in the same solution as the main project.
Exclude tests/** from what the main project compiles.
The tests get the key through Startup.ApplyIronPptKey.
Each test builds a deck in a temp folder and reopens it.
Between them, the tests check these conditions:
- week 41 gives 11 slides, with Highlights second and the appendix hidden
- the five region slides follow the CSV order
- East shows Revenue: $0 and still has its slide
- no {{ is left anywhere, and Q2 Promotion Recap is gone
- the v2 template is refused, and the message names the missing heading
Run dotnet test with --logger trx and --results-directory out/tests/.
Read the trx file and tell me how many tests passed and failed.
對於API問題,安裝的IronPPT.xml文件記錄了投影片成員,如AddSlide, Remove, Clone, Index和Show。 探針結果顯示哪些達到了保存過的簡報。
$ironppt List the members in the installed IronPPT.xml that add, remove, move, copy or hide slides.
For each member you find, tell me these two things:
- what the XML says it does
- whether out/slides-probe.csv or the trx file in out/tests/ shows it working on a saved deck
Then write one compiling line per member in a probe project under scratch/api-probe/.
Build that probe with dotnet build, but don't run it.
您如何在另一個簡報上重用這些提示?
在範本、數據文件和README規則變更後,相同的提示適用於董事會包、專案狀態簡報或顧客評論。 適用於每個助手的設置,請參考IronPPT AI代碼助手指南。
在實際運行中,這些提示產生了什麼結果?
以上提示被依序發送至Codex,在一次會話中。 遺留工作、其日誌和簡報是在調試提示之前添加的。 單獨的腳本重新打開了運行保存的每個簡報並讀取了文件中的每張投影片。
- 運行之前,範本裡有八張投影片,所有的都顯示出來了。
- 清除變數後,保存時引發了授權例外,隨後輸出文件不存在。
- 設置變數和跳過啟動呼叫時,保存以相同方式失敗。
- 在探針裡,Slides.RemoveAt(4)在保存文件中留下了所有八張投影片。
- 在區域投影片上調用Clone()引發MissingMethodException。
- Codex啟動三個子代理,調試提示重用了探針提示中的閱覽器代理。
- 已保存的週41簡報按照README順序持有了11張投影片,其中五張區域投影片按照CSV順序排列。
- 十張投影片顯示,附錄保存為隱藏。
- Q2促銷回顧在簡報中缺席。
- 東部保留其營收為$0的投影片。
- 被拒絕的v2範本讓現有簡報的SHA-256雜湊保持不變。
- Codex將截圖與週40西部數據匹配。
- 診斷將週40的每個問題與其在遺留工作中的幾行聯系起來。
- 診斷追溯到隱藏的北部投影片到重用的區域投影片,Slides.Last()返回。
- 使用DeckService建造的簡報在每張投影片上與第一次建造匹配。
- Codex運行中和我們測試的五個測試都通過。
- 一些步驟與頁面上運行的不同。 - NuGet包來自在運行前恢復的緩存,因為沙盒沒有網路。
GitHub Copilot指南測量對於圖片的類似失敗,來自管理圖片指南的Replace呼叫將舊照片留在加載的簡報中。 Google Antigravity指南為同時的網頁請求構建簡報,IronPPT僅當一個鎖保護每個IronPPT呼叫時提供正確服務。 共享的運行記錄提供了Codex版本、模型、時間和測試機器。
疑難排解
問題?
如果您有任何疑問,請聯繫support@ironsoftware.com
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。