Long negotiation cycles, compliance issues, and ultimately lost revenue result from a poor contracting process. Modern contract lifecycle management (CLM) systems provide streamlined processes that help organizations focus on higher-value, core business functions.

In today's business environment, efficient workflows rely on agreements and contracts. By digitizing these processes, we can improve efficiency, user experience, and security. Integrated document lifecycle management can streamline negotiations and accelerate agreement outcomes.

Agreements and contracts often still rely on manual or semi-manual procedures despite advancements in transactional paperwork like invoices and quotes. These procedures can be time-consuming and prone to errors.

Automated management of the contract process includes creation through negotiation, signature, and storage. Today, this is most often accomplished using multiple applications or services such as DocuSign.

But this process should be part of any ERP system, directly integrated with the software that typically generates documents such as invoices, purchase orders, or sales contracts.

Contract Lifecycle

Contract lifecycle management (CLM) is the process of managing contracts from initiation through execution to renewal or termination. It includes the creation, negotiation, and storage of contracts, as well as the management of changes or amendments to the contract.

Typically, the lifecycle of a contract includes the following steps:

Contract Lifecycle Management

Manual contract creation and processing is an error-prone, labor-intensive process. Information is manually entered into documents, older contracts are reused (copying and modifying existing documents), or documents are created from scratch each time a new contract is needed.

Text Control provides the technology to implement many of these document-related steps and automate these processes directly in your software.

Document Generation

Document generation is the process of creating documents from templates. Templates are created with placeholders for data that is filled in at runtime. This process is often used for contracts, invoices, or reports.

  • Use templates that are compatible with MS Word and populate your documents with data from business objects or systems such as Salesforce, Oracle or SAP.
  • Integration of dynamic text blocks on the basis of conditions such as standard terms.
  • Easily merge pre-defined and pre-approved phrases into your documents.

Text Control provides a powerful template designer that can be integrated into your application. The template designer is a WYSIWYG editor that allows users to create templates with merge fields, repeating blocks, and conditions.

MailMerge in C#

MailMerge is a process to populate a template with data. The template is a document that contains merge fields that are replaced with data from a data source. The data source can be a database, a JSON object, or any other data source.

A template can be any supported document type, such as DOC, DOCX, RTF, or the internal TX Text Control format (TX). It may include static text, dynamic merge fields, image placeholders, repeating blocks, and other merge elements.


MailMerge TX Text Control .NET Server for ASP.NET
DocumentServer Namespace
MailMerge Class
The MailMerge class is a .NET component that can be used to effortlessly merge template documents with database content in .NET projects, such as ASP.NET web applications, web services or Windows services.
offers several methods for merging data into templates. The class interprets all public properties of an object as table columns and child tables. The object type is analyzed using .NET reflection and used as the basis of the table structure. Nested object types are used for merge blocks and prefixed merge fields.

To ensure clarity and simplicity, we use the following JSON string as the data source:

"company_name": "Text Control, LLC",
"street": "1111 Text Control Way",
"zip": "28226",
"city": "Charlotte",
"country": "United States"
view raw data.json hosted with ❤ by GitHub

The following code snippet shows how to merge the data source into the template:

// enable MS Word merge fields
TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings() {
ApplicationFieldFormat = TXTextControl.ApplicationFieldFormat.MSWord };
// load JSON data
string jsonData = System.IO.File.ReadAllText("data.json");
// create a temporary ServerTextControl
using (TXTextControl.ServerTextControl serverTextControl =
new TXTextControl.ServerTextControl()) {
// load the template
serverTextControl.Load("template.docx", TXTextControl.StreamType.WordprocessingML, ls);
// create the mail merge engine
using (MailMerge mailMerge = new MailMerge()) {
// connect to ServerTextControl
mailMerge.TextComponent = serverTextControl;
// merge data into template
view raw test.cs hosted with ❤ by GitHub

The screenshot displays the resulting document.

Merged Document

The document can be exported to PDF, deployed using the TX Text Control Document Viewer, or distributed to other parties for negotiation or red-lining.

Learn More

The MailMerge class offers an efficient method for merging data into MS Word templates. This guide provides an overview of all essential features and functionalities of the mail merge process.

Mail Merge with MS Word Documents in C# - An Ultimate Guide

Document Negotiation

Document negotiation is the process of exchanging documents between parties to reach an agreement. This process often includes red-lining, commenting, and signing documents. TX Text Control offers a comprehensive document editor that is fully compatible with MS Word. It also includes collaboration features, such as track changes and comments.

Tracked Changes

In addition, you can define sections of a document that should be editable or protected for specific, definable users. All these features are compatible with MS Word, which means that you can open the generated document in MS Word and redline it.

Learn More

We have released an electronic signature reference implementation that shows how to implement document collaboration workflows. A document can be shared with another user to negotiate a contract before starting a signature process.

eSign Online Demo: Contract Collaboration Workflows

Obtaining Signatures

After all parties have accepted a contract, it is time to sign. While wet ink signatures can make the signing process lengthy, electronic signatures are almost instantaneous. Signers can create a secure and verifiable signature on any device. Electronic signatures are legally binding in many countries and industries.

TX Text Control offers the essential features to obtain signatures from users and process the document to produce a completely signed and secure PDF. It provides the server-side API to generate the PDF and the front-end UI tools for a modern, reliable, and effortless signature experience.

TX Text Control provides two different types of signatures: Electronic signatures and digital signatures.

  • Electronic Signature
    An electronic signature is a visual representation of a signature captured using a touch screen or a mouse. While it is not necessarily cryptographically secured, it can be digitally signed.
  • Digital Signature
    A digital signature is a cryptographic signature applied to a document to ensure that it has not been tampered with. It is based on a certificate issued by a trusted authority.

In typical scenarios, the two types combine. Visual signature fields contain the visual representation and are digitally signed with a certificate.

The Document Viewer is a modern, web-based document viewer that is available for many platforms and provides all the functionality needed to capture signatures. All client-side visual components are available for the following platforms:

  • ASP.NET Core
  • React
  • Angular
  • JavaScript
  • Blazor

The Document Viewer provides the following features:

  • Out-of-the-box UI
    The Document Viewer provides a ready-to-use UI to display and sign documents. It is customizable and can be integrated into any ASP.NET Core application.

    Document Viewer UI

  • Signature Fields
    The Document Viewer provides support for signature fields that can be placed on the document to capture electronic signatures. These fields can be digitally signed with a certificate to ensure that the document is secure and reliable.

    Document Viewer Signature Fields

  • Form Filling
    The Document Viewer provides support for form fields that can be placed on the document to capture data. These fields can be exported as a PDF form.

    Document Viewer Forms Filling

  • Draw, Type or Upload Signatures
    The Document Viewer provides different ways to capture signatures. Users can draw, type or upload a signature image to sign the document.

    Document Viewer Signature Capture

The code snippet below adds a signature field and an SVG image as the visual representation of the signature to a new document. The digital signature created is then associated with the signature field and provided by the SaveSettings to export the document as an Adobe PDF document.

public static void SignFields() {
using (ServerTextControl tx = new ServerTextControl()) {
// create a signature field
SignatureField signatureField = new SignatureField(
new System.Drawing.Size(2000, 2000), "txsign", 10);
// set image representation
signatureField.Image = new SignatureImage("signature.svg", 0);
// insert the field
tx.SignatureFields.Add(signatureField, -1);
// create a digital signature (for each field, if required)
DigitalSignature digitalSignature = new DigitalSignature(
new System.Security.Cryptography.X509Certificates.X509Certificate2(
"textcontrolself.pfx", "123"), null, "txsign");
// apply the signatures to the SaveSettings
SaveSettings saveSettings = new SaveSettings() {
SignatureFields = new DigitalSignature[] { digitalSignature }
// export to PDF
tx.Save("signed_fields.pdf", StreamType.AdobePDF, saveSettings);
view raw test.cs hosted with ❤ by GitHub

The resulting document can be saved as a PDF and distributed to all parties involved in the negotiation process.

Document Deployment

The finalized document can be sent to involved parties as a PDF or deployed in a web portal using the Document Viewer. The Document Viewer can be used to view any of the supported document formats, including MS Word and PDF.

This allows you to display the final document in your web application and allow users to annotate or comment on these documents. The Document Viewer provides a sophisticated UI and API for managing these edits.

Document Viewer Comments


Integrating document lifecycle management into your software can streamline your business processes and improve efficiency. By automating document generation, negotiation, and signature processes, you can reduce errors, save time, and improve the user experience.

TX Text Control provides the technology to implement these processes directly in your software. The Document Viewer is a modern, web-based document viewer that provides all the functionality needed to display, edit, and sign documents.

Download a fully-featured trial version of TX Text Control and start your implementation today.