I am configuring my pivot grid like so:
private configurePivotGrid() { const formatter = (value) => { // Check if the value is a valid number if (isNaN(value) || value === null || value === undefined) { return ''; } // Format the value to two decimal places return new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, }).format(value); }; const areaTypeDimensions = this.areaTypeList.map(areaType => ({ memberName: areaType.name, displayName: areaType.name, memberFunction: (record) => { const areaTypeValue = record.areaTypeValues.find(value => value.areaType === areaType.name); return areaTypeValue ? `${areaTypeValue.areaValue}` : ''; }, enabled: false })); this.pivotConfig = { pivotKeys: { aggregations: 'aggregations', records: 'records', children: 'children', level: 'level', columnDimensionSeparator: '*', rowDimensionSeparator: '*', }, columns: [ ], rows: [ { memberName: 'discipline', displayName: 'Discipline', enabled: false}, { memberName: 'schedule', displayName: 'Schedule', enabled: false} ], values: [ { member: 'quantity', displayName: 'Quantity', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'labourCost', displayName: 'Labour Cost', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'materialCost', displayName: 'Material Cost', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'totalCost', displayName: 'Total Cost', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'manhours', displayName: 'Manhours', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'factoredManhours', displayName: 'Factored Manhours', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) }, { member: 'ccr', displayName: 'CCR', aggregate: { aggregator: IgxPivotNumericAggregate.sum, key: 'SUM', label: 'SUM' }, enabled: true, formatter: (value) => formatter(value) } ], filters: [ { memberName: 'drawingNumber', displayName: 'Drawing Number', enabled: false, }, ...areaTypeDimensions, { memberName: 'drawingSheet', displayName: 'Drawing Sheet', enabled: false}, { memberName: 'drawingRevision', displayName: 'Drawing Revision', enabled: false}, { memberName: 'r6Item', displayName: 'R6 Item', enabled: false}, { memberName: 'r7Item', displayName: 'R7 Item', enabled: false}, { memberName: 'material', displayName: 'Material', enabled: false}, { memberName: 'unitSymbol', displayName: 'Unit Symbol', enabled: false} ] }; } public exportButtonHandler() { this.excelExportService.export(this.boqPivotGrid, new IgxExcelExporterOptions('BOQ Pivot Data')); }
<button *ngIf="boqGridRows && boqGridRows.length > 0 && hasDownloadPermissions" igxButton="contained" (click)="exportButtonHandler()" class="export-button">Export To Excel</button> <div class="pivot-container" [hidden]="!(boqGridRows && boqGridRows.length > 0)"> <igx-pivot-grid #boqPivotGrid [data]="boqGridRows" [pivotConfiguration]="pivotConfig" height="100%" width="100%" [superCompactMode]="true" [defaultExpandState]='true' > </igx-pivot-grid> <igx-pivot-data-selector [grid]="boqPivotGrid"></igx-pivot-data-selector> </div>
Hello Lewis,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Regards, Riva Ivanova Software Developer
That's perfect thank you! That solves the issue I was having
Thank you for posting in our community!
I have been looking into your question and an approach I can suggest is using the IgxExcelExporter service columnExporting event. Then, inside the event handler, you can set the skipFormatter argument to true.
This could look similar to the following:
constructor(private excelExportService: IgxExcelExporterService) { this.excelExportService.columnExporting.subscribe((args) => { args.skipFormatter = true; }); }
Additionally, if you require additional modification on the exported data, this can be achieved via the rowExporting event.
For example:
constructor(private excelExportService: IgxExcelExporterService) { this.excelExportService.rowExporting.subscribe((args) => { args.rowData.quantity = parseFloat(args.rowData.quantity.toFixed(2)); }); }
Please test this approach on your side and let me know if you need any further assistance regarding this matter.
Sincerely, Riva Ivanova Software Developer