# TXSheetControlComponent Class

> TXSheetControlComponent class in the Angular package: Angular lifecycle adapter that mounts the editor outside the Angular change-detection zone.

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

---

Angular lifecycle adapter that mounts the editor outside the Angular change-detection zone.

Package: `@txtextcontrol/tx-sheet-control/angular`. Version: **2.0.0**.

ES module import: `import { TXSheetControlComponent } from '@txtextcontrol/tx-sheet-control';`.

### Constructor

```typescript
new TXSheetControlComponent(host: ElementRef<HTMLElement>, zone: NgZone, platform: object): TXSheetControlComponent
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `host` | `i0.ElementRef<HTMLElement>` | No | Value matching host's declared type and the owning object's validation rules. |
| `zone` | `i0.NgZone` | No | Value matching zone's declared type and the owning object's validation rules. |
| `platform` | `object` | No | Value matching platform's declared type and the owning object's validation rules. |

Returns: `TXSheetControlComponent`.

### Members

#### Properties

| Property | Description |
|---|---|
| [control](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/control-property/llms-full.txt) | The control value of TXSheetControlComponent. |
| [exportProgress](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/exportprogress-property/llms-full.txt) | The exportProgress value of TXSheetControlComponent. |
| [fileOperationFailed](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/fileoperationfailed-property/llms-full.txt) | Failed or canceled operations never emit loaded/saved. |
| [initializationError](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/initializationerror-property/llms-full.txt) | Reports runtime catalog or font loading failures without emitting a usable control. |
| [loaded](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loaded-property/llms-full.txt) | Successful file operations; saved runs after the output bytes are ready. |
| [loading](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loading-property/llms-full.txt) | Cancellable notifications before a file is parsed or an export snapshot is captured. |
| [loadProgress](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loadprogress-property/llms-full.txt) | Actual processing phases and optional byte/page counts. |
| [options](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/options-property/llms-full.txt) | Editor options; mutable appearance settings update in place. Mount-only dashboardMode remains fixed until destruction. |
| [ready](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/ready-property/llms-full.txt) | The ready value of TXSheetControlComponent. |
| [saved](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/saved-property/llms-full.txt) | The saved value of TXSheetControlComponent. |
| [saving](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/saving-property/llms-full.txt) | The saving value of TXSheetControlComponent. |
| [workbookChange](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/workbookchange-property/llms-full.txt) | The workbookChange value of TXSheetControlComponent. |

#### Methods

| Method | Description |
|---|---|
| [load](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/load-method/llms-full.txt) | Loads XLSX/TXWB bytes or CSV/XML/JSON text/UTF-8 bytes through the mounted control, preserving its atomic validation and options. |
| [save](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. |
| [saveText](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/savetext-method/llms-full.txt) | Saves CSV, XML or JSON text through the initialized editor. Settings, events and UTF-8 limits match save; a generated CSV BOM is omitted. |

### 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);
    }
}
```

### See Also

- [TypeScript Angular API](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [TXSheetControlComponent.control Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/control-property/llms-full.txt): TXSheetControlComponent.control property in the TX Sheet Control Angular package, with its type Spreadsheet | undefined and a TypeScript example.
- [TXSheetControlComponent.exportProgress Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/exportprogress-property/llms-full.txt): TXSheetControlComponent.exportProgress property in the TX Sheet Control Angular package, with its type EventEmitter<FileProgressEvent> and a TypeScript example.
- [TXSheetControlComponent.fileOperationFailed Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/fileoperationfailed-property/llms-full.txt): TXSheetControlComponent.fileOperationFailed property in the TX Sheet Control Angular package: Failed or canceled operations never emit loaded/saved.
- [TXSheetControlComponent.initializationError Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/initializationerror-property/llms-full.txt): TXSheetControlComponent.initializationError property in the Angular package: Reports runtime catalog or font loading failures without emitting a usable control.
- [TXSheetControlComponent.load Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/load-method/llms-full.txt): TXSheetControlComponent.load method in the Angular package, with 2 overloads, the parameters input, streamType and options and a TypeScript example.
- [TXSheetControlComponent.loaded Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loaded-property/llms-full.txt): TXSheetControlComponent.loaded property in the TX Sheet Control Angular package: Successful file operations; saved runs after the output bytes are ready.
- [TXSheetControlComponent.loading Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loading-property/llms-full.txt): TXSheetControlComponent.loading property in the Angular package: Cancellable notifications before a file is parsed or an export snapshot is captured.
- [TXSheetControlComponent.loadProgress Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/loadprogress-property/llms-full.txt): TXSheetControlComponent.loadProgress property in the TX Sheet Control Angular package: Actual processing phases and optional byte/page counts.
- [TXSheetControlComponent.options Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/options-property/llms-full.txt): TXSheetControlComponent.options property in the TX Sheet Control Angular package: Editor options; mutable appearance settings update in place.
- [TXSheetControlComponent.ready Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/ready-property/llms-full.txt): TXSheetControlComponent.ready property in the TX Sheet Control Angular package, with its type EventEmitter<Spreadsheet> and a TypeScript example.
- [TXSheetControlComponent.save Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/save-method/llms-full.txt): TXSheetControlComponent.save method in the Angular package: Saves through the mounted control with the same reusable options as JavaScript and .NET.
- [TXSheetControlComponent.saved Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/saved-property/llms-full.txt): TXSheetControlComponent.saved property in the TX Sheet Control Angular package, with its type EventEmitter<FileOperationEvent> and a TypeScript example.
- [TXSheetControlComponent.saveText Method](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/savetext-method/llms-full.txt): TXSheetControlComponent.saveText method in the TX Sheet Control Angular package: Saves CSV, XML or JSON text through the initialized editor.
- [TXSheetControlComponent.saving Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/saving-property/llms-full.txt): TXSheetControlComponent.saving property in the Angular package, with its type EventEmitter<FileOperationStartingEvent> and a TypeScript example.
- [TXSheetControlComponent.workbookChange Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/angular/txsheetcontrolcomponent/workbookchange-property/llms-full.txt): TXSheetControlComponent.workbookChange property in the TX Sheet Control Angular package, with its type EventEmitter<WorkbookChange> and a TypeScript example.

---

## Nearby

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