FAQs about styles in PHPExcel

Source: Internet
Author: User
In PHPExcel, you can use PHPExcel to open a template $ PHPReader = newPHPExcel_Reader_Excel2007 (); $ PHPExcel = $ PHPReader-& gt; load (& quot; c: // style questions in muban.xlsx & PHPExcel
Use PHPExcel to open a template

$ PHPReader = new PHPExcel_Reader_Excel2007 ();
$ PHPExcel = $ PHPReader-> load ("c: // muban.xlsx ");

/* Data can be written in this way */
$ PHPExcel-> getActiveSheet ()-> setCellValue ('b1 ', "B1 ");
$ PHPExcel-> getActiveSheet ()-> setCellValue ('B2', "B2 ");
$ PHPExcel-> getActiveSheet ()-> setCellValue ('b3', "B3 ");
$ ObjWriter = new PHPExcel_Writer_Excel2007 ($ PHPExcel );
$ ObjWriter-> save ("c: // test.xlsx ");

/* Shows the effect */



I want to know how to get the style of the above table if I want to insert data in a place below B4?

If there are thousands of data records, how can we keep the format for loop?



------ Solution --------------------
Http://www.pkwind.com/insight-into-application-of-php-classes-phpexcel/
------ Solution --------------------
$ StyleA = $ PHPExcel-> getActiveSheet ()-> getStyle ("A1 ");

The above sentence is to copy the A1 style.

$ PHPExcel-> getActiveSheet ()-> duplicateStyle ($ styleA, "X1 ");
The above sentence is to assign your A1 style to X1

Laifen

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.