We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Columns in the Word File

I have a question about putting columns in my word document. Basically, what I have to do is to make a report with multiple dataviews. So, it would looks something like this…

Table 1 listing #1
Table 1 listing #2
Table 1 listing #3

Table 2 listing #1
Table 2 listing #2
Table 2 listing #3

The problem is that the columns don’t line up because of the different sizes of the fields. I tried to find a way to set the insert to overwrite in aspose.word but I couldn’t find one. So, I went to a table, but the problem with the table is that the executeregions writes by columns as opposed to rows so when I try to put the tablestart and tableend tags at the beginning and end of a row I get a “doesn’t support nested mail merge regions”

Any suggestions would be greatly appreciated.

Thanks in advance!

Hi,

Sorry, I’m afraid I don’t understand what you are trying to achieve.

It is valid to put tablestart and tableend tags in a table row if you want this table to grow. However it must not be nested within another merge region as nested regions are not supported.

Maybe you can email the documents to word@aspose.com along with instructions what you are trying to do and I’ll see what can be done.

One critical thing was wrong about the file: the error message was saying that “Dient” region was nested inside “Sient” region, but there was actually no “Sient” region visible in the document. I guess there was some field malformed and it was not even visible in MS Word. I’ve selected and updated (F9) all fields and it seems like it fixed the error about nested region.

Everything else was fine. You don’t really have hide TableStart and TableEnd fields making their font 1 point in size - they will be removed during generation. You also don’t need to put them into separate cells - just put them in the first and last cells in the row.

I’ve created a simple XML data file, load it and execute a mail merge as shown in the following code. I’m sending the document I’ve edited and the outptut document that is produced to you.

/// 
/// Complains about nested regions not supported. Does not seem any nested regions, just 
/// several regions in the same table.
/// 
[Test]
public void TestTomChamberlain()
{
    Document doc = TestUtil.Open(@"TomChamberlain\ResListing1.doc");
    DataSet dataSet = new DataSet();
    dataSet.ReadXml(@"X:\Aspose\Aspose.Word\Aspose.Word.Test\Testing\TomChamberlain\data.xml");
    doc.MailMerge.ExecuteWithRegions(dataSet.Tables["Dient"]);
    TestUtil.Save(doc, @"TomChamberlain\ResListing1 Out.doc");
}

Content of data.xml:

<Dients>
 <Dient>
  <ID>1001</ID>
  <FIRST_NAME>Roman</FIRST_NAME>
  <LAST_NAME>Korchagin</LAST_NAME>
 </Dient>
 <Dient>
  <ID>1002</ID>
  <FIRST_NAME>Tom</FIRST_NAME>
  <LAST_NAME>Chamberlain</LAST_NAME>
 </Dient>
</Dients>

Hi Roman,
The file works now, thanks a lot.
I have to say, when I first purchased this package I was very nervous by the lack of documentation (not that there isn’t any, but in comparison to other tools I’ve bought it was less) but the support (which has basically been you) has just been exceptional and it’s greatly appreciated.
I wouldn’t hesitate to recommend your package to anyone I know.
Thanks again,
Tom

Sorry, I should have remembered to also post this in public…

Tom

The issues you have found earlier (filed as 39) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(19)