Hi Sharad,
Thanks for the test example. This is still a problem for us in Angular 2. We are using WIJMO version 5.20181.462-rc.
We plan to move away from the –rc version ASAP. However, if I change your stackblitz project’s WIJMO version to 5.20181.462-rc via the package.json file and save, your code still works in your example. I assume this is a good enough test to show that this should be working properly even in the –rc version?
Our JSZIP is version 3.1.5
I think for us, this has to do with how we are importing and using JSZIP. For example, we reference the JSZIP script in our index.html file:
<!-- Export to Excel -->
<script src="assets/wijmo/script/jszip.min.js"></script>
Here is the code we are using:
My.component.html:
<wj-combo-box #cboOption [itemsSource]="['(options)','Export to Excel']" [isEditable]="false" (selectedIndexChanged)="cboOption_selectedIndexChanged($event, cboOption)">
</wj-combo-box>
My.component.ts:
cboOption_selectedIndexChanged(p_event, p_control) {
var strFileName = "Test.xlsx";
var intOption = p_control.collectionView.currentPosition;
switch (intOption) {
case 1: // "Export to Excel"
this.m_wjcGridXlsx.FlexGridXlsxConverter.saveAsync(this.m_grid, { includeColumnHeaders: true, includeCellStyles: false, formatItem: null }, strFileName);
break;
}
}
My.wijmo.parent.class: (perhaps we need something from the wijmo/wijmo.angular2 directory instead?) The rest of the Angular 2 imports are in another file not included here - the file below is imported into every component and lets us reference WIJMO items from one place. I’ve only included the imports and declarations of this file:
import { OnInit, ViewChild, AfterViewInit } from '@angular/core';
import * as wjcCore from 'wijmo/wijmo';
import * as wjcGrid from 'wijmo/wijmo.grid';
import * as wjcGridXlsx from 'wijmo/wijmo.grid.xlsx';
import * as wjcGridFilter from 'wijmo/wijmo.grid.filter';
import * as wjcGridDetail from 'wijmo/wijmo.grid.detail';
public m_wjcCore = wjcCore;
public m_wjcGrid = wjcGrid;
public m_wjcGridXlsx = wjcGridXlsx;
public m_wjcGridDetail = wjcGridDetail;
public m_collectionView: wjcCore.CollectionView;
public m_detailCollectionView: wjcCore.CollectionView;
And here is Excel’s error message when we first try to open the exported file:
‘We found a problem with some content in ‘test.xlsx’. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.’
Once you click ‘yes’, the grid loads but it does not have the datamapped front end values (it instead shows the corresponding numbers instead of our datamap text).
In case this is not enough information, could you open up a ticket with me so that I could share more in depth code with you specifically?
Thanks a lot,
-Kyle Vassella