The difference between CSS style and class

Source: Internet
Author: User

Problem Description:

Web page Click the "Export" button, save the page table content into an Excel file, but found that the table style cannot be saved

Analysis Process:

The 1.table table uses class instead of style. The class definition is not exported and the style is exported by writing the color style directly in the style if you change to a style.

Style is a pattern, which is used in HTML to mark the attribute style, is the content of the CSS , and the class is the content of the contents of the category, Declaration and definition, when exporting the page does not export the definition of the style defined by class.

2. You can also export a style by placing the class definition in the table

WORKAROUND-:

Replace class= "${getclass ()}" with Style= "Color:${getstyle ()};"

Add:

$ (' #export '). Click (function () {
Saveasexcel ($ (' H3 '). Text (), $ (' #table '). html (). Replace (/( ) +/gi, "));
});

Where Excel recognizes only table, the class definition is not saved when you save automatically using the Saveasexcel method, and the class definition can be saved if you copy and paste it to excel manually.

Mainly manual and automatic copy pasting problem

Workaround Two:

Move the classes defined in

The difference between CSS style and class

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.