Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ng-csv and long number (string in the DB)
Message
De
20/09/2019 14:23:16
 
 
À
Tous
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Titre:
Ng-csv and long number (string in the DB)
Divers
Thread ID:
01671013
Message ID:
01671013
Vues:
47
Hi everybody,

I'm trying to solve the issue with Excel opening CSV files with long numbers in scientific notation. I want the numbers to be preserved as they are.

I've read some stackoverflow threads on this topic and this is my last attempt to resolve the issue:
return Ok(new
            {
                CheckoutCardNumbers = checkoutCardNumbers.Select(x => new { NumAssign = "'" + x.NumAssign, x.Pin }),
                CkdOutTo = ckdOutTo
            });
(The NumAssign is a long number like this 6035242799000371 )

Unfortunately, the end result is ' appended to every value in the column and I just want to show them in Excel correctly.

Is there a simple way to still use ng-csv directive but not have this problem with Excel converting to scientific notation?

My button in the form looks like this:
<button type="button" class="btn btn-info" 
                    ng-if="obj.exportCsv.export.length > 0" 
                    id="btnConfirm" name="export" 
                    ng-csv="obj.exportCsv.export" 
                    csv-header="['CardNumber','Pin']" 
                    filename="cardNumbers.csv" 
                    ng-click="$close(obj.exportCsv.export)">
                @Labels.save
            </button>
Any ideas of how to solve the problem with Excel opening the file and converting long numbers into wrong format?

I think we just need to teach the users to do this

09/20/2019 NN: There is no simple way to fix it without breaking CSV file. The best way to overcome this problem may be this one

https://www.youtube.com/watch?v=0qiqcUKVlQI&app=desktop

and consider this problem to be not an issue.

Thanks in advance.

0qiqcUKVlQI
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform