generate_csharp_script
Convert an existing Word document into a runnable C# script that reproduces the file. Use it to inspect document structure or as a starting point for editing via Kookerella.CsWordDsl.
Instructions
Reads an existing Word document and returns a self-contained C# file (using Kookerella.CsWordDsl) that rebuilds an equivalent file when run via dotnet run <file>.cs (.NET 10's file-based apps feature - no .csproj needed). The C# equivalent of generate_fsharp_script, for a caller who wants pasteable/ runnable C# rather than F# - useful for explaining how a file is structured, or as a starting point for the wrapper's fluent API (named styles, tables, images, headers/footers, comments, track changes, content controls, protection, etc. - Kookerella.CsWordDsl covers the same feature set as generate_fsharp_script's own Kookerella.FsWordDsl) beyond what create_document exposes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to an existing .docx/.docm file to reverse-engineer into C# source. | |
| outputFileName | Yes | The output filename the generated script should save its rebuilt file to, e.g. "output.docx". |