Export files using Phpexcel

Source: Internet
Author: User
Tags save file

Steps and parsing for exporting files using Phpexcel:

Create a new Excel table: Instantiate the Phpexcel class

Create a sheet (built-in table): Createsheet () method to create a new sheet method

The Setactivesheetindex method is to set sheet as the current active table

Getactivesheet method to get the active object of the current sheet

Fill Data Setcellvalue () method

Save File Phpexcel_iofactory::createwrite () method

Save () method

New document.php File

Find the path where the current script file is located $dir =dirname (__file__);

Introduce file require $dir. " Phpexcel/phpexcel.php "; In a sibling directory

Instantiate the Phpexcel class $objPHPExcel =new phpexcel (); is equivalent to creating a new Excel table on the desktop

Gets the current active sheet setting Name: $objSheet = $objPHPSheet->getactivesheet ();

Sets the name $objSheet->settitle ("name") for the current active sheet.

Fills the current activity sheet data $objSheet->setcellvalue ("A1", "name")->setcellvalue ("", ""); the cell location where the data is populated

Or the form of an array:

$array =array (

Array (),

Array ("", ""),

);

Generates Excel files in the specified format phpexcel_iofactory::createwriter ($objPHPExcel, "Excel20007");

Export files using Phpexcel

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.