docx_filler 1.0.3
docx_filler: ^1.0.3 copied to clipboard
docx filler
docx_filler #
docx_filler — это библиотека для заполнения DOCX-шаблонов на Dart.
Она позволяет заменять метки (placeholders) в файле .docx на реальные данные, создавая готовые документы без необходимости использовать Microsoft Word или другие внешние программы.
🚀 Возможности #
- Поддержка заполнения шаблонов DOCX с произвольными метками
- Гибкая обработка текста, таблиц и картинок
- Простая интеграция с Flutter-приложением
- Работает полностью на Dart
📦 Пример использования #
import 'dart:io';
import 'package:docx_filler/docx_filler.dart';
import 'package:path/path.dart' as p;
void main() async {
final scriptDir = File(Platform.script.toFilePath()).parent.path;
final imageData = <String, String>{'cat': 'cat.jpg', 'dog': 'dog.jpg'};
final textData = <String, Object>{
'checklist.name': 'Checklist #1',
'points': [
{'name': 'point #1', 'result': 'success'},
{'name': 'point #2', 'result': 'fail'},
],
};
final inputDocx = p.join(scriptDir, 'template.docx');
final outputDocx = p.join(scriptDir, 'filled_template.docx');
await DocxFiller.fill(
inputDocx: inputDocx,
outputDocx: outputDocx,
textData: textData,
imageData: imageData,
);
}