# Reporting: Merging Images from Files Using SearchPath

> Image placeholders in TX Text Control Reporting accept byte arrays, System.Drawing.Image objects, file paths, or Base64 strings at merge time. The MailMerge SearchPath property specifies the directory where referenced image files are located on disk during the merge process.

- **Author:** Bjoern Meyer
- **Published:** 2014-03-12
- **Modified:** 2026-07-17
- **Description:** Image placeholders in TX Text Control Reporting accept byte arrays, System.Drawing.Image objects, file paths, or Base64 strings at merge time. The MailMerge SearchPath property specifies the directory where referenced image files are located on disk during the merge process.
- **4 min read** (644 words)
- **Tags:**
  - Reporting
  - Tutorial
- **Web URL:** https://www.textcontrol.com/blog/2014/03/12/reporting-merging-images-from-files-using-searchpath/
- **LLMs URL:** https://www.textcontrol.com/blog/2014/03/12/reporting-merging-images-from-files-using-searchpath/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2014/03/12/reporting-merging-images-from-files-using-searchpath/llms-full.txt

---

Merging images with Text Control Reporting is a very easy job: A placeholder is added at design-time to the template and merged with data from files, databases or memory.

The placeholder object gets a name that should match a data column in your data source. The data column must contain either the binary image data as a byte array, an object of type System.Drawing.Image, a file name, a hex or Base64 encoded string. These options cover most typical image representations in databases.

When the template designer TX Text Control Words is directly connected to a database to provide the proper field names, image placeholders can be directly bound to database fields using the context menu. But this article shows what happends behind the scenes and how to use the [SearchPath](https://docs.textcontrol.com/textcontrol/windows-forms/ref.txtextcontrol.documentserver.mailmerge.searchpath.property.htm) property of [MailMerge](https://docs.textcontrol.com/textcontrol/windows-forms/ref.txtextcontrol.documentserver.mailmerge.class.htm) to define the image location.

Consider the following XML file as the data source for our merge process:

```
<?xml version="1.0" encoding="utf-8" ?>
<report>
  <customer>
    <company>Microsoft Corporation</company>
    <company_logo>microsoft_logo.png</company_logo>
  </customer>
  <customer>
    <company>Text Control, LLC</company>
    <company_logo>textcontrol_logo.png</company_logo>
  </customer>
</report>
```

Each *customer* entry has two fields: The company name and the file name of a company logo.

In order to create a very simple template for this data source, the following steps are required.

- Open TX Text Control Words and click the *Insert Merge Field* button (make sure that you don't open the drop-down button) from the *Mailings* ribbon tab.
    
    In the opened dialog box, type in the name of the first field "*company*" into the *Name* text box and confirm with *OK*.
    
    ![Merging Images from Files using SearchPath](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_image_data_1.webp "Merging Images from Files using SearchPath")
- Now, choose *Image Placeholder* from the *Image* drop-down button in the *Insert* ribbon tab. Resize the object to your desired dimension.
    
    ![Merging Images from Files using SearchPath](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_image_data_2.webp "Merging Images from Files using SearchPath")
- Right-click the image, and choose *Edit Object Name...* from the context menu.
    
    ![Merging Images from Files using SearchPath](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_image_data_3.webp "Merging Images from Files using SearchPath")
- In the opened dialog box, type in the name of the image field in our data source *company\_logo* and confirm with *OK*.

Given that you created a .NET application and connected an instance of MailMerge with TextControl as described in our [quick start tutorial](https://www.textcontrol.com/technology/reporting/), you can use the SearchPath property to define the location of the images.

- Open the properties Windows of MailMerge, find the *SearchPath* property and type in the location of your images.
    
    ![Merging Images from Files using SearchPath](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_image_data_4.webp "Merging Images from Files using SearchPath")

In this example, TX Text Control is trying to load the images from these locations:

- C:\\Users\\Pictures\\microsoft\_logo.png
- C:\\Users\\Pictures\\textcontrol\_logo.png

If the *SearchPath* is empty, the images are expected to be located in the application's root folder.

You can [download this simple Visual Studio project](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_merge_images.zip) and test it on your own. All you need is a [trial version](https://www.textcontrol.com/product/) of TX Text Control .NET for Windows Forms or TX Text Control Server for ASP.NET. If your run the sample and choose *Merge* from the *Report* main menu, you will see the results shown below:

![Merging Images from Files using SearchPath](https://s1-www.textcontrol.com/assets/dist/blog/2014/03/12/a/assets/tx_image_data_5.webp "Merging Images from Files using SearchPath")

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Creating Your First ASP.NET Reporting Application](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-aspnet-reporting-application/llms.txt)
- [New Online Sample: Build your First Report](https://www.textcontrol.com/blog/2019/07/03/build-your-first-report/llms.txt)
- [Create your First Document with ReportingCloud](https://www.textcontrol.com/blog/2019/02/19/create-your-first-document-with-reportingcloud/llms.txt)
- [MailMerge: Starting Each Merge Block on a New Page](https://www.textcontrol.com/blog/2016/09/09/mailmerge-starting-each-merge-block-on-a-new-page/llms.txt)
- [Using MailMerge with JSON Data](https://www.textcontrol.com/blog/2015/08/04/using-mailmerge-with-json-data/llms.txt)
- [Merging Documents with RESTful Web API's](https://www.textcontrol.com/blog/2015/07/31/merging-documents-with-restful-web-apis/llms.txt)
- [Windows Forms: Printing Multiple Pages Per Sheet](https://www.textcontrol.com/blog/2015/07/24/windows-forms-printing-multiple-pages-per-sheet/llms.txt)
- [Inserting Watermark Images to All Pages Dynamically](https://www.textcontrol.com/blog/2015/07/17/inserting-watermark-images-to-all-pages-dynamically/llms.txt)
- [Reporting: Sorting Merge Block Rows by Column Name](https://www.textcontrol.com/blog/2015/07/15/reporting-sorting-merge-block-rows-by-column-name/llms.txt)
- [MailMerge with the Entity Framework Using Database First](https://www.textcontrol.com/blog/2015/06/24/mailmerge-with-the-entity-framework-using-database-first/llms.txt)
- [Checked and Unchecked Check Boxes with IF Fields](https://www.textcontrol.com/blog/2015/03/25/checked-and-unchecked-check-boxes-with-if-fields/llms.txt)
- [Reporting: Conditional Formatted Text Blocks](https://www.textcontrol.com/blog/2015/03/13/reporting-conditional-formatted-text-blocks/llms.txt)
- [Reporting Best Practices and How-To Guides](https://www.textcontrol.com/blog/2015/02/05/reporting-best-practices-and-how-to-guides/llms.txt)
- [MailMerge: Master Table and Client Tables](https://www.textcontrol.com/blog/2015/01/28/mailmerge-master-table-and-client-tables/llms.txt)
- [MailMerge: Formatting Numeric Strings in Merge Fields](https://www.textcontrol.com/blog/2015/01/22/mailmerge-formatting-numeric-strings-in-merge-fields/llms.txt)
- [MailMerge: Merge CheckBoxes During the Merge Process](https://www.textcontrol.com/blog/2015/01/12/mailmerge-merge-checkboxes-during-the-merge-process/llms.txt)
- [MailMerge: Conditional INCLUDETEXT Fields](https://www.textcontrol.com/blog/2015/01/08/mailmerge-conditional-includetext-fields/llms.txt)
- [HTML5 Technical Considerations - The Concept Explained](https://www.textcontrol.com/blog/2014/10/16/html5-technical-considerations-the-concept-explained/llms.txt)
- [TX Text Control Web: Attaching Events to Ribbon Elements](https://www.textcontrol.com/blog/2014/10/07/tx-text-control-web-attaching-events-to-ribbon-elements/llms.txt)
- [TX Text Control Web: Customize the Ribbon Bar](https://www.textcontrol.com/blog/2014/10/03/tx-text-control-web-customize-the-ribbon-bar/llms.txt)
- [Text Control Web - Fundamental Concepts: The Data Source](https://www.textcontrol.com/blog/2014/10/02/text-control-web-fundamental-concepts-the-data-source/llms.txt)
- [Reporting: Removing Empty Table Rows](https://www.textcontrol.com/blog/2014/09/30/reporting-removing-empty-table-rows/llms.txt)
- [MS Word Content Controls Field Adapter Classes](https://www.textcontrol.com/blog/2014/08/05/ms-word-content-controls-field-adapter-classes/llms.txt)
- [Reporting: Merge Blocks and Structured Numbered Lists](https://www.textcontrol.com/blog/2014/07/29/reporting-merge-blocks-and-structured-numbered-lists/llms.txt)
- [Creating Avery Labels Using Text Control Reporting](https://www.textcontrol.com/blog/2014/07/22/creating-avery-labels-using-text-control-reporting/llms.txt)
