PavelS0 / docx_template_dart

A Docx template engine
Apache License 2.0
40 stars 20 forks source link

How to create a new docs file #30

Open ChiuSky opened 1 year ago

ChiuSky commented 1 year 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 1 year ago

+1