JS Export Excel Add header, mso-number-format definition data format

Source: Internet
Author: User
Tags format definition

Issue 1: Increase the header

When JS exports the table, it only exports the displayed contents of the table, such as the related string that needs to be added to the header in the string to be fetched in the page, in detail as follows:

  

Tablestring: New table header content string;

Ctx.table: New Header + page gets the table string.

This way, the header is added, and you can set its style by using style:

  

Problem 2:mso-number-format defining data formats

  The scientific notation conversion format that was encountered Mso-number-format definition when doing the project conflicts with the right-aligned style of the amount definition.

Previously wrote a blog dedicated to the Mso-number-format definition scientific notation conversion format. When exporting files using this method, it is sometimes a problem that the exported Excel will often automatically recognize our data as other formats, for example, only fields with pure numbers will be automatically recognized as number formats when exported to Excel, and once the number exceeds 11 digits, Excel will display it in the form of scientific notation, such as a social security number, a telephone number with an area code, and so on.

The property settings for Mso-number-format are written as follows:

<TD style= ' mso-number-format:\ "\@\"; ' class= ' tdright ' >

Class= ' Tdright ' is a right-aligned style, so there is a conflict, and the class-defined style does not work. To avoid conflict, the correct wording is:

<TD style= ' mso-number-format:\ "\@\"; Text-align:right, ' class= ' tdright ' > '

Just write the style in the style, it is not easy to get mad.

Note: class= ' tdright ' cannot be removed, because the TD here is append to the page, and the style of the page requires class to define the right alignment.

Add:

When a table page has an individual that doesn't want to be printed, you just need to hide the element, but some buttons, check boxes, and so on, even if hidden, are displayed:

Print Out is Jiangzi:

The way is to remove the check box, etc., after printing the page and reload the data rendering check box, etc., there may be problems with the performance, for the time being resolved first, there is a better way to update later.

Here's the Mso-number-format .

JS Export Excel Add header, mso-number-format definition data format

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.