Puede generar spreadsheets (hojas de cálculo) de una forma muy fácil y directa a través del servicio AocSpreadsheetService.
A parte del servicio, también tiene disponible la directiva AocSpreadsheet
para que la use directamente sobre un elemento, por ejemplo, de tipo button
, y al pulsarlo se descargará la hoja de cálculo.
Para ello tiene que definir una configuración de columnas que obedece al tipo 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
}
];
Ejemplo completo en quest-client/src/app/features/schemas/customers/customer/customer-grid.component.ts
Por favor, busque en Issues y Discussions en Github para más información