Merge Settings
Every merge request can carry a MergeSettings object that controls how empty data is handled, how values are formatted and which properties the created documents get. All of its properties are optional, and a request without the object merges with the defaults listed below. The tables cover each property with its type, its default and its effect, and link the pages that explain a setting in depth.
The object is the mergeSettings property of the MergeBody that POST /v1/document/merge receives. Overview describes the request as a whole.
Merge Options
These properties change what the merge does with the template and the data:
| Property | Type | Default | Effect | Described in |
|---|---|---|---|---|
removeEmptyFields | Boolean | true | Removes merge fields that receive no data from the document | Merge Fields |
removeEmptyBlocks | Boolean | true | Removes the content of merge blocks that receive no data | Merge Blocks, Conditional Blocks |
removeEmptyImages | Boolean | false | Removes images that have no merge data | Images |
removeEmptyLines | Boolean | false | Removes lines that contain only empty fields and no other content | Merge Fields |
removeTrailingWhitespace | Boolean | true | Removes trailing whitespace before the document is saved | |
mergeHtml | Boolean | false | Lets field data contain formatted HTML, enclosed in an <html> element | HTML Content |
culture | String | "en-US" | The culture of the merge for date and currency values, a language culture name such as "fr-FR" or "de-DE" | Culture |
A line is removed by removeEmptyLines only when nothing but empty fields is on it. Put optional values, such as a second address line, on lines of their own.
Document Properties
These properties are saved in the created documents. The reference lists no default for them:
| Property | Type | Content |
|---|---|---|
author | String | The author of the document |
documentTitle | String | The title of the document |
documentSubject | String | The subject of the document |
creatorApplication | String | The application that created the document |
creationDate | Date and time, as a string | The creation date saved in the document |
lastModificationDate | Date and time, as a string | The date of the last modification saved in the document |
userPassword | String | The password a user needs to open the document. A PDF is encrypted with it, while a DOCX is returned without a password |
Dates are strings in the ISO 8601 date and time format, such as "2026-10-02T09:30:00+00:00", the format the PHP SDK documents as the one the backend uses.
Send Merge Settings With the Web API
The following body merges the demo template sample_invoice.tx with a shortened invoice record, removes lines that are left empty and sets the culture and the document properties. Save it as merge.json:
{
"mergeData": [
{
"invoice_no": "778723",
"billto_name": "Joey Montana",
"billto_companyname": "Montana, LLC",
"billto_street": "1 Washington Dr",
"billto_city": "Charlotte",
"billto_zip": "27878"
}
],
"mergeSettings": {
"removeEmptyLines": true,
"culture": "en-US",
"author": "Text Control, LLC",
"documentTitle": "Invoice 778723",
"creationDate": "2026-10-02T09:30:00+00:00"
}
}
Send it like any other merge request:
curl POST "https://api.reporting.cloud/v1/document/merge?templateName=sample_invoice.tx&returnFormat=PDF" \
"Authorization: ReportingCloud-APIKey $REPORTINGCLOUD_API_KEY" \
"Content-Type: application/json" \
@merge.json \
result.json
jq '.[0]' result.json | base64 > invoice.pdf
Properties you leave out, or set to null, keep their defaults. Instead of the object, the body can also carry "mergeSettings": null, as the HTTP sample of the reference does.
Set Merge Settings in the SDKs
The SDKs map the object to a class or an array of their own. They don't all offer every property:
| Web API | .NET (MergeSettings) | PHP (array key) | Java (MergeSettings) | Ruby (MergeSettings) |
|---|---|---|---|---|
removeEmptyFields | RemoveEmptyFields | remove_empty_fields | setRemoveEmptyFields | remove_empty_fields |
removeEmptyBlocks | RemoveEmptyBlocks | remove_empty_blocks | setRemoveEmptyBlocks | remove_empty_blocks |
removeEmptyImages | RemoveEmptyImages | remove_empty_images | setRemoveEmptyImages | remove_empty_images |
removeEmptyLines | RemoveEmptyLines | Not available | Not available | Not available |
removeTrailingWhitespace | RemoveTrailingWhitespace | remove_trailing_whitespace | setRemoveTrailingWhitespace | remove_trailing_whitespace |
mergeHtml | MergeHtml | merge_html | setMergeHtml | merge_html |
culture | Culture | culture | Not available | Not available |
| Document properties | Author, DocumentTitle, DocumentSubject, CreatorApplication, CreationDate, LastModificationDate, UserPassword | author, document_title, document_subject, creator_application, creation_date, last_modification_date, user_password | setAuthor, setDocumentTitle, setDocumentSubject, setCreatorApplication, setCreationDate, setLastModificationDate, setUserPassword | author, document_title, document_subject, creator_application, creation_date, last_modification_date, user_password |
The differences matter in these cases:
- Java and Ruby. A
MergeSettingsobject of these SDKs sends all five Boolean options and setsremoveEmptyImagestotrueunless you change it, unlike the Web API's default offalse. Without such an object, a request carries no merge settings, and the Web API's defaults apply. Neither SDK hascultureorremoveEmptyLines; send such a request to the Web API directly. - PHP. The SDK takes
creation_dateandlast_modification_dateas Unix timestamps and converts them. It accepts only the culture names of the list that Culture links. A key it doesn't know, such asremove_empty_lines, is ignored. - .NET.
Cultureis astringin the builds of the package for .NET Standard and .NET Core and aSystem.Globalization.CultureInfoin the build for .NET Framework 4.5.
The following C# program sets the options of the curl sample with the .NET SDK:
using TXTextControl.ReportingCloud;
ReportingCloud rc = new ReportingCloud(Environment.GetEnvironmentVariable("REPORTINGCLOUD_API_KEY"));
MergeBody mergeBody = new MergeBody
{
MergeData = new[] { new { invoice_no = "778723", billto_name = "Joey Montana" } },
MergeSettings = new MergeSettings
{
RemoveEmptyLines = true,
Culture = "en-US",
Author = "Text Control, LLC",
DocumentTitle = "Invoice 778723",
CreationDate = DateTime.UtcNow
}
};
List<byte[]> documents = rc.MergeDocument(mergeBody, "sample_invoice.tx", ReturnFormat.PDF);
File.WriteAllBytes("invoice.pdf", documents[0]);
Settings of Other Endpoints
Two other endpoints take settings objects of their own:
- Find and replace. POST /v1/document/findandreplace takes a
MergeSettingsobject as well, in itsFindAndReplaceBody. Its documents get the document properties, whileremoveEmptyFields,removeEmptyBlocks,removeTrailingWhitespace,mergeHtmlandculturehave no effect there, and its reference doesn't listremoveEmptyLines. Find and Replace describes the endpoint. - Appending. POST /v1/document/append takes a
DocumentSettingsobject with the seven document properties and no merge options, as Appending Documents describes.