Free Support Forum - aspose.com

Table with multiple rows

hi roman,
we are using a table in the aspose.word template.we are merging that table with our datatable as a datasource.
our template has the following code:

?TableStart:ProjectNotes?

this following fileds are in a table

?LoanNumber?

?PropertyName?

?PropertyAddress?

?PeriodEndDate?

?Period?

?TableEnd:ProjectNotes?

In our code behind in asp.net we are using the following code

If Not IsNothing(oDataset) Then

Dim oDatatable As New DataTable("ProjectNotes")

Dim dr As DataRow

Dim _dr As DataRow

oDatatable.Columns.Add("LoanNumber")

oDatatable.Columns.Add("PropertyName")

oDatatable.Columns.Add("PropertyAddress")

oDatatable.Columns.Add("PeriodEndDate")

oDatatable.Columns.Add("Period")

For Each dr In oDataset.Tables(0).Rows

_dr = oDatatable.NewRow

_dr("LoanNumber") = dr("LoanNumber")

_dr("PropertyName") = Common.Value(dr("PropertyName"))

_dr("PropertyAddress") = Common.Value(dr("PropertyAddress"))

_dr("PeriodEndDate") = dr("PeriodEndDate")

_dr("Period") = dr("Period")

If oDatatable.Select("LoanNumber = '" & _dr("LoanNumber") & "' And PropertyName ='" & _dr("PropertyName") & "' And PeriodEndDate ='" & _dr("PeriodEndDate") & "' And Period='" & _dr("Period") & "'").Length = 0 Then

oDatatable.Rows.Add(_dr)

End If

Next

doc.MailMerge.ExecuteWithRegions(oDatatable)

But for each row it is creating a new table with space in between.we need to add rows to the same table instead of creating a new table for each row.

Reply ASAP

Hi,

Thank you for considering Aspose.

Please attach your document template to let us see.