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

Free Support Forum - aspose.com

ODT : Aspose.Word ExecuteWithRegions(ds)


I'm trying to use Aspose.Word 9.0.0 to generate an OpenOffice Writter document with region.

Source :
License licence = new License();
Document document = new Document(PathTmpModele);

Dataset ds and Odt document are attached

Could you please give me an exemple of Odt generation whith ExecuteWithRegion ? I don't see how to link data with sections in my document to repeat them for each record.



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. To use mail merge feature, you need to insert merge fields in your template:


Here you can learn how to format regions:


Hope this helps. Please let me know in case of any issues, I will be glad to help you.

Best regards.

Hi Alexey,

Thanks for reply.

I'm already using Microsoft Word template. Could you please give me some information about OpenOffice Writer template ? How must be declared region and mergefield in an odt document to work with Aspose Word ? (I load an odt template in my Aspose.Word document)



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. To use mail merge with region, your template should contain mergefields with names TableStart:RegionName or TableStart_RegionName and TableEnd:RegionName or TableEnd_RegionName. Such fields marks start and end of document’s portion, which should be repeated for each record in your datasource. I attached sample ODT template for your reference. Here is code I use to fill it with data:

DataTable data = new DataTable("Test");


for (int i = 0; i < 10; i++)

data.Rows.Add(new object[] {string.Format("test_{0}", i)});

Document doc = new Document(@"Test001\in.odt");



Also, if you just need to generate ODT output, you can use DOC or DOCX file as a template. And then just save the output document in ODT format.

Best regards.

Thanks for help, I'll try this.