MailMerger.ExecuteToImages
ExecuteToImages(string, ImageSaveOptions, string[], object[], MailMergeOptions)
Performs a mail merge operation for a single record and renders the result to images.
public static Stream[] ExecuteToImages(string inputFileName, ImageSaveOptions saveOptions,
string[] fieldNames, object[] fieldValues, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
saveOptions | ImageSaveOptions | The output’s save options. |
fieldNames | String[] | Array of merge field names. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
fieldValues | Object[] | Array of values to be inserted into the merge fields. Number of elements in this array must be the same as the number of elements in fieldNames. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template with data by executing a simple mail merge using an array data source and saving the result as image streams.
string[] names = new string[] { "FirstName", "SecondName", "Position" };
string[] values = new string[] { "James", "Bond", "Spy" };
Stream[] pages = MailMerger.ExecuteToImages(MyDir + "MailMergeTemplate.docx", new ImageSaveOptions(SaveFormat.Png), names, values);
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize
ExecuteToImages(Stream, ImageSaveOptions, string[], object[], MailMergeOptions)
Performs a mail merge operation for a single record and renders the result to images.
public static Stream[] ExecuteToImages(Stream inputStream, ImageSaveOptions saveOptions,
string[] fieldNames, object[] fieldValues, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input file stream. |
saveOptions | ImageSaveOptions | The output’s save options. |
fieldNames | String[] | Array of merge field names. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
fieldValues | Object[] | Array of values to be inserted into the merge fields. Number of elements in this array must be the same as the number of elements in fieldNames. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template loaded from stream with data by executing a simple mail merge using an array data source and saving the result as image streams.
string[] names = new string[] { "FirstName", "SecondName", "Position" };
string[] values = new string[] { "James", "Bond", "Spy" };
using (Stream input = File.OpenRead(MyDir + "MailMergeTemplate.docx"))
{
Stream[] pages = MailMerger.ExecuteToImages(input, new ImageSaveOptions(SaveFormat.Png), names, values);
}
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize
ExecuteToImages(string, ImageSaveOptions, DataRow, MailMergeOptions)
Performs mail merge from a DataRow into the document and renders the result to images.
public static Stream[] ExecuteToImages(string inputFileName, ImageSaveOptions saveOptions,
DataRow dataRow, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
saveOptions | ImageSaveOptions | The output’s save options. |
dataRow | DataRow | Row that contains data to be inserted into mail merge fields. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template with data by executing a simple mail merge using a DataRow data source and saving the result as image streams.
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("SecondName");
dt.Columns.Add("Position");
DataRow dr = dt.Rows.Add("James", "Bond", "Spy");
Stream[] pages = MailMerger.ExecuteToImages(MyDir + "MailMergeTemplate.docx", new ImageSaveOptions(SaveFormat.Png), dr);
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize
ExecuteToImages(Stream, ImageSaveOptions, DataRow, MailMergeOptions)
Performs mail merge from a DataRow into the document and renders the result to images.
public static Stream[] ExecuteToImages(Stream inputStream, ImageSaveOptions saveOptions,
DataRow dataRow, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input file stream. |
saveOptions | ImageSaveOptions | The output’s save options. |
dataRow | DataRow | Row that contains data to be inserted into mail merge fields. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template loaded from stream with data by executing a simple mail merge using a DataRow data source and saving the result as image streams.
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("SecondName");
dt.Columns.Add("Position");
DataRow dr = dt.Rows.Add("James", "Bond", "Spy");
using (Stream input = File.OpenRead(MyDir + "MailMergeTemplate.docx"))
{
Stream[] pages = MailMerger.ExecuteToImages(input, new ImageSaveOptions(SaveFormat.Png), dr);
}
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize
ExecuteToImages(string, ImageSaveOptions, DataTable, MailMergeOptions)
Performs mail merge from a DataRow into the document and renders the result to images.
public static Stream[] ExecuteToImages(string inputFileName, ImageSaveOptions saveOptions,
DataTable dataTable, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
saveOptions | ImageSaveOptions | The output’s save options. |
dataTable | DataTable | Table that contains data to be inserted into mail merge fields. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template with data by executing a simple mail merge using a DataTable data source and saving the result as image streams.
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("SecondName");
dt.Columns.Add("Position");
dt.Rows.Add("James", "Bond", "Spy");
dt.Rows.Add("John", "Doe", "Unknown");
Stream[] pages = MailMerger.ExecuteToImages(MyDir + "MailMergeTemplate.docx", new ImageSaveOptions(SaveFormat.Png), dt);
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize
ExecuteToImages(Stream, ImageSaveOptions, DataTable, MailMergeOptions)
Performs mail merge from a DataRow into the document and renders the result to images.
public static Stream[] ExecuteToImages(Stream inputStream, ImageSaveOptions saveOptions,
DataTable dataTable, MailMergeOptions mailMergeOptions = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input file stream. |
saveOptions | ImageSaveOptions | The output’s save options. |
dataTable | DataTable | Table that contains data to be inserted into mail merge fields. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored. |
mailMergeOptions | MailMergeOptions | Mail merge options. |
Examples
Shows how to fill a template loaded from stream with data by executing a simple mail merge using a DataTable data source and saving the result as image streams.
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("SecondName");
dt.Columns.Add("Position");
dt.Rows.Add("James", "Bond", "Spy");
dt.Rows.Add("John", "Doe", "Unknown");
using (Stream input = File.OpenRead(MyDir + "MailMergeTemplate.docx"))
{
Stream[] pages = MailMerger.ExecuteToImages(input, new ImageSaveOptions(SaveFormat.Png), dt);
}
See Also
- class ImageSaveOptions
- class MailMergeOptions
- class MailMerger
- namespace Wordize.MailMerging
- assembly Wordize