You can generate spreadsheets in a very easy and direct way through the service AocSpreadsheetService.
Apart from the service, there is also the AocSpreadsheet
directive available for you to use directly on an element, for example, of type button
, and upon clicking it, the spreadsheet will be downloaded.
For this, you need to define a column configuration that follows the type AocSpreadsheetColumn[]
.
<button aocUiButton icon="table"
aocUiTooltip="Download as XLSX"
aocSpreadsheet [modelConfig]="modelConfig" [columns]="spreadSheetColumns" [where]="where" [restOptions]="restOptions" fileName="Customers.xlsx">
</button>
this.spreadSheetColumns = [
{
header: 'Code',
type: 'string',
field: Customer.field.CODE
},
{
header: 'Legal name',
type: 'string',
field: [ Customer.embedded.LEGAL_DATA_TEMPLATE, LegalDataTemplate.field.LEGAL_NAME ],
style: {
font: {
bold: true
}
}
},
{
header: 'Email',
type: 'string',
field: Customer.field.EMAIL
}
];
Complete example at quest-client/src/app/features/schemas/customers/customer/customer-grid.component.ts
Please note, browse Issues and Discussions in Github for more information