Scenario -
I have a document template with few fields lets say USERNAME, AGE, SEX and ADDRESS in a table. All these fields are setup as "Plain Text Content Control". This table row along will all these fields are setup as "Repeating Section Content Control" as shown below.
Question -
How do I repeat the table row and populate these fields for various USESRNAME. I have written the below code.
File.Copy(Repeater, RepeaterResult);
var repeatertoFill = new Content(new RepeatContent("Repeater2")
.AddItem(
new FieldContent("NAME1", "Smith"),
new FieldContent("AGE1", "50"),
new FieldContent("SEX1", "M"),
new FieldContent("ADDRESS1", "Address Smith"))
.AddItem(
new FieldContent("NAME1", "Mary"),
new FieldContent("AGE1", "50"),
new FieldContent("SEX1", "F"),
new FieldContent("ADDRESS1", "Address Mary"))
.AddItem(
new FieldContent("NAME1", "David"),
new FieldContent("AGE1", "50"),
new FieldContent("SEX1", "M"),
new FieldContent("ADDRESS1", "Address David"))
using (var outputDocument = new TemplateProcessor(RepeaterResult))
{
outputDocument.FillContent(repeatertoFill);
outputDocument.SaveChanges();
}
However, I get this error "Field content for field '' not found".
I would like my final word file to look something like this..
I am new to this package and hence any insights to use RepeatContent on a table is appreciated.
Scenario - I have a document template with few fields lets say USERNAME, AGE, SEX and ADDRESS in a table. All these fields are setup as "Plain Text Content Control". This table row along will all these fields are setup as "Repeating Section Content Control" as shown below.
Question - How do I repeat the table row and populate these fields for various USESRNAME. I have written the below code.
However, I get this error "Field content for field '' not found".
I would like my final word file to look something like this..
I am new to this package and hence any insights to use RepeatContent on a table is appreciated.