Skip to content

Commit 7f2c7f9

Browse files
committed
fix(pdf): exclude quarters to improve readability
1 parent 25e7c63 commit 7f2c7f9

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

src/app/pivot-grid/pivot-export/pivot-export.component.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import { Component, ViewChild, inject } from "@angular/core";
22

3-
import { IPivotConfiguration, IgxPivotDateDimension, IgxPivotNumericAggregate, PivotAggregation, IgxExcelExporterOptions, IgxExcelExporterService, IgxPdfExporterService, IgxPdfExporterOptions } from 'igniteui-angular/grids/core';
3+
import {
4+
IPivotConfiguration,
5+
IgxPivotDateDimension,
6+
IgxPivotNumericAggregate,
7+
PivotAggregation,
8+
IgxExcelExporterOptions,
9+
IgxExcelExporterService,
10+
IgxPdfExporterService,
11+
IgxPdfExporterOptions,
12+
IColumnExportingEventArgs
13+
} from 'igniteui-angular/grids/core';
414
import { IgxPivotGridComponent } from 'igniteui-angular/grids/pivot-grid';
515
import { IgxButtonDirective } from 'igniteui-angular/directives';
616
import { SALES_DATA } from "../../data/dataToAnalyze";
@@ -127,6 +137,18 @@ export class PivotExportComponent {
127137
}
128138

129139
public exportPdfButtonHandler() {
130-
this.pdfExportService.export(this.grid, new IgxPdfExporterOptions('ExportedDataFile'));
140+
const pdfOptions = new IgxPdfExporterOptions('ExportedDataFile');
141+
142+
this.pdfExportService.columnExporting.subscribe((args: IColumnExportingEventArgs) => {
143+
const header = args.header || '';
144+
145+
// Cancel if it's a quarter (Q1-Q4)
146+
// This makes the PDF more readable by excluding less important columns
147+
if (/Q[1-4]/i.test(header)) {
148+
args.cancel = true;
149+
}
150+
});
151+
152+
this.pdfExportService.export(this.grid, pdfOptions);
131153
}
132154
}

0 commit comments

Comments
 (0)