How to convert xml to word using Aspose or data from database to word

Hi,

i am using asp.net C# to convert data from database to word. Can Aspose directly do it or, we need to convert to xml and then to word?.

If either is possible please can anyone of you let me know how to implement it as soon as possible.

Thanks.

Hi

Thanks for your inquiry. You can build document from scratch or use mail merge to fill the template with data. For example you can use the following code to insert a table into the document using Document Builder.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

InsertTable(builder, objDS.Tables[0]);

doc.Save(@"052_88865_dyross\out2.doc");

///

/// Insert Table to document

///

public void InsertTable(DocumentBuilder builder, DataTable table)

{

builder.StartTable();

foreach (DataRow row in table.Rows)

{

foreach (object cell in row.ItemArray)

{

builder.InsertCell();

builder.Write(cell.ToString());

}

builder.EndRow();

}

builder.EndTable();

}

Please let me know if you would like to know something else.

Best regards.