About the databind of table

Hello,

I have two problems about the databinding of the table.

  1. I want to split a record into two parts and show them in two rows. How can I do it?
  2. The data of table in my templete document forms two datatable of my database. How could I do it?

Hi Candy,

Thanks for your inquiry.

I think the simpliest method for both cases is to use the code found in the Produce multiple documents during mail merge" article found here.

You can merge each row from your database into separate documents. You can then take the rows of each table from each document in order and append them onto the first document. This should then result in output you are looking for. You can find some example code of how to join rows from different tables together from your other thread here.

If you have any trouble setting this up, please post you code here and we will assist you.

Thanks,

Hello,

Thanks for your reply,but I have some other questiones needed your help.

  1. I think the simpliest method for both cases is to use the code found in the Produce multiple documents during mail merge" article found here.

I read the article above ,but I also have no ideas.Can you send a sample to me?

2.You can merge each row from your database into separate documents. You can then take the rows of each table from each document in order and append them onto the first document. This should then result in output you are looking for.

I know your method provide to me and I also have a try .But the columns in the templete docment don’t always binded form one data table one by one. Do you have another ways to insolve this problems?

  1. How can I insert blank rows when the builded table can’t full fill in a page?

Thank you!

Best Rergards,

Candy

Hi Candy,

Thanks for your inquiry.

  1. For me it seems that you can achieve what you need using Mail Merge with Regions:
    https://docs.aspose.com/words/java/mail-merge-and-reporting/

  2. I suppose you should not have any problem here. Just using LEFT or RIGHT JOIN in SQL query:
    https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms191517(v=sql.105)

  3. There is no way to determine how much space available on the page. So there is no way to fill this space with empty rows. By the way, why do you need this? Maybe there is a simpler way.

Best regards,

Hello,

Thanks for your reply. For the third problem, if I ordered there are 20 rows in a page, can I insert blank rows in the page? Thank you!

Hi Candy,

Thanks for your inquiry. As I mentioned, there is no way to determine how much space available on the page, so you cannot determine how many empty rows you should insert.

If you need just insert a page break after 20 records on the page, you can try using “Page Break Before” option of paragraph:
https://reference.aspose.com/words/net/aspose.words/paragraphformat/pagebreakbefore/

For example, code provided here could be useful for you:
https://forum.aspose.com/t/mail-merge-with-page-breaks/60639/13

Best regards,