Learn to Dynamically Assemble External Documents on .NET Platform using C# .NET API
Tags: net, groupdocs, automation, api
Published: 2019-01-28 13:12:46

---
title: Learn to Dynamically Assemble External Documents on .NET Platform using C# .NET API
published: true
description: post
tags: .net, groupdocs, automation, api
---

Process automation is an upward trend, something we will be depending upon a lot in coming years. It encapsulates a wide ranging, far reaching concept, not just the idea of making things less ‘human dependent’. It refers to increased productivity, to time efficient processing, to better management, to fewer errors, to reliable output and so much more.

Based on the industry or specific business scenario, process automation could take numerous shapes and forms. How about home automation for an example? Wouldn’t you like a nice birthday greeting played to you on your cake day? What about turning your air conditioner on with a voice command? Or, automatically moving your window blinds up and down based on the time of the day? These are all some basic perks which home automation service providers are marketing around the globe. 

It’s not too different when it comes to document automation; you would always appreciate a more efficient, more dependable, less error prone document generation process making your life easier while creating legal, financial, contractual and medical as well as countless other types of documents. 

If you are a software developer, and you are looking to programmatically incorporate document automation functionality into your applications on .NET platform, there are not many APIs which offer you the convenience of use bundled with a proven feature set and seamless processing. Of the few APIs you could trust, GroupDocs.Assembly for .NET is surely one to consider. 

It envelops a range of very useful functions giving you the edge when assembling various types of commonly used documents formats, from different data sources such as database, JSON, XML, OData and Custom .NET Objects. An important feature of this automation API is the ability to dynamically assemble external documents. This feature is currently available for Microsoft Word and Email formats.

You can work with doc tags, which are placeholders within templates, allowing you to absorb documents at run-time. Using these doc tags, programmers can insert documents dynamically into their reports with the .NET API. Learn more – http://bit.ly/automate-external-documents

Following code snippet shows how to insert external document in Word Processing format:

`//Setting up source open document template
const String strDocumentTemplate = "Word Templates/Nested External Document.docx";
//Setting up destination open document report 
const String strDocumentReport = "Word Reports/Nested External Document.docx";
try
{
    //Instantiate DocumentAssembler class
    DocumentAssembler assembler = new DocumentAssembler();
    //Call AssembleDocument to generate  Report in open document format
    assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate),
                               CommonUtilities.SetDestinationDocument(strDocumentReport),
                               new DataSourceInfo(DataLayer.GetCustomerData(), "customer"));
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}`

Similarly, here's how to insert an external document in Email format:

`//Setting up source open document template
const String strDocumentTemplate = "Email Templates/Nested External Document.msg";
//Setting up destination open document report 
const String strDocumentReport = "Email Reports/Nested External Document.msg";
try
{
    //Instantiate DocumentAssembler class
    DocumentAssembler assembler = new DocumentAssembler();
    //Call AssembleDocument to generate  Report in open document format
    assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate),
                               CommonUtilities.SetDestinationDocument(strDocumentReport),
                               new DataSourceInfo(DataLayer.GetCustomerData(), "customer"));
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}`

For downloading relevant resources to execute above mentioned code snippets, please see - http://bit.ly/2ShtYTy