JSP export ID to Excel when the wrong format but the end of X can be _jsp programming

Source: Internet
Author: User

This morning, the client told me that Excel export ID card when the show some of the wrong, I see the original ID card with the end of X can, the others are not correct. Identity is displayed as shown in the figure:

Search on the internet found that the original Excel to see you number of more than 12 digits will show the scientific count. And the ID card is usually 18 digits, so it shows.

The solution is to put "single quotes" in front of the ID card column. Shape as: ' 4206211111111111111

The specific code is as follows: <TD style= "border:1px solid #000;" > ' <s:property value= ' Id_card '/></td>

This will solve the problem, but the ID number will be exported in front of a single quotation mark.

================================================================

I always feel that there is a better way, I searched the Internet, the export can be set TD style, but I set the still no effect.

Wonderful things constantly ah, I am in the local test can pass, put on the server will have no effect. Finally, we found a way to have an effect both locally and on the server:

Add the following code to the front of the page:

Copy Code code as follows:

<style>
td{
Mso-number-format: ' \@ ';
}
</style>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.