# MailMergeTemplate.save Method

> MailMergeTemplate.save method in the browser TypeScript API: Saves the captured template through the same format dispatcher as a workbook.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > TypeScript API > Browser Editor > MailMergeTemplate > MailMergeTemplate.save Method
- **566 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/save-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/save-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/save-method/llms-full.txt

---

Saves the captured template through the same format dispatcher as a workbook.

Owner: [MailMergeTemplate](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

### Syntax

```typescript
save(streamType: StreamType, options?: SaveOptions): Promise<Uint8Array>
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `streamType` | `StreamType` | No | The supported input or output format. PDF is output-only. |
| `options` | `SaveOptions \| undefined` | Yes | Supported settings for this operation; omitted settings retain documented defaults. |

### Return Value

`Promise<Uint8Array<ArrayBufferLike>>`.

### Examples

Pass an existing MailMergeTemplate from the owning document. Related handles and input bytes must belong to the intended document and application; the function applies the operation and inspects its result.

```typescript
import type { MailMergeTemplate } from '@txtextcontrol/tx-sheet-control';
import { StreamType } from '@txtextcontrol/tx-sheet-control';

async function applyMailMergeTemplateSave(mailMergeTemplate: MailMergeTemplate) {
    const result = await mailMergeTemplate['save'](StreamType.InternalWorkbookFormat, {
        pdf: { title: 'Invoice', locale: 'de-DE' },
    });

    console.log(result);
}
```

### Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

### See Also

- [MailMergeTemplate Class](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/llms-full.txt)
- [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt)
- [StreamType Enumeration](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/streamtype/llms-full.txt)
- [SaveOptions Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/saveoptions/llms-full.txt)

---

## Nearby

- **Previous:** [MailMergeTemplate.merge Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/mailmergetemplate/merge-method/llms-full.txt)
- **Next:** [MultiSheetDocument Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/multisheetdocument/llms-full.txt)
