# XlsxAdvExport

## Content

# Namespace: XlsxAdvExport

## Table of contents

### Type aliases

- [CheckCancelCallback](XlsxAdvExport#checkcancelcallback)
- [OnProgressCallback](XlsxAdvExport#onprogresscallback)
- [XlsxAdvSettings](XlsxAdvExport#xlsxadvsettings)
- [XlsxExportResult](XlsxAdvExport#xlsxexportresult)
- [XlsxSettingsInfo](XlsxAdvExport#xlsxsettingsinfo)

### Functions

- [exportDocument](XlsxAdvExport#exportdocument)

## Type aliases

### <a id="checkcancelcallback" name="checkcancelcallback"></a> CheckCancelCallback

Ƭ **CheckCancelCallback**: () => `boolean`

#### Type declaration

▸ (): `boolean`

Defines a callback that determines whether export should be canceled.

**`example`**
```ts
const shouldCancel: CheckCancelCallback = () => false;
```

##### Returns

`boolean`

`true` to cancel the export; otherwise, `false`.

___

### <a id="onprogresscallback" name="onprogresscallback"></a> OnProgressCallback

Ƭ **OnProgressCallback**: (`pageNumber`: `number`) => `void`

#### Type declaration

▸ (`pageNumber`): `void`

Defines a callback invoked after each sheet is rendered.

**`example`**
```ts
const onProgress: OnProgressCallback = (pageNumber) => console.log(pageNumber);
```

##### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `pageNumber` | `number` | The one-based sheet number that has finished rendering. |

##### Returns

`void`

___

### <a id="xlsxadvsettings" name="xlsxadvsettings"></a> XlsxAdvSettings

Ƭ **XlsxAdvSettings**: `Object`

Represents advanced XLSX export settings.

**`example`**
```ts
const settings: XlsxAdvSettings = {
	info: { creator: 'Contoso' },
	password: 'secret',
};
```

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `info?` | [`XlsxSettingsInfo`](XlsxAdvExport#xlsxsettingsinfo) | Gets or sets the document metadata. |
| `password?` | `string` | Gets or sets the password used to encrypt the document. |

___

### <a id="xlsxexportresult" name="xlsxexportresult"></a> XlsxExportResult

Ƭ **XlsxExportResult**: `Object`

Represents the result of an XLSX export.

**`example`**
```ts
const result: XlsxExportResult = {
	data: new Blob(),
	download: (name) => console.log(name),
};
```

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `data` | `Blob` | Gets or sets the exported content. |
| `download` | (`filename?`: `string`) => `void` | Gets or sets the function that triggers a browser download of the export result.  **`example`** ```ts const result = {} as XlsxExportResult; result.download('report.xlsx'); ``` |

___

### <a id="xlsxsettingsinfo" name="xlsxsettingsinfo"></a> XlsxSettingsInfo

Ƭ **XlsxSettingsInfo**: `Object`

Represents XLSX document metadata.

**`example`**
```ts
const info: XlsxSettingsInfo = { creator: 'Contoso' };
```

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `creator?` | `string` | Gets or sets the document creator. |

## Functions

### <a id="exportdocument" name="exportdocument"></a> exportDocument

▸ **exportDocument**(`source`, `settings?`, `onProgress?`, `checkCancel?`): `Promise`<[`XlsxExportResult`](XlsxAdvExport#xlsxexportresult)\>

Exports a PageDocument or VDomRenderer to XLSX using the cell-based pipeline.

**`example`**
```ts
const result = await exportDocument(report, { password: 'secret' });
result.download('report.xlsx');
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `source` | [`PageDocument`](../classes/Core.PageDocument) \| `VDomRenderer` \| (`options`: [`RenderOptions`](Core#renderoptions) & { `forceCellbased?`: `boolean`  }) => `Promise`<`VDomRenderer`\> | The source document, renderer, or renderer factory to export. |
| `settings?` | [`XlsxAdvSettings`](XlsxAdvExport#xlsxadvsettings) | The advanced XLSX export settings. |
| `onProgress?` | [`OnProgressCallback`](XlsxAdvExport#onprogresscallback) | The callback invoked after each sheet is rendered. |
| `checkCancel?` | [`CheckCancelCallback`](XlsxAdvExport#checkcancelcallback) | The callback invoked before rendering each sheet. Return `true` to cancel. |

#### Returns

`Promise`<[`XlsxExportResult`](XlsxAdvExport#xlsxexportresult)\>

A promise that resolves to the export result.
