# ExportToExcelService

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/services/common/export-to-excel.service.ts` (line 11)

**Part of:** [Pams](subsystem-pams)

`ExportToExcelService` exposes methods for exporting dashboard widgets to Excel, including an advanced export path. Dashboard components call this service when an export action is requested, keeping export behavior outside UI handlers.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `exportingDashboardWidgetToExcel` | `exportingDashboardWidgetToExcel(header: any[], data: any[], widgetName: string, isDataArrayIncludingTotal: boolean)` | `void` |
| `exportingDashboardWidgetToExcelAdvanced` | `exportingDashboardWidgetToExcelAdvanced(header: any[], headerProperty: string, data: any[], dataProperties: string[], widgetName: string)` | `void` |

## Properties

| Property | Type |
|---|---|
| `xlxsdata` | `any[]` |
| `ExlRow` | `ExcelRow[]` |
| `header` | `any` |
| `value` | `any` |
| `subscription` | `Subscription` |

## Diagram

```mermaid
graph LR
    Dashboard[Dashboard Widget] --> Service[ExportToExcelService]
    Service --> Standard[exportingDashboardWidgetToExcel()]
    Service --> Advanced[exportingDashboardWidgetToExcelAdvanced()]
    Standard --> Excel[Excel Export]
    Advanced --> Excel
```

## Usage

```ts
import { ExportToExcelService } from 'app/services/common/export-to-excel.service';

export class DashboardComponent {
  constructor(
    private readonly exportToExcelService: ExportToExcelService
  ) {}

  exportWidget(): void {
    this.exportToExcelService.exportingDashboardWidgetToExcel();
  }

  exportWidgetAdvanced(): void {
    this.exportToExcelService.exportingDashboardWidgetToExcelAdvanced();
  }
}
```

## AI Coding Instructions

- Inject `ExportToExcelService` into dashboard-facing components instead of placing export logic in click handlers.
- Call `exportingDashboardWidgetToExcel()` for the standard dashboard widget export flow.
- Call `exportingDashboardWidgetToExcelAdvanced()` only where the advanced export flow is intended.
- Check the service implementation before adding arguments, error handling, or loading-state behavior to callers.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `SortingArray` — `Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/widget-booking-vstarget-today/widget-booking-vstarget-today.component.ts`:1
- `WidgetTeamsTargetComponent` — `Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/widget-teams-target/widget-teams-target.component.ts`:1
