Add word document generator from template - #284
Conversation
- Ensure appClientId and tenantId are always required, regardless of directConnectUrl presence. - Adjusted resolveConfig() to prevent early exits that could lead to misleading errors. - Added 4 regression tests to enhance coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ctor results - Updated the skill description to include user input and results from previous tool or connector calls. - Modified the README to clarify the use of prior results and their integration into document generation. - Adjusted metadata to reflect the inclusion of connector results as valid sources. - Improved validation and generation rules to ensure accurate sourcing of information from approved knowledge, user files, and prior results.
… usage - Enhanced the skill description to specify that the Word template can be uploaded or retrieved from SharePoint, OneDrive, or other connectors. - Revised README to detail the template sourcing process and emphasize that the original template is never overwritten. - Adjusted metadata to reflect the updated description and broadened the tags to include SharePoint and OneDrive. - Improved instructions for locating and using the Word template during document generation.
- Revised README to replace the Information Security Policy template with the Leave Policy template, including updated document title and owner. - Adjusted SKILL.md to reflect changes in document structure, including new leave types and updated source document titles for HR context. - Enhanced examples to align with the new policy focus and ensure clarity in usage.
- Added a new section detailing the ideal structure for Word templates, including guidelines for using styles and placeholders. - Included a "Do's and Don'ts" list to improve template design and ensure compatibility with the document generation process. - Provided an example Leave Policy template to illustrate the recommended format and usage of placeholders.
…lity and template usage - Revised the skill description to clarify that the generator can create various document types, including policy, procedure, report, and paper. - Updated README to reflect changes in the template structure and provide clearer guidelines for document generation. - Enhanced metadata description and tags to better represent the skill's capabilities and supported document types. - Improved instructions for identifying and using the Word template during the generation process.
There was a problem hiding this comment.
Pull request overview
Adds a new submission to the submissions/ gallery: an instruction-only Copilot Studio skill for generating a new DOCX by filling a runtime-provided Word template (upload/SharePoint/OneDrive/connector), grounded in approved sources and prior tool/connector results.
Changes:
- Added
word-document-generator-from-templateskill instructions for template inspection, JSON mapping, population, and validation while preventing template overwrite. - Added a human-facing
README.mddescribing intended usage, inputs, and a generic Word template skeleton with examples. - Added
metadata.jsonregistering the skill for Copilot Studio with tags, author info, and versioning.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| submissions/word-document-generator-from-template/SKILL.md | Defines the agent-run procedure and guardrails for filling a runtime Word template and saving a new DOCX. |
| submissions/word-document-generator-from-template/README.md | Provides human-facing adoption guidance, template structure recommendations, and example prompts. |
| submissions/word-document-generator-from-template/metadata.json | Registers the submission (name/description/platform/tags/author/version/dates). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (3)
submissions/word-document-generator-from-template/SKILL.md:86
source_idsis described as holding tool/connector names likeDataverse:accounts, but the JSON example andsourcessection use stable IDs likeSRC-001. This inconsistency will cause the intermediate JSON to be structured differently depending on which part the agent follows.
- Treat prior tool and connector outputs as approved sources. Record the tool or connector name in `source_ids` (for example `Dataverse:accounts`, `SharePoint:policy-library`).
submissions/word-document-generator-from-template/README.md:43
- The README prescribes
{{placeholders}}, but Copilot Studio’s Word/Graph connector approaches typically require a specific templating mechanism (e.g., content controls), and the skill does not mandate any particular engine. As written, users could build templates that the runtime tooling can’t actually fill.
The same pattern works for every document type. Use **Word styles** (Heading 1,
Heading 2, Normal) and `{{placeholders}}` — not finished body text.
submissions/word-document-generator-from-template/SKILL.md:45
- The skill assumes it can inspect a
.docxtemplate and then populate it while preserving formatting, but it doesn’t first require/verify that an actual Copilot Studio action/tool exists that can (a) read the template and (b) write a new.docxfor the template’s placeholder/repeating-row syntax. Without that preflight, the procedure can’t be executed reliably.
1. Locate the Word template supplied at runtime. Obtain it from whichever source the user identified:
- a file uploaded with the request;
- SharePoint (library, folder, or site);
- OneDrive; or
- another connector or prior tool result that returns a `.docx` file.
…dling, validation, and JSON structure. Introduce deterministic engine for filling and inspecting DOCX files, ensuring preservation of live fields and branding. Update metadata and README for clarity on usage and capabilities.
…idation logic. Enhance JSON structure handling and update documentation for better clarity on features and usage.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
submissions/word-document-generator-from-template/scripts/docx_template.py:147
zipfile.ZipFile.read()can raiseRuntimeErrorfor encrypted/password-protected DOCX files (andzipfile.LargeZipFilefor large ZIP64 archives). Currently_read_package()only wrapsBadZipFile/OSError, so those cases would surface as an unhandled exception instead of aTemplateErrorwith exit code 2.
except (zipfile.BadZipFile, OSError) as exc:
raise TemplateError(f"Cannot read DOCX package {source}: {exc}") from exc
Title: Add word-document-generator-from-template skill