# Merge Settings

> Every property of the MergeSettings object of document/merge: remove options, mergeHtml, culture, document properties, userPassword, defaults and SDK names.

- **Product:** ReportingCloud
- **Section:** Documentation
- **Kind:** Topic
- **Path:** ReportingCloud > Mail Merge > Merge Settings
- **2634 words**
- **Web URL:** https://docs.textcontrol.com/reporting-cloud/mail-merge/settings/
- **LLMs URL:** https://docs.textcontrol.com/reporting-cloud/mail-merge/settings/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/reporting-cloud/mail-merge/settings/llms-full.txt

---

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](https://docs.textcontrol.com/reporting-cloud/reference/web-api/document/merge/post/llms-full.txt) receives. [Overview](https://docs.textcontrol.com/reporting-cloud/mail-merge/overview/llms-full.txt) 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](https://docs.textcontrol.com/reporting-cloud/mail-merge/fields/llms-full.txt) |
| `removeEmptyBlocks` | Boolean | `true` | Removes the content of merge blocks that receive no data | [Merge Blocks](https://docs.textcontrol.com/reporting-cloud/mail-merge/blocks/llms-full.txt), [Conditional Blocks](https://docs.textcontrol.com/reporting-cloud/mail-merge/conditional-content/llms-full.txt) |
| `removeEmptyImages` | Boolean | `false` | Removes images that have no merge data | [Images](https://docs.textcontrol.com/reporting-cloud/mail-merge/images/llms-full.txt) |
| `removeEmptyLines` | Boolean | `false` | Removes lines that contain only empty fields and no other content | [Merge Fields](https://docs.textcontrol.com/reporting-cloud/mail-merge/fields/llms-full.txt) |
| `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](https://docs.textcontrol.com/reporting-cloud/mail-merge/html-content/llms-full.txt) |
| `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](https://docs.textcontrol.com/reporting-cloud/mail-merge/culture/llms-full.txt) |

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*:

```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:

```bash
curl -X POST "https://api.reporting.cloud/v1/document/merge?templateName=sample_invoice.tx&returnFormat=PDF" \
  -H "Authorization: ReportingCloud-APIKey $REPORTINGCLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @merge.json \
  -o result.json

jq -r '.[0]' result.json | base64 -d > 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](https://docs.textcontrol.com/reporting-cloud/reference/web-api/document/merge/post/#examples) 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 `MergeSettings` object of these SDKs sends all five Boolean options and sets `removeEmptyImages` to `true` unless you change it, unlike the Web API's default of `false`. Without such an object, a request carries no merge settings, and the Web API's defaults apply. Neither SDK has `culture` or `removeEmptyLines`; send such a request to the Web API directly.
- **PHP.** The SDK takes `creation_date` and `last_modification_date` as Unix timestamps and converts them. It accepts only the culture names of the list that [Culture](https://docs.textcontrol.com/reporting-cloud/mail-merge/culture/#choose-a-culture-name) links. A key it doesn't know, such as `remove_empty_lines`, is ignored.
- **.NET.** `Culture` is a `string` in the builds of the package for .NET Standard and .NET Core and a `System.Globalization.CultureInfo` in the build for .NET Framework 4.5.

The following C# program sets the options of the curl sample with the .NET SDK:

```csharp
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](https://docs.textcontrol.com/reporting-cloud/reference/web-api/document/findandreplace/post/llms-full.txt) takes a `MergeSettings` object as well, in its `FindAndReplaceBody`. Its documents get the document properties, while `removeEmptyFields`, `removeEmptyBlocks`, `removeTrailingWhitespace`, `mergeHtml` and `culture` have no effect there, and its reference doesn't list `removeEmptyLines`. [Find and Replace](https://docs.textcontrol.com/reporting-cloud/document-processing/find-replace/llms-full.txt) describes the endpoint.
- **Appending.** [POST /v1/document/append](https://docs.textcontrol.com/reporting-cloud/reference/web-api/document/append/post/llms-full.txt) takes a `DocumentSettings` object with the seven document properties and no merge options, as [Appending Documents](https://docs.textcontrol.com/reporting-cloud/document-processing/appending/llms-full.txt) describes.

### Related Pages

- [Culture](https://docs.textcontrol.com/reporting-cloud/mail-merge/culture/llms-full.txt): format currency values and dates for a country.
- [HTML Content](https://docs.textcontrol.com/reporting-cloud/mail-merge/html-content/llms-full.txt): merge formatted text with `mergeHtml`.
- [Conditional Blocks](https://docs.textcontrol.com/reporting-cloud/mail-merge/conditional-content/llms-full.txt): show or remove sections with `removeEmptyBlocks`.
- [POST /v1/document/merge](https://docs.textcontrol.com/reporting-cloud/reference/web-api/document/merge/post/llms-full.txt): the endpoint's parameters, body and responses.

---

## Nearby

- **Previous:** [HTML Content](https://docs.textcontrol.com/reporting-cloud/mail-merge/html-content/llms-full.txt)
- **Next:** [Culture](https://docs.textcontrol.com/reporting-cloud/mail-merge/culture/llms-full.txt)
