简体   繁体   中英

Can't export to excel a Syncfusion pivot table with enableVirtualization = true in Angular

Here is the component.html code.

<ejs-pivotview #pivotview id='PivotView'
[dataSourceSettings]=dataSourceSettings
allowExcelExport='true'
allowConditionalFormatting='false'
allowPdfExport='true'
showToolbar='true'
allowCalculatedField='true'
showFieldList='true'
showGroupingBar='true'
[chartSettings]='chartSettings'
expandAll='true'
exportAllPages='true'
enableVirtualization='true'
height='500'
[gridSettings]='gridSettings'
[displayOption]='displayOption'
locale='es'
[toolbar]='toolbarOptions'
width="getWidth()"
>

And in component.ts

import {
    FieldListService, CalculatedFieldService,
    ToolbarService, ConditionalFormattingService,
   ToolbarItems, DisplayOption, GroupingBarService,
   IDataOptions, VirtualScrollService
} from '@syncfusion/ej2-angular-pivotview';
//...
//...
declare var require: any;
@Component({
  selector: 'app-repo-pivote',
  templateUrl: './repo-pivote.component.html',
  //encapsulation: ViewEncapsulation.None,
  styleUrls: ['./repo-pivote.component.css'],
  providers: [CalculatedFieldService, ToolbarService, ConditionalFormattingService, FieldListService, GroupingBarService,VirtualScrollService]
})

Data is over 30K rows.

With this error.

在此处输入图像描述

When I drop the enableVirtualization parameter it exports well.

UPDATE

This is a simple project that shows the problem.

https://stackblitz.com/edit/angular-ivy-747r19?file=src/app/app.component.html

I could resolve it with this

import {
  ExcelExportService,
  PDFExportService,
} from '@syncfusion/ej2-angular-pivotview';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  encapsulation: ViewEncapsulation.None,
  styleUrls: ['app.component.css'],
  providers: [
    ExcelExportService,
    PDFExportService,
  ],
})

In the import I added ExcelExportService and PDFExportService, also in the component providers too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM