generate_templates!() { /* proc-macro */ }Expand description
Scans a directory for .docx template files and generates a typed struct for each one.
Template paths are resolved as absolute paths at compile time, so binaries work regardless of working directory.
With the embed feature enabled, template bytes are baked into the binary via
include_bytes!, making it fully self-contained with no runtime file dependencies.
§Usage
ⓘ
use docxide_template::generate_templates;
generate_templates!("path/to/templates");For each .docx file, this generates a struct with:
- A field for each
{placeholder}found in the document text (converted to snake_case) new()constructor taking all field values asimpl Into<String>save(path)to write a filled-in.docxto diskto_bytes()to get the filled-in.docxasVec<u8>