Aspose.Word Mail Merge Regions "Horizontally rather than Vertically"

Hi,
I am trying to mail merge into a table using the regions tags
(TableStart:Table TableEnd:Table)
Is there a way of making the rows append as columns…i.e
Instead of
Name
John
Alex
I would like to see
Name John Alex
The code i am using is…

Dim _dtInvestors As New DataTable
_dtInvestors.TableName = "SMAContactDetail"
Dim _dc As New DataColumn("title", System.Type.GetType("System.String"))
Dim _dc1 As New DataColumn("given_names", System.Type.GetType("System.String"))
Dim _dc2 As New DataColumn("surname", System.Type.GetType("System.String"))
Dim _dc3 As New DataColumn("date_of_birth", System.Type.GetType("System.String"))
_dtInvestors.Columns.Add(_dc)
_dtInvestors.Columns.Add(_dc1)
_dtInvestors.Columns.Add(_dc2)
_dtInvestors.Columns.Add(_dc3)
_dtRow = _dtInvestors.NewRow
_dtrow("title") = "Mr"
_dtrow("given_names") = "John"
_dtrow("surname") = "John"
_dtrow("date_of_birth") = "01/01/1955"
_dtInvestors.Rows.Add(_dtrow)
_dtRow = _dtInvestors.NewRow
_dtrow("title") = "Mr"
_dtrow("given_names") = "Alex"
_dtrow("surname") = "Alex"
_dtrow("date_of_birth") = "01/01/1965"
_dtInvestors.Rows.Add(_dtrow)
Dim dataSet As DataSet = New DataSet()
dataSet.Tables.Add(_dtInvestors)
_doc = New Document(System.IO.Path.Combine(_path, _sourceDocumentName))
_doc.MailMerge.ExecuteWithRegions(dataSet)
_doc.Save("c:\done.doc", SaveFormat.FormatDocument)

I have attached a copy of a simple test file, can you show me in there if it is possible?
Many Thanks,
Connor

Hi
Thanks for your interesting inquiry. I will investigate this and provide you more information soon.
Best regards.

Hi
I spent some time on this problem and I have found one solution for you. You ca try using the following code. Also see attached template.

Dim _table As Table = Nothing
Public Sub TestMoveToMergeField_103485()
Dim _dtInvestors As New DataTable
Dim _dtRow As DataRow = Nothing
_dtInvestors.TableName = "SMAContactDetail"
Dim _dc As New DataColumn("title", System.Type.GetType("System.String"))
Dim _dc1 As New DataColumn("given_names", System.Type.GetType("System.String"))
Dim _dc2 As New DataColumn("surname", System.Type.GetType("System.String"))
Dim _dc3 As New DataColumn("date_of_birth", System.Type.GetType("System.String"))
_dtInvestors.Columns.Add(_dc)
_dtInvestors.Columns.Add(_dc1)
_dtInvestors.Columns.Add(_dc2)
_dtInvestors.Columns.Add(_dc3)
_dtRow = _dtInvestors.NewRow
_dtRow("title") = "Mr"
_dtRow("given_names") = "John"
_dtRow("surname") = "John"
_dtRow("date_of_birth") = "01/01/1955"
_dtInvestors.Rows.Add(_dtRow)
_dtRow = _dtInvestors.NewRow
_dtRow("title") = "Mr"
_dtRow("given_names") = "Alex"
_dtRow("surname") = "Alex"
_dtRow("date_of_birth") = "01/01/1965"
_dtInvestors.Rows.Add(_dtRow)
Dim dataSet As DataSet = New DataSet()
dataSet.Tables.Add(_dtInvestors)
Dim doc As Document = New Document("in_103485.doc")
AddHandler doc.MailMerge.MergeField, AddressOf HandleMerge_103485
doc.MailMerge.ExecuteWithRegions(dataSet)
TransposeTable(_table)
doc.Save("out_103485.doc")
End Sub
'get table
Private Sub HandleMerge_103485(ByVal sender As Object, ByVal e As Reporting.MergeFieldEventArgs)
If e.FieldName = "title" Then
_table = CType(e.Field.Start.ParentParagraph.ParentNode, Cell).ParentRow.ParentTable
End If
End Sub
Private Sub TransposeTable(ByVal inTable As Table)
Dim newTable As Table = New Table(inTable.Document)
Dim count As Integer = inTable.FirstRow.Cells.Count
Dim _row As Row = Nothing
Dim i As Integer = 0
For i = 0 To count - 1
Dim _newRow As Row = New Row(inTable.Document)
For Each _row In inTable.Rows
Dim _cell As Cell = _row.Cells(i).Clone(True)
_cell.CellFormat.Width = 100
_newRow.AppendChild(_cell)
Next
newTable.AppendChild(_newRow)
Next
'insert new table
CType(inTable.ParentNode, Body).InsertAfter(newTable, inTable)
'remove old table
inTable.Remove()
End Sub

I hope that this will help you. Please let me know if you would like to know something else.
Best regards.