Free Support Forum - aspose.com

Formatting multi-row data

I'm rendering a letter using Aspose.Words. Inside the letter I need to list children names of recipient. Because a person may have more than one child, I'm using ExecuteWithRegion method (of course with and tags).

Right now, it shows like

"blah blah blah


blah blah"

My problem is that I need to list all the names in one line and inside a paragraph. So for example, "blah blah blah , blah blah" like that.

Will this be possible?

Hi

Thanks for your request. I think that you can try using the following code.

string value = string.Empty;

for (int i = 0; i < table.Rows.Count; i++)

{

if (i != table.Rows.Count - 1)

{

value += String.Format("{0}, ", table.Rows[i]["child"].ToString());

}

else

{

value += String.Format("{0}.", table.Rows[i]["child"].ToString());

}

}

string[] names = { "child" };

string[] values = { value };

Document doc = new Document(@"435_107023_jae.kim\in.doc");

doc.MailMerge.Execute(names, values);

doc.Save(@"435_107023_jae.kim\out.doc");

Best regards.