Hello, I am attempting to export a number dataType column to Excel that has, say a Scale of 3, so DigitsInfo of "1.3-3" and the decimal values are often always 0. So, the grid will show "5.000" correctly with the pipeArgs or a template with my own pipe, but when exported, it seems like we can EITHER:
1. Set skipFormatter to true for the column and the column will export as a number but lose the scale info
2. Preserve the scale digits info, but Excel will treat the column as Text.
It seems like having Excel format it as a number and preserving scale is mutually exclusive, but is there a way to achieve both? I also tried tapping into the rowExporting event like below to brute force a format I want, and this predictably results in #2 (preserving scale, but its text).
exportService.rowExporting.subscribe((args: IRowExportingEventArgs) => { args.rowData.UserRating = formatNumber(args.rowData.UserRating, this.locale, `1.3-3`); });
Hello,
You're absolutely right — and I can confirm that at this time, what you're describing isn't possible using the built-in ExcelExporterService.
Currently, if we format a column (for example, applying a formatter or pipe like 1.3-3 to preserve a numeric scale such as 5.000), the exporter interprets that as a string when exporting to Excel. This means we preserve the visual format, but lose the numeric nature — Excel treats the column as text. Unfortunately, there isn't a built-in configuration or option available right now that lets us preserve both the number type and the formatted scale using ExcelExporterService.
That said, could you confirm whether you're fully relying on the ExcelExporterService and if that's a core part of your logic? If so, and this limitation is blocking, we could consider logging a feature request on our repository to track this need.
Alternatively, if you're open to a different approach, we do have another option using the igniteui-angular-excel library (our lower-level Excel library). It gives full control over the workbook and lets you write values as numbers while still applying precise number formats (like 0.000) — meaning the column is exported as numeric and displays exactly 3 decimal places.
For example, if you have a column like:
<igx-column [field]="'value'" dataType="number" [formatter]="formatNumber"> </igx-column>
And a formatter like:
public formatNumber(value: number): string { return value.toLocaleString('en-US', { maximumFractionDigits: 2 }); }
Then, with the Excel library you can write a custom export routine that uses the raw grid data and handles the export manually, like so:
row.setCellValue(c, this.roundTo3(num)); // stays numeric cell.cellFormat.formatString = '0.000'; // shows 3 decimals
This ensures that Excel sees the column as a real number, but still displays it with fixed scale.
The described scenario could be observed here:
You can see a full working example in this StackBlitz sample I’ve prepared: View StackBlitz Sample
And for more information and resources about the Excel library itself, here's the official documentation: Infragistics Excel Library for Angular
Please do not hesitate to contact me if you need any further assistance with this matter.
Regards,
Georgi Anastasov
Associate Software Developer
Infragistics
Thanks so much for the response, it confirms what I assumed was the case. The export is used on all grids throughout our application and a field like this is more a client request where they want both numeric and scale preservation, but it makes sense that it isn't possible without a heavier library. Obviously if it were possible to add a feature to support it in the ExcelExporterService, I would be all for it.
I have looked at that library and it isn't something we would implement at this time. We have a robust solution server-side that could do this, but the great part about the grid one is how lightweight and fast it is and I think that may still outweigh this downside.
Thanks again.
You're very welcome — and just to follow up, I’ve gone ahead and logged a feature request for this enhancement on your behalf in our GitHub repository:
https://github.com/IgniteUI/igniteui-angular/issues/16086
Our development team will review the request, discuss it internally, and make decisions around feasibility, priority, and timelines. If any updates or estimations become available, they’ll be added directly to that issue thread.
Feel free to subscribe to the feature request to stay up to date with any changes or progress. When the team is able to prioritize it, they will implement it accordingly.
Thanks again for bringing this up — we really appreciate your feedback!