hello,
i have come throught multiple document creation : image, excel, power point. To be honest, word will be my next try next week.
What i can share you throught all my test.
I recommand you to use the Prompt from tools (AKA Ai Builder prompt), enable code interpreter and then go to GPT 5 Chat (not reasoning, it will timeout)
I don't recommand from copilot studio directly, i recommand from AI Builder prompt and use it inside a flow, this way you will
- test in AI builder,have a very big prompt windows, and when the result is stable, the generated code will be lock when clicking on save button, this way you will 100% accurate result every time
- since it will generate python : use another AI tool to help you like copilot or last version of GPT 5.2 wich is good enough to help in this case : explain the case, give the desired file, give the result, the prompt, the generate code and then the AI will help you build a prompt for AI builder wich all request abouht the code generation to avoid this kink of problem
- then save and use an agent flow to get the file in base 64 and save it wher eyou wan t (often in one drive of the user, it s great to keep track)
last suggestion : when i made pptx generation i found myself that the python was very sensitive of the quality of the hidden layout of the pptx. I think for word it will be nearly same, the police layout (title 1, subtitle 1 etc) will need to be perfect too.
if this help you to resolve the case, please mark the answer as verified, it's important for the community :)