# TXSheetControlComponent.save Method

> TXSheetControlComponent.save method in the Angular package: Saves through the mounted control with the same reusable options as JavaScript and .NET.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > TypeScript API > Angular > TXSheetControlComponent > TXSheetControlComponent.save Method
- **1507 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/save-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/save-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/save-method/llms-full.txt

---

Saves through the mounted control with the same reusable options as JavaScript and .NET.

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

### Syntax

```typescript
save(streamType: StreamType$1, options?: SaveOptions$1): 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

Place this standalone component in an Angular application. The ready output initializes invoice data; status outputs report file operations. Buttons call the component load and export methods, and Angular destroys the control with its view.

```typescript
import { Component, ViewChild } from '@angular/core';
import { TXSheetControlComponent, StreamType } from '@txtextcontrol/tx-sheet-control/angular';
import type { Spreadsheet, SpreadsheetOptions } from '@txtextcontrol/tx-sheet-control/angular';

@Component({
    selector: 'app-invoice-editor', standalone: true, imports: [TXSheetControlComponent],
    template: `<tx-sheet-control #sheet style="height:640px" [options]="options"
        (ready)="onReady($event)" (initializationError)="onInitializationError($event)"
        (workbookChange)="status = 'Workbook changed'"
        (loading)="status = 'Loading'" (saving)="status = 'Saving'"
        (loaded)="status = 'Loaded'" (saved)="status = 'Saved'"
        (loadProgress)="status = 'Reading document'" (exportProgress)="status = 'Generating export'"
        (fileOperationFailed)="status = 'Document operation failed'"></tx-sheet-control>
        <input type="file" accept=".xlsx" (change)="loadFile($event)">
        <button [disabled]="!sheet.control" (click)="saveWorkbook()">Download XLSX</button>
        <button [disabled]="!sheet.control" (click)="saveCsv()">Download CSV</button>
        <p role="status">{{status}}</p>`,
})
export class InvoiceEditor {
    @ViewChild(TXSheetControlComponent) sheet!: TXSheetControlComponent;
    options: SpreadsheetOptions = { fontCatalogURL: '/assets/sheet/fonts/catalog.json', theme: 'light' };
    status = 'Starting editor';

    onReady(control: Spreadsheet): void {
        control.workbook.sheets.at(0).range('A1:B3').setValues([
            ['Item', 'Amount'], ['Consulting', 120], ['Training', 80],
        ]);
        this.status = 'Ready';
    }
    onInitializationError(error: unknown): void {
        this.status = error instanceof Error ? error.message : 'Editor could not start';
    }
    async loadFile(event: Event): Promise<void> {
        const file = (event.target as HTMLInputElement).files?.[0];
        if (file && this.sheet.control) await this.sheet.load(new Uint8Array(await file.arrayBuffer()), StreamType.SpreadsheetML);
    }
    async saveWorkbook(): Promise<void> {
        const bytes = await this.sheet.save(StreamType.SpreadsheetML);
        this.download(new Blob([new Uint8Array(bytes)], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }), 'invoice.xlsx');
    }
    async saveCsv(): Promise<void> {
        this.download(new Blob([await this.sheet.saveText(StreamType.CSV)], { type: 'text/csv' }), 'invoice.csv');
    }
    private download(blob: Blob, name: string): void {
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url; link.download = name; link.click();
        setTimeout(() => URL.revokeObjectURL(url), 0);
    }
}
```

### 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

- [TXSheetControlComponent Class](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/llms-full.txt)
- [Loading and Saving Workbooks](https://docs.textcontrol.com/tx-sheet-control/document-processing/load-save/llms-full.txt)
- [SaveOptions Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/saveoptions/llms-full.txt)
- [StreamType Enumeration](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/streamtype/llms-full.txt)

---

## Nearby

- **Previous:** [TXSheetControlComponent.ready Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/ready-property/llms-full.txt)
- **Next:** [TXSheetControlComponent.saved Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/saved-property/llms-full.txt)
