Questions about phpexcel

Source: Internet
Author: User
Tags php excel
Questions about phpexcel excel template & nbsp; ABCD & nbsp; 1 name gender age admission time 23 .. can I use the php language to write the content in the SQL table to excel based on my query results when the table people Field namesexagetime is in SQL? Just like the question about php excel through table $ ro in php
Excel template
1 Name gender age admission time

The "people" field in SQL is name/sex/age/time.

Can I use php to write the SQL table content to excel based on my query results?

The output result is similar to that in php through the table $ row [].

What do you need to learn? Are there some detailed examples?

------ Solution --------------------
Why bother. You can set the header information with the header to implement simple excel. Check the first method in the connection I sent.
------ Solution --------------------
At the top, write the csv format. jordan is actually in the csv format.

PHP code
------ Solution --------------------
That method is too troublesome and difficult to maintain.
We recommend that you use the header to implement a common method.

First, create an excel file according to the report style you want to export and save it. save it in xml 2003 format. after saving it, open it in Notepad, then, organize the data like organizing webpages.

Use the following code:
PHP code
Header ("Content-type: application/vnd. ms-excel"); header ("Content-Disposition: attachment; filename = $ filename"); echo $ excel_content;
------ Solution --------------------
1: comment out the header and output it to the page to check whether it is normal.
2: delete the html tags in the code.
------ Solution --------------------
Edit the encoding when viewing the excel file.
------ Solution --------------------

This is not difficult. the phpexcel class can help you.
Examples on the official website

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: 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.