Aspose.Words.MailMerging.MailMerge.ExecuteWithRegions(System.Data.DataView)

Here are the examples of the csharp api class Aspose.Words.MailMerging.MailMerge.ExecuteWithRegions(System.Data.DataView) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: Aspose.Words-for-.NET
Source File: ExMailMerge.cs
public void ExecuteWithRegionsDataTable()
        {
            Document doc = new Document(MyDir + "MailMerge.ExecuteWithRegions.doc");

            int orderId = 10444;

            // Perform several mail merge operations populating only part of the document each time.

            // Use DataTable as a data source.
            DataTable orderTable = GetTestOrder(orderId);
            doc.MailMerge.ExecuteWithRegions(orderTable);

            // Instead of using DataTable you can create a DataView for custom sort or filter and then mail merge.
            DataView orderDetailsView = new DataView(GetTestOrderDetails(orderId));
            orderDetailsView.Sort = "ExtendedPrice DESC";
            doc.MailMerge.ExecuteWithRegions(orderDetailsView);

            doc.Save(MyDir + @"\Artifacts\MailMerge.ExecuteWithRegionsDataTable.doc");
        }

2. Example

Project: Aspose.Words-for-.NET
Source File: ExecuteWithRegionsDataTable.cs
public static void Run()
        {
            // ExStart:ExecuteWithRegionsDataTable
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_MailMergeAndReporting();
            string fileName = "MailMerge.ExecuteWithRegions.doc";
            Document doc = new Document(dataDir + fileName);

            int orderId = 10444;

            // Perform several mail merge operations populating only part of the document each time.

            // Use DataTable as a data source.
            DataTable orderTable = GetTestOrder(orderId);
            doc.MailMerge.ExecuteWithRegions(orderTable);

            // Instead of using DataTable you can create a DataView for custom sort or filter and then mail merge.
            DataView orderDetailsView = new DataView(GetTestOrderDetails(orderId));
            orderDetailsView.Sort = "ExtendedPrice DESC";
            doc.MailMerge.ExecuteWithRegions(orderDetailsView);

            dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
            doc.Save(dataDir);
            // ExEnd:ExecuteWithRegionsDataTable

            Console.WriteLine("\nMail merge executed successfully with repeatable regions.\nFile saved at " + dataDir);
        }