PavelS0 / docx_template_dart

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

non-filled tags get deleted when generating file #12

Closed drvnm closed 3 years ago

drvnm commented 3 years ago

i have a few tags which i dont want to get deleted when i dont fill them, enabling the option "never delete this tag" in word doesnt work, how can i do this?

PavelS0 commented 3 years ago

at the moment, all tags are deleted during generation, I will try to add a flag for saving tags in the next update.

drvnm commented 3 years ago

@PavelS0 thanks :)

drvnm commented 3 years ago

@PavelS0 would you have a time estimate on the update? id love to use this in my project

PavelS0 commented 3 years ago

content inside tags now saved if it not filled. Fixed in c86a1b7

drvnm commented 3 years ago

@PavelS0 thanks for working on this, but is it possible for the tags to be saved instead of the content inside them?

drvnm commented 3 years ago

@PavelS0 will this be fixed?

PavelS0 commented 3 years ago

added in 5b786b9 added new enum:

/// [removeAll] - remove all sdt tags from document
///
/// [saveNullified] - save ONLY tags where [Content] is null
///
/// [saveText] - save ALL TextContent field (include nullifed [Content])
///
enum TagPolicy { removeAll, saveNullified, saveText }

it must be passed as argument docx.generate(c, tagPolicy: TagPolicy.saveNullified);

drvnm commented 3 years ago

works, thanks!