This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10144|Reply: 0

[JavaScript] Solve HTML export Excel table numbers to become scientific notation

[Copy link]
Posted on 4/30/2020 4:50:13 PM | | |
In the process of doing the project, I encountered a problem like the question. For example, if you want to export the resident's information to Excel, because the resident's ID number is too long (more than 10 digits), Excel will automatically convert the long string of numbers into scientific counting.(Adding "'" or '' or tab before and after the string of numbers will not work, and Excel will automatically remove these.) )

One of the solutions:<tdstyle="mso-number-format:'\@'; ">100821199909091234</td>  

Added style="mso-number-format:'\@'; " style, (personal test is feasible!) )


Other custom cell formatting styles

mso-number-format:"0"NO Decimals
mso-number-format:"0\.000"3 Decimals
mso-number-format:"\#\,\#\#0\.000"Comma with 3 dec
mso-number-format:"mm\/dd\/yy"Date7
mso-number-format:"mmmm\ d\,\ yyyy"Date9
mso-number-format:"m\/d\/yy\ h\:mm\ AM\/PM"D -T AMPM
mso-number-format:"Short Date"01/03/1998
mso-number-format:"Medium Date"01-mar-98
mso-number-format:"d\-mmm\-yyyy"01-mar-1998
mso-number-format:"Short Time"5:16
mso-number-format:"Medium Time"5:16 am
mso-number-format:"Long Time"5:16:21:00
mso-number-format:"Percent"Percent - two decimals
mso-number-format:"0%"Percent - no decimals
mso-number-format:"0\.E+00"Scientific Notation
mso-number-format:"\@"Text
mso-number-format:"\#\ ???\/???"Fractions - up to 3 digits (312/943)
mso-number-format:"\0022£\0022\#\,\#\#0\.00"£12.76
mso-number-format:"\#\,\#\#0\.00_ \;Red\-\#\,\#\#0\.00\ "

2 decimals, negative numbers in red and signed
(1.56   -1.56)






Previous:WCF sets the timeout timeout
Next:SQL Server If Exists multi-condition judgment
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com