Execute Mail Merge on Nested Mail Merge Regions in Word Document (TableStart & TableEnd) C# .NET

Hi… May I ask for a sample application on how to accomplish a nested TableStart please.

I was able to make the code work with single Table start… but i needed to have nested table start… since there is a table and questions inside of the table needed to be filled.

im using documentBuilder.MailMerge.ExecuteWithRegions(fsaBenefitSet); and

this is my xml…

<?xml version="1.0" encoding="utf-8"?>
<Reviews>
  <Review>
    <SectionDescription>Job Knowledge</SectionDescription>
    <SectionRating>1.00</SectionRating>
    <AdditionalComments>Joebet Mutia lacks competence in a number of the skills, knowledge, and abilities necessary to be successful in the job. He is unable to readily acquire new knowledge and skills as needed within a reasonable period of time .</AdditionalComments>
    <RatingDescription>Poor Performance</RatingDescription>
    <Questions>
      <Question>
        <QuestionDescription>Possesses specific skills, knowledge, and abilities required to competently perform the job</QuestionDescription>
        <AnswerValue>2</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Acquires new knowledge and skills as necessary to perform the job</QuestionDescription>
        <AnswerValue>2</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Stays current and up-to-date with developments in field of work</QuestionDescription>
        <AnswerValue>1</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Works independently and demonstrates capability as a self-starter</QuestionDescription>
        <AnswerValue>1</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Understands how job is related to the work of other employees and the company</QuestionDescription>
        <AnswerValue>1</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Utilizes appropriate resources (people, skills, services) to accomplish objectives</QuestionDescription>
        <AnswerValue>1</AnswerValue>
      </Question>
    </Questions>
  </Review>
  <Review>
    <SectionDescription>Quantity of Work</SectionDescription>
    <SectionRating>5.00</SectionRating>
    <AdditionalComments>Joebet Mutia is extraordinarily productive; his work is both quantitatively and qualitatively superior to most of his peers; he works at an excellent pace and continues to seek ways to further increase productivity . He distinguishes himself in consistently exceeding established goals.</AdditionalComments>
    <RatingDescription>Outstanding Performance</RatingDescription>
    <Questions>
      <Question>
        <QuestionDescription>Meets expectations for employee productivity</QuestionDescription>
        <AnswerValue>6</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Completes work on time</QuestionDescription>
        <AnswerValue>1</AnswerValue>
      </Question>
      <Question>
        <QuestionDescription>Reaches goals established for work products</QuestionDescription>
        <AnswerValue>6</AnswerValue>
      </Question>
    </Questions>
  </Review>
</Reviews>

@joebet.mutia,

Please see Nested-MailMerge-Documents.zip (90.4 KB) and try running the following simple code. Hope, this helps.

DataSet pizzaDs = new DataSet();
pizzaDs.ReadXml(MyDir + "CustomerData.xml");
Document doc = new Document(MyDir + @"Invoice Template.doc");
doc.MailMerge.ExecuteWithRegions(pizzaDs);
doc.Save(MyDir + @"18.3.doc");

thank you! the problem i have is that i still have a group inside the group reviews->questions->question… so it should be reviews->quetions only…

though its weird caues it should have a container…

but i already got the idea thanks for sharing!

@joebet.mutia,

It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

A post was split to a new topic: Get EmbedAttachment from a document and replace values using mail merge