IncludeText fields can be used to merge external references into a mail merge template using the reporting engine TXTextControl.DocumentServer.MailMerge class TX Text Control .NET for Windows Forms
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.
. External documents of type DOC, DOCX, RTF and TX can be referenced and are automatically included during the merge process.

The TXTextControl.DocumentServer.MailMerge.IncludeTextMerging event TX Text Control .NET for Windows Forms
DocumentServer Namespace
MailMerge Class
IncludeTextMerging Event
Occurs when an IncludeText field has been merged.
can be used to inject other files or formatted text by returning a document in the event. The following code shows how to handle Excel file references:

private void MailMerge_IncludeTextMerging(object sender,
TXTextControl.DocumentServer.MailMerge.IncludeTextMergingEventArgs e)
{
// custom handing of XLSX files
switch (Path.GetExtension(e.IncludeTextField.Filename))
{
case ".xlsx": // Excel file detected
if (!File.Exists(e.IncludeTextField.Filename))
return;
// load document into temp. ServerTextControl
using (TXTextControl.ServerTextControl tx =
new TXTextControl.ServerTextControl())
{
tx.Create();
// Bookmark name is the sheet name of the Excel document
TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings()
{
DocumentPartName = e.IncludeTextField.Bookmark
};
try
{
// load the Excel document
tx.Load(
e.IncludeTextField.Filename,
TXTextControl.StreamType.SpreadsheetML,
ls);
}
catch {
return;
}
byte[] data;
// save the document using the TX format
tx.Save(out data,
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
e.IncludeTextDocument = data; // pass back to the field
}
break;
}
}
view raw data.cs hosted with ❤ by GitHub

In case the reference ends with .xlsx, the file is loaded into a temporary TXTextControl.ServerTextControl class TX Text Control .NET for Windows Forms
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
. The Bookmark property of the IncludeTextField is used to define the sheet name in the Excel document. After the document is loaded successfully into ServerTextControl, it is exported in the internal TX Text Control format and returned to the TXTextControl.DocumentServer.MailMerge.IncludeTextMergingEventArgs.IncludeTextDocument property TX Text Control .NET for Windows Forms
DocumentServer Namespace
MailMerge.IncludeTextMergingEventArgs Class
IncludeTextDocument Property
Sets a byte[] array that contains the complete data of the IncludeText document.
.

The following screen video shows this in action:

Screen video merge Excel

Download this sample from our GitHub repository and try this on your own.