Closed sputtw closed 1 year ago
I have the same issue, any fix to this?
what version of the dart sdk and docx_template are you using?
Dart SDK version: 2.13.3 (stable) and docx_template version: docx_template: ^0.3.1
in the example, there was data that did not match the template, I updated it, now it should work. Try to use new example.
You can delete the image loading lines for the test:
final testFileContent = await File('test.jpg').readAsBytes();
..add(ImageContent('img', testFileContent));
Thank you Pavel for such a fast reply! I just tested it out and it worked like a charm. Thank you! Now I just gotta set up my own template. Do you think i can do it with Libre Office Writer?
I've tried LibreOffice Writer, but it doesn't support content controls tags in the way that MS Word supports.
I am currently using MS Word 2007 via PlayOnLinux.
Well iam almost done with my template and did use MS word on my windows computer to do the tags. Everything works great! Only thing i have been stuck on today is to add table rows in a dynamic way. This code only takes the last image from the list and adds it to the document . If i do it manually like the example you provided it works fine. Any tips on how i can add rows in a template in a dynamic way?
for(var val in imageMap.values){
if(val.image != null){
c.add(TableContent("table_img", [
RowContent()
..add(TextContent("key1", val.imageText))
..add(ImageContent('img', await val.image.readAsBytes())),
]));
}
}
Hi, i get this error : E/flutter (16144): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type 'TextContent' is not a subtype of type 'PlainContent?' of 'c'
but i read that you said youu fixed it in commit a864546 but it still don't work for me
code.. throws this error when i do "await docx.generate(c);"