We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Merge an inner table

Hi,

I need to merge an inner merge fields table inside another merge fields table, here is an example of my word document :

«TableStart:Student»
«StudentName»

«TableStart:Teachers»
«TeacherName»
«TableEnd:Teachers»

«TableEnd:Student»

Thanks in advance

7 Replies

SK Sarath Kumar G Syncfusion Team April 24, 2007 03:56 AM UTC

Hi Mehdi,

Thank you for your interest in Syncfusion products.

It is possible to perform MailMerge inside another Mail Merge declaration. The sample attached makes use of two databases and the Merge fields of one table are merged inside
another Merge fields of another table. Here is the sample for your reference,

http://websamples.syncfusion.com/samples/DocIO.Windows/F_59810/main.htm

Hope so my understanding is correct. If not please explain me the issue in details, so that it will more helpful to investigate further.

Please let me know if you face any issues.

Regards,
Sarath


ME Mehdi April 24, 2007 02:48 PM UTC

Hi Sarath,

Thnks for the quick answer but I think you misunderstood me.

In your case the teacher and the student are independent. In fact I need to show all the teachers for one student

Here is my database :

<---- Table Student : ---->

StudentNo StudentName StudentAge
100 Allan 21
101 Bravo 22
102 Charles 21

<---- Table Teachers: ---->
TeacherID TacherName
1 Christy
2 Maria
3 Kerry

<---- Table StudentTeachers: ---->
StudentNo TeacherID
100 1
100 2
100 3

My exported word file should look like this :

Student Name : Allan

Teacher Name : Christy
Teacher Name : Maria
Teacher Name : Kerry

Student Reg. No : 100
Student Age : 21

Thanks once again for the support.



SK Sarath Kumar G Syncfusion Team April 25, 2007 11:17 PM UTC

Hi Mehdi,

Thanks a lot for detailed explanation and Sorry for the confusion caused.

I have created a Sample which meats your requirements partially. I used two tables "Student" and "Teacher" to perform MailMerge as per the requirements. Since the table "StudentTeacher" is a link of the other two tables normalization is maintained. Hope so this helps you. Please let me know if you face any issues.

Here is the generated sample document for your reference.

http://www.syncfusion.com/Support/user/uploads/Sample_c70535d6.zip

Here is the sample program for your reference.

http://websamples.syncfusion.com/samples/DocIO.Windows/F_59810_1/main.htm

Please let me know if you face any issues.

Regards,
Sarath


ME Mehdi April 26, 2007 08:32 AM UTC

Hi Sarath,

Thanks for the answer. As you said you resolved my issue partially. Your solution show all teachers for each Student or the teachers are not the same for each student.

StudentNo TeacherID
100 1
100 2
100 3
200 1
300 1
300 2

Sorry for the confusion and thanks again for the support.

Mehdi.


BP Bhuvaneswari P Syncfusion Team May 2, 2007 09:37 AM UTC

Hi Mehdi,

Thanks for your update.

I have modified the sample as you expect.

Code Snippet:
//Getting Data from the database
conn1 = new OleDbConnection(connString1);
conn1.Open();
OleDbCommand cmd1 = new OleDbCommand("SELECT StudentName,TeacherName1,TeacherName2,TeacherName3,StudentTable.StudentID,StudentAge FROM StudentTable, Teachertable1 WHERE StudentTable.StudentID=Teachertable1.StudentID", conn1);

//Excute Query
IDataReader dataReader1 = cmd1.ExecuteReader();
//Excute MailMerge
document.MailMerge.Execute(dataReader1);

Herewith I have attached the sample for your reference:
Sample

Herewith I have attached the generated document for your reference:
http://websamples.syncfusion.com/samples/DocIO.Windows/F59810_3//main.htm

Please take a look into this and let me know if you have any other Queries.

Thank you for your interest in Syncfusion products.

Best Regards,
Bhuvaneswari.


ME Mehdi May 4, 2007 10:38 AM UTC

Thanks Bhuvaneswari,

It works like I wanted.

Good Work.


BW bhuvana wp Syncfusion Team May 4, 2007 01:07 PM UTC

Hi Mehdi,

Thank you for your interest in Essential DocIO. Glad to know that it helps you. Please let me know if you have any queries.

Best Regards,
Bhuvaneswari

Loader.
Live Chat Icon For mobile
Up arrow icon