Issue with export excel/csv from grid
Description
Are there any known issues with the export function in the toolbar of the grid? When I set
it looks like this:
The buttons are there, but no icon or text:

When clicking, it gives the following error:

- igniteui-angular version: 7.1.3
- browser: Chrome latest
Steps to reproduce
Create a igx grid Set the exportExcel and exportCsv to true
@Eralmidia In addition to enabling the export (via the two boolean properties), one needs to specify the actual text that will be shown in the drop-down for each option. Our assumption is that the developer would specify the text that best fits their application, so we don't have default values, hence the tiny empty drop-down. exportExcelText="Export to Excel" exportCsvText="Export to CSV" However, I am not able to reproduce the exception at our end. Could you, please, share some more details or attach a small sample application that demonstrates it?
Hi Galina
I was able to reproduce the issue in a fork of your grid sample app. For some reason, on my dev server it fails on both excel and csv. In the sample app, it works on excel, but fails on csv when using the toolbar. But at least that should give you a starting point to find the error:
https://stackblitz.com/edit/angular-uueun1
@Eralmidia Thank you for providing the sample, it helped a lot. The issue was that the IgxCsvExporterService was not provided in the NgModule and not injected in the component's constructor. I updated the sample with these 2 changes and the export seems to be successful. Please, let me know if you still experience any issues. https://stackblitz.com/edit/angular-export-configuration
Ah, the exports are their own module. That makes sense. Thanks for the support
So, after providing the services, the export works. But whenever I choose excel, I get the following message:

Clicking yes opens the file, and the data seems to be ok. On the CSV there are no errors. This is tested on latest office 365 desktop app
Ok, that's not good. Unfortunately, we cannot reproduce this on our end. I would really appreciate if you can send me the 2 excel files - the exported one before recovery and then the recovered so we can investigate this further.
Ok, I've attached one file where I have pressed yes to recover, and one where I have not.
Thank you. I get the corrupted file error for both of these 2 files. So I compared them and they seem to be absolutely the same. Can you, please, make sure the repaired one was properly saved and resend it? Thanks in advance.
Actually, it seems like repairing and saving the file doesn't really fix the issue. If I repair, and save it as a new workbook, the next time I open it, it needs to repair again. Here is one untouched corrupted, and one which has been repaired and saved as a new workbook:
Export_corrupted.xlsx Export1.xlsx

Repair log:

@Eralmidia I've noticed when excel recovers the corrupted files that you've sent, they contain an empty column - with no header and cell values. So, I've updated the app with similar grid - to contain an empty column. Here is the app: https://stackblitz.com/edit/angular-export-configuration-pnbzmt
On that project, if you click on the exportExcel you will get the same Excel message. So can you please share, do you have such a column in your igxGrid?
@astaev Ah, good catch. I didn't notice that. Yes actually, we do have a column which is templated with a few buttons, for actions which can be applied for each row:

It is templated like this

The columnsData is just a "meta data" array used to determine how the columns shoud render:

So the actions field doesn't really have any data, it is just used to identify the template to use. How can I mark the actions column to be excluded from the export then?
@Eralmidia, you can easily skip that column by handling the excelExporter's onColumnExport event. The event args contain each column details - like header and index. So you can easily skip a column with empty header or by particular column index with this code:
// place the code inside your constructor, where injecting the excelExporter excelExportService.onColumnExport.subscribe( (value: IColumnExportingEventArgs) => { if(value.header === '' /* || value.columnIndex === 0 */) { value.cancel = true; //skip that column from exporting } });
@astaev Thanks, I'll that a go then