PavelS0 / docx_template_dart

A Docx template engine
Apache License 2.0
43 stars 31 forks source link

How to create a new docs file #30

Open ChiuSky opened 2 years ago

ChiuSky commented 2 years ago

I try to create a new doc file, but when I invoke DocxTemplate.fromBytes(await f.readAsBytes()), get error [VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: FormatException: Could not find End of Central Directory Record here is my code

final f = await LLCFileUtil.getLocalFile('test', 'template.docx');
    if (!f.existsSync()) {
      f.createSync();
    }
    final byte = await f.readAsBytes();
    final docx = await DocxTemplate.fromBytes(byte);

and the f.path was /var/mobile/Containers/Data/Application/AB671DDF-9D0E-4B40-B7A9-2252E71F433E/Documents/test/template.docx

kekko7072 commented 2 years ago

+1