Open zii-dmg opened 6 years ago
Word error message when opening (in russian):
Template: HiddenRepeatReproTemplate.docx
Repro:
using System; using System.IO; using TemplateEngine.Docx; namespace HiddenRepeatRepro { static class Program { static void Main(string[] args) { string templateFile = "HiddenRepeatReproTemplate.docx"; string outputFile = "HiddenRepeatRepro.docx"; File.Delete(outputFile); File.Copy(templateFile, outputFile); var repeat = new RepeatContent("repeat1") .AddItem(new FieldContent("val", "123")) .AddItem(new FieldContent("val", "456")); repeat.Hide(); // breaks document var table = new TableContent("table1") .AddRow(repeat); var content = new Content(table); using (var template = new TemplateProcessor(outputFile).SetRemoveContentControls(true)) { template.FillContent(content); template.SaveChanges(); } } } }
Word error message when opening (in russian):
Template: HiddenRepeatReproTemplate.docx
Repro: