简体   繁体   中英

HTML table copy paste data to Excel without 1000s separator

Server code generates HTML table (Bootstrap 3), where numbers for easy reading are formatted with 1000s / group separator as space. This is done with .ToString("#,0.00") . However space is encoded in HTML as   . This creates a problem once copied and pasted into Excel, as is not recognised as a number.

I am looking for a solution how to solve this, so that the numbers in html table pasted into Excel will be recognised as numbers, without need for cleaning it up in Excel.

Update 1.

This legacy ASP.NET WebForms application. I have tried both <%# %> (data-binding expression) and <%#: %> (HTML encoded data-binding expression) server-side scripting delimiters. However both to my surprise encode space as &nbsp; .

Are ordinary spaces pasted into Excel correctly? You can create a custom culture with thousand separator set to ordinary space instead of non-breaking one and use it when converting numbers to string then

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM