Products Technologies Demo Docs Blog Support Company

New Sample: How to Merge Images into MS Word Templates

Merging images is required in many templates: Company logos in invoices, pictures of employees in HR reports or signature images in letters. These images can't be part of the template as they have to be merged dynamically. With the release of TX Text Control .NET Server 16.0, the MailMerge class comes with this feature out of the box. It is possible to pass an image path with the merge data or an image can be added dynamically in the new ImageFieldMerged event. Image fields are regular merge…

New Sample: How to Merge Images into MS Word Templates

Merging images is required in many templates: Company logos in invoices, pictures of employees in HR reports or signature images in letters. These images can't be part of the template as they have to be merged dynamically.

With the release of TX Text Control .NET Server 16.0, the MailMerge class comes with this feature out of the box. It is possible to pass an image path with the merge data or an image can be added dynamically in the new ImageFieldMerged event.

Image fields are regular merge fields with a special format:

TX Text Control image field format

'image:' is the identifier followed by the name of this field. In this sample, all image fields are merged with the same image in the ImageFieldMerged event:

void mailMerge_ImageFieldMerged(object sender,
    TXTextControl.DocumentServer.MailMerge.ImageFieldMergedEventArgs e)
{
    if (pictureBox1.Image == null)
        return;

    // add the image from the PictureBox
    TXTextControl.Image img = new TXTextControl.Image(pictureBox1.Image);
    e.Image = img;
}

Download the new sample in our source code library that shows this new feature in detail:

How to merge images into MS Word templates

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Windows FormsWPF.NET

Create a Table of Contents in Windows Forms using C#

This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.


ASP.NETWindows FormsWPF

Official TX Text Control .NET Sample Applications Are Now Hosted on GitHub

This article gives a quick overview of the new repositories, their structure and our plans for the future.


ASP.NETJavaScriptDocument Editor

Detect Toggle Button Changes Using a MutationObserver

This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…


Windows FormsList.NET

Two Ways to Restart Numbered Lists in TX Text Control

In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…


Windows FormsSampleShortcuts

Zoom Tricks: Disabling CTRL + MOUSE WHEEL and More

This article shows how to disable CTRL + MOUSE WHEEL, implement zooming with keyboard and reset the zoom factor to its default value.