1.7 KiB
Learned document templates
DOCX Workbench supports two deterministic workflows:
TemplateLearningServicenormalizes a.docor copies a.docxinto a temporary working directory, inspects it, adds a safe{{DOC_BODY}}insertion marker to the working copy, and writes a portable.dtemplateZIP package.TemplateDocumentGeneratoropens the package, replaces explicitly supplied scalar tokens, imports a.doc,.docx, or.txtbody through the existing main-story importer, and creates DOCX, PDF, generation, and validation outputs.
The package contains manifest.json, template.docx, source metadata, page archetypes, regions, slots, field bindings, mapping suggestions, and a validation profile. It contains no original source binary unless it is the normalized template copy.
All Word automation is late-bound and serialized through the existing STA queue. Binary .doc sources are opened read-only, macros are disabled through Word automation security, and the source SHA-256 is checked before and after normalization. The source body’s headers, footers, section properties, and page setup are excluded by DocxBodyImporter.
The current UI exposes three modes: template learning, document generation, and the existing quick DOC_BODY path. Page archetypes and slot proposals are deterministic suggestions and require later user confirmation; Ollama is not required for the workflow.
Known limitation: the first slice stores the learned structural model and default slots, but does not yet provide a pixel-level page editor or automatic extraction of every scalar field from an arbitrary engineering drawing. Those operations remain explicit user mapping work.