PavelS0 / docx_template_dart

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

TextContent keys #51

Open Elevencode opened 1 year ago

Elevencode commented 1 year ago

Hey!

I encountered a problem when using keys. Maybe I'm doing something wrong?

code:

final content = Content()
    ..add(TextContent('number', requisites.number))
    ..add(TextContent('date', requisites.date))
    ..add(TextContent('name', requisites.name))
    ..add(TextContent('address', requisites.address))
    ..add(TextContent('inn', requisites.inn))
    ..add(TextContent('kpp', requisites.kpp))
    ..add(TextContent('accountNumber', requisites.account))
    ..add(TextContent('korrAccount', requisites.korrAccount))
    ..add(TextContent('bank', requisites.bank))
    ..add(TextContent('bik', requisites.bik))
    ..add(TextContent('shortName', requisites.name));

  final d = await template.generate(content);

In my template I use variables in the following form: {number}, {date}, {name}, etc. Requisites parameters is not empty. But in content output I see:

{number: {}, date: {}, name: {}, address: {}, inn: {}, kpp: {}, accountNumber: {}, korrAccount: {}, bank: {}, bik: {}, shortName: {}} All parameters of requisites are String.

Elevencode commented 1 year ago

I'm sorry :D

In order to use the library, you need to learn how to insert and edit content control tags in Microsoft Word.

Elevencode commented 1 year ago

unfortunately, it still doesn't work. I tried to work with the template from the documentation, but the result is the same.