How to convert data to scientific count when exporting data to excel

Source: Internet
Author: User
How to convert data to scientific count when exporting data to excel

  1. // In the excel. php file
  2. $ ObjActSheet = $ objPHPExcel-> getActiveSheet ();
  3. // Set the topic name
  4. $ ObjActSheet-> setCellValue ("b1", "Card number ");
  5. // Set the column width
  6. $ ObjActSheet-> getColumnDimension ('B')-> setWidth (20); // change the length value set here.

2. the character is understood as a number in excel. generally, it is set to text or try to add spaces.Solution:

  1. // Add data, mainly to process the data to be displayed using the chunk_split () function. you can view the specific usage of this function on your own.
  2. $ ObjActSheet-> setCellValue ("B $ I", chunk_split ("123456789", 4, ""); // of course, if you do not want to see a space between digits, set the value of the field to be split to a greater value. for example, set 4 to a value greater than or equal to 9.

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.