Hi team, How to keep precision intact for number fields while creating excel via node js
Q1) If a number is having more than 15 digits…it is loosing its end precision, there are many usecases that this should not happen
Q2) How to avoid numbers getting changed to Scientific notation (3.17411E+18)
Please explain how to achieve this
@vinaybabu
Can you please specify which version of Aspose.Cells for Node.js you are using and provide a code snippet that demonstrates the issue with number precision?
We are using Aspose 24.1.0
@vinaybabu,
You may manually test your scenario/case by entering long numbers (numbers with more than 15 digits) and you may found the same behavior, i.e., numbers are changed to scientific notations. So, this may not be an issue with Aspose.Cells.
I think you may try to add one heading quote (“'”) sign for those long numbers which need to be taken as strings value instead of numbers if you really need the exact long number to be shown/kept. For example, when entering/importing into Excel spreadsheet, the number
“3174105301830007
”
should be:
“'3174105301830007
”
@amjad.sahi I understand even entering number in normal excel behaves the same way.
Is there no other way to handle this type of scenarios without adding quote at the end?
I believe aspose would have some solution for this
@vinaybabu,
There may not be any better way to cope with it. I am afraid, this is MS Excel’s capacity for Excel spreadsheets (which has 15 digits limits) and nothing to do with Aspose.Cells.
@amjad.sahi Even I try in a way that setting column type to text explicity via code… why this issue is getting observeD
i was looking if we can set any custom format or any solution like this
@vinaybabu,
Even if you set custom number formatting “0.00” for a cell (which is having long numeric value), it will include zeros after 15th digit.
@vinaybabu
If you input such kind of data as numeric values for Cell, then you can only get the displayed result with maximum 15 digits. It is ms excel’s behavior to do with numeric values. If you need to keep the original literal value after putting them into cells, we are afraid you have to treat them as text(string) values and put the text(formatted as what you need) to cell.