docx_template
0.4.0, released 3 years ago by an unverified publisher
A template engine for generating Microsoft Word .docx files.
What it does
Allows developers to load a Microsoft Word template containing custom content control tags and generate a populated .docx file by passing structured content like text, lists, tables, and images.
AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to programmatically generate filled Word documents (.docx) from templates.
- Your workflow relies on Microsoft Word content control tags.
Skip it when
- You need to use LibreOffice or other office programs that lack a content control tag system.
- You need to edit documents outside of Microsoft Word's tag creation toolset.
Strengths
- Supports lists, tables, text, plain blocks, images, and hyperlinks.
- Compatible across multiple platforms including Android, iOS, Web, Windows, macOS, and Linux.
- Allows custom tag and image policies during generation.
Weaknesses
- Requires Microsoft Word to set up and edit content control tags.
- LibreOffice and other non-Word office programs are not supported.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Requires downloading a template file, opening it in Microsoft Word, enabling Developer mode, and configuring content control tags.
final f = File("template.docx");
final docx = await DocxTemplate.fromBytes(await f.readAsBytes());
Content c = Content();
c.add(TextContent("docname", "Simple docname"));
final d = await docx.generate(c);
final of = File('generated.docx');
if (d != null) await of.writeAsBytes(d);Alternatives
Packages that do the same job and could replace docx_template.
- pdfrx_engine
Pure Dart PDF rendering and manipulation API built on top of PDFium.
90Compare - pdf_manipulator
Cross-platform PDF toolkit for Flutter. Merge, split, render, extract, search, sign, encrypt, convert, build from scratch. Rust engine, off the main thread.
83Compare - docx_file_viewer
Renders DOCX files using native Flutter widgets without WebView or PDF conversion.
78Compare - docx_creator
Create, read, edit, and convert DOCX files to PDF, HTML, and Markdown in pure Dart.
76Compare
Works with
Packages commonly used together with docx_template: ones it builds on, ones built on it, and its own family.