Export to XLS table reports

This commit is contained in:
Jose Alberto Hernandez
2024-01-05 17:05:50 +01:00
committed by Adam Saghy
parent 80b821838c
commit 546e59113f
16 changed files with 146 additions and 5 deletions
@@ -2,15 +2,19 @@
<div *ngIf="!hideOutput && !toBeExportedToRepo">
<div class="m-b-10" *ngIf="dataObject.report.type === 'Table'" fxLayoutAlign="end">
<div class="m-b-10" *ngIf="dataObject.report.type === 'Table'" fxLayoutGap="25px" fxLayoutAlign="end">
<button mat-raised-button color="primary" (click)="exportFile()" [disabled]="notExistsReportData"
matToolTip="{{'labels.text.Export the data to CSV file' | translate}}">
{{'labels.buttons.Export CSV' | translate}}
</button>
<button mat-raised-button color="primary" (click)="exportToXLS()" [disabled]="notExistsReportData"
matToolTip="{{'labels.text.Export the data to XLS file' | translate}}">
{{'labels.buttons.Export XLS' | translate}}
</button>
</div>
<div class="table-output" [hidden]="notExistsReportData">
<table mat-table [dataSource]="dataSource">
<table id="report-table" mat-table [dataSource]="dataSource">
<div *ngFor="let column of displayedColumns index as i">
<ng-container [matColumnDef]="column">
<th mat-header-cell *matHeaderCellDef>{{column}}</th>
@@ -2,7 +2,7 @@
import { Component, Input, ViewChild, OnChanges } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { DecimalPipe, NumberSymbol, getLocaleNumberSymbol } from '@angular/common';
import { DecimalPipe } from '@angular/common';
/** Custom Servies */
import { ReportsService } from '../../reports.service';
@@ -14,6 +14,8 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
import { environment } from 'environments/environment';
import { ProgressBarService } from 'app/core/progress-bar/progress-bar.service';
import * as XLSX from 'xlsx';
/**
* Table and SMS Component
*/
@@ -135,6 +137,21 @@ export class TableAndSmsComponent implements OnChanges {
});
}
exportToXLS(): void {
const fileName = `${this.dataObject.report.name}.xlsx`;
const data = this.csvData.map((object: any) => {
const row = {};
for (let i = 0; i < this.displayedColumns.length; i++) {
row[this.displayedColumns[i]] = object.row[i];
}
return row;
});
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, {header: this.displayedColumns});
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Report');
XLSX.writeFile(wb, fileName);
}
/**
* Generates the CSV file dynamically for run report data.
*/
+3 -1
View File
@@ -387,7 +387,8 @@
"Enable": "Umožnit",
"Expand All": "Rozšířit vše",
"Export": "Vývozní",
"Export CSV": "Export CSV",
"Export CSV": "Vývozní CSV",
"Export XLS": "Vývozní XLS",
"Foreclosure": "Exekuce",
"GLIM Loan Application": "Žádost o půjčku GLIM",
"GSIM Application": "Aplikace GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Kontroly tabulky dat entit",
"Entity Data Table Checks Organization": "Definujte kontroly tabulky dat entit pro organizaci",
"Entity to Entity Mapping": "Mapování entity na entitu",
"Export output data to S3 repository": "Exportní výstupní data do úložiště S3",
"External Asset Owner": "Externí vlastník aktiv",
"External Events configuration, to enable or disable": "Konfigurace externích událostí pro povolení nebo zakázání publikování událostí",
"External Services": "Externí služby",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Alle erweitern",
"Export": "Export",
"Export CSV": "CSV exportieren",
"Export XLS": "XLS exportieren",
"Foreclosure": "Zwangsvollstreckung",
"GLIM Loan Application": "GLIM-Kreditantrag",
"GSIM Application": "GSIM-Anwendung",
@@ -2425,6 +2426,7 @@
"Entity Data Table Checks": "Überprüfungen der Entitätsdatentabelle",
"Entity Data Table Checks Organization": "Definieren Sie Entitätsdatentabellenprüfungen für die Organisation",
"Entity to Entity Mapping": "Zuordnung von Entität zu Entität",
"Export output data to S3 repository": "Exportieren Sie Ausgabedaten in S3 Repository",
"External Asset Owner": "Externer Asset-Eigentümer",
"External Events configuration, to enable or disable": "Konfiguration externer Ereignisse, um die Ereignisveröffentlichung zu aktivieren oder zu deaktivieren",
"External Services": "Externe Dienste",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expand All",
"Export": "Export",
"Export CSV": "Export CSV",
"Export XLS": "Export XLS",
"Foreclosure": "Foreclosure",
"GLIM Loan Application": "GLIM Loan Application",
"GSIM Application": "GSIM Application",
@@ -2427,6 +2428,7 @@
"Entity Data Table Checks": "Entity Data Table Checks",
"Entity Data Table Checks Organization": "Define Entity Data Table Checks for Organization",
"Entity to Entity Mapping": "Entity to Entity Mapping",
"Export output data to S3 repository": "Export output data to S3 repository",
"External Asset Owner": "External Asset Owner",
"External Events configuration, to enable or disable": "External Events configuration, to enable or disable the event publication",
"External Services": "External Services",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expandir todo",
"Export": "Exportar",
"Export CSV": "Exportar CSV",
"Export XLS": "Exportar XLS",
"Foreclosure": "Juicio hipotecario",
"GLIM Loan Application": "Solicitud de Crédito GLIM",
"GSIM Application": "Aplicación GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verificaciones de la tabla de datos de la entidad",
"Entity Data Table Checks Organization": "Definir comprobaciones de la tabla de datos de la entidad para la organización",
"Entity to Entity Mapping": "Mapeo de entidad a entidad",
"Export output data to S3 repository": "Exportar datos de salida al repositorio S3",
"External Asset Owner": "Propietario de activos externos",
"External Events configuration, to enable or disable": "Configuración de Eventos Externos, para habilitar o deshabilitar la publicación de eventos",
"External Services": "Servicios externos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Développer tout",
"Export": "Exporter",
"Export CSV": "Exporter au format CSV",
"Export XLS": "Exporter au format XLS",
"Foreclosure": "Forclusion",
"GLIM Loan Application": "Demande de prêt GLIM",
"GSIM Application": "Demande GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Vérifications du tableau de données d'entité",
"Entity Data Table Checks Organization": "Définir des contrôles de table de données d'entité pour l'organisation",
"Entity to Entity Mapping": "Mappage d’entité à entité",
"Export output data to S3 repository": "Exporter des données de sortie vers le référentiel S3",
"External Asset Owner": "Propriétaire de l'actif externe",
"External Events configuration, to enable or disable": "Configuration des événements externes, pour activer ou désactiver la publication des événements",
"External Services": "Services externes",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Espandi tutto",
"Export": "Esportare",
"Export CSV": "Esporta CSV",
"Export XLS": "Esporta XLS",
"Foreclosure": "Pignoramento",
"GLIM Loan Application": "Richiesta di prestito GLIM",
"GSIM Application": "Applicazione GSMIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verifiche della tabella dei dati dell'entità",
"Entity Data Table Checks Organization": "Definire i controlli della tabella dei dati dell'entità per l'organizzazione",
"Entity to Entity Mapping": "Mappatura da entità a entità",
"Export output data to S3 repository": "Export Output Data in S3 Repository",
"External Asset Owner": "Proprietario della risorsa esterna",
"External Events configuration, to enable or disable": "Configurazione Eventi Esterni, per abilitare o disabilitare la pubblicazione degli eventi",
"External Services": "Servizi esterni",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "모두 확장",
"Export": "내보내다",
"Export CSV": "CSV 내보내기",
"Export XLS": "XLS 내보내기",
"Foreclosure": "유질",
"GLIM Loan Application": "GLIM 대출 신청",
"GSIM Application": "GSIM 애플리케이션",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "엔터티 데이터 테이블 확인",
"Entity Data Table Checks Organization": "조직에 대한 엔터티 데이터 테이블 검사 정의",
"Entity to Entity Mapping": "엔터티 간 매핑",
"Export output data to S3 repository": "출력 데이터를 S3 저장소로 내 보냅니다",
"External Asset Owner": "외부 자산 소유자",
"External Events configuration, to enable or disable": "이벤트 게시를 활성화 또는 비활성화하기 위한 외부 이벤트 구성",
"External Services": "외부 서비스",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Išplėsti viską",
"Export": "Eksportuoti",
"Export CSV": "Eksportuoti CSV",
"Export XLS": "Eksportuoti XLS",
"Foreclosure": "Uždarymas",
"GLIM Loan Application": "GLIM paskolos paraiška",
"GSIM Application": "GSIM programa",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Subjektų duomenų lentelės patikrinimai",
"Entity Data Table Checks Organization": "Apibrėžkite organizacijos objektų duomenų lentelės patikras",
"Entity to Entity Mapping": "Objekto atvaizdavimas",
"Export output data to S3 repository": "Eksportuoti išvesties duomenis į S3 saugyklą",
"External Asset Owner": "Išorinis turto savininkas",
"External Events configuration, to enable or disable": "Išorinių įvykių konfigūracija, norėdami įjungti arba išjungti įvykio publikavimą",
"External Services": "Išorės paslaugos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Paplašināt visu",
"Export": "Eksportēt",
"Export CSV": "Eksportēt CSV",
"Export XLS": "Eksportēt XLS",
"Foreclosure": "Preces ierobežošana",
"GLIM Loan Application": "GLIM aizdevuma pieteikums",
"GSIM Application": "GSIM lietojumprogramma",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Entītijas datu tabulu pārbaudes",
"Entity Data Table Checks Organization": "Definējiet entītiju datu tabulu pārbaudes organizācijai",
"Entity to Entity Mapping": "Entītiju kartēšana",
"Export output data to S3 repository": "Eksporta izvades dati uz S3 repozitoriju",
"External Asset Owner": "Ārējais īpašuma īpašnieks",
"External Events configuration, to enable or disable": "Ārējo notikumu konfigurācija, lai iespējotu vai atspējotu notikuma publicēšanu",
"External Services": "Ārējie pakalpojumi",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "सबै विस्तार गर्नुहोस्",
"Export": "निर्यात गर्नुहोस्",
"Export CSV": "CSV निर्यात गर्नुहोस्",
"Export XLS": "XLS निर्यात गर्नुहोस्",
"Foreclosure": "फोरक्लोजर",
"GLIM Loan Application": "GLIM ऋण आवेदन",
"GSIM Application": "GSIM आवेदन",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "संस्था डेटा तालिका जाँच",
"Entity Data Table Checks Organization": "संगठनको लागि इकाई डेटा तालिका जाँचहरू परिभाषित गर्नुहोस्",
"Entity to Entity Mapping": "एकाई देखि इकाई म्यापिङ",
"Export output data to S3 repository": "S3 रिपोजिटरीमा आउटपुट डाटा निर्यात गर्नुहोस्",
"External Asset Owner": "बाह्य सम्पत्ति मालिक",
"External Events configuration, to enable or disable": "घटना प्रकाशन सक्षम वा असक्षम गर्न बाह्य घटना कन्फिगरेसन",
"External Services": "बाह्य सेवाहरू",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expandir todos",
"Export": "Exportar",
"Export CSV": "Exportar CSV",
"Export XLS": "Exportar XLS",
"Foreclosure": "Execução hipotecária",
"GLIM Loan Application": "Solicitação de empréstimo GLIM",
"GSIM Application": "Aplicação GSM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verificações da tabela de dados da entidade",
"Entity Data Table Checks Organization": "Definir verificações da tabela de dados da entidade para a organização",
"Entity to Entity Mapping": "Mapeamento de entidade para entidade",
"Export output data to S3 repository": "Exportar dados de saída para o repositório S3",
"External Asset Owner": "Proprietário de ativo externo",
"External Events configuration, to enable or disable": "Configuração de Eventos Externos, para ativar ou desativar a publicação de eventos",
"External Services": "Serviços externos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Panua Yote",
"Export": "Hamisha",
"Export CSV": "Hamisha CSV",
"Export XLS": "Hamisha XLS",
"Foreclosure": "Foreclosure",
"GLIM Loan Application": "Maombi ya Mkopo wa GLIM",
"GSIM Application": "Maombi ya GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Ukaguzi wa Jedwali la Data ya Huluki",
"Entity Data Table Checks Organization": "Bainisha Ukaguzi wa Jedwali la Data ya Huluki kwa Shirika",
"Entity to Entity Mapping": "Uchoraji wa Huluki kwa Huluki",
"Export output data to S3 repository": "Data ya pato la kuuza nje kwa hazina ya S3",
"External Asset Owner": "Mmiliki wa Mali ya Nje",
"External Events configuration, to enable or disable": "Usanidi wa Matukio ya Nje, ili kuwezesha au kuzima uchapishaji wa tukio",
"External Services": "Huduma za Nje",