- Home
- Forum
- Angular - EJ 2
- Excel Export Related issues
Excel Export Related issues
Hi
When using an export, if both numerical columns have values, I can perform formula calculations on the exported Excel file.
However, when I changed the value of one of the numerical columns to empty and exported it to Excel again, the formula calculation could not be used.
This causes the Excel I exported to not be able to perform formula calculations, which is a problem. Hope to get a solution.
thanks
Hi Renard,
Greetings from Syncfusion support,
The issue you're encountering, where formulas in Excel cannot be calculated when one of the numerical columns is empty, occurs because empty cells in the exported Excel file may be treated as non-numeric values (such as text). This causes Excel to throw a VALUE! error, preventing the formula from executing.
To resolve this, you can handle empty cells during the export process using the excelQueryCellInfo event in Syncfusion EJ2 Grid. By ensuring that empty cells are treated as 0, the formula will be able to calculate correctly. Here's how you can implement this:
|
excelQueryCellInfo(args){ if ( args.column.field === 'ProductID' || args.column.field === 'UnitsInStock' || args.column.field === 'UnitPrice' ) { // If the cell is empty, treat it as 0 if (args.value === null || args.value === undefined || args.value === '') { args.value = 0; } } } |
This solution ensures that when exporting the Excel file, empty cells in your specified columns are replaced with 0, allowing the formula to perform calculations without any issues.
Please get back us if you need further assistance.
Regards,
Vikram S
Hi Vikram
Because the grid is currently showing as empty, the Excel file I need to export is also showing as empty. Because some column values have different meanings represented by null and 0. Is there any way to handle this situation.
thanks
#VALUE! error when a formula is used to perform any mathematical operation.excelQueryCellInfo event. Alternatively, when applying the formula, you can convert null values to 0 so that the operation works properly.Code example : excelQueryCellInfo(args){ if ( args.column.field === 'ProductID' || args.column.field === 'UnitsInStock' || args.column.field === 'UnitPrice' ) { // If the cell is empty, treat it as 0 if (args.value === null || args.value === undefined || args.value === '') { args.value = 0; } } } |
Output : |
- 3 Replies
- 3 Participants
-
RE Renard
- Sep 27, 2024 08:43 AM UTC
- Oct 8, 2024 11:18 AM UTC