export php to xlsx

Upload: jusnadi-husain

Post on 05-Jul-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/16/2019 Export PHP to xlsx

    1/3

  • 8/16/2019 Export PHP to xlsx

    2/3

    /** Error reporti%g */

    errorAreporti%g(EA4++)#

    //&teA&e!$ltAti'eBo%eAset(E$rope/+o%&o%)#

    &teA&e!$ltAti'eBo%eAset(Etc/7TD)#

    /** PHPExcel */

    reF$ireAo%ce PHPExcel2/Clsses/PHPExcelphp#

    // Crete %e" PHPExcel obGect

    obGPHPExcel I %e" PHPExcel()#

    // et properties

    /*obGPHPExcel-JgetProperties()-JsetCretor(K7rte% 8lli$"K)

     -Jset+st7o&iLe&8y(K7rte%

    8lli$"K)

     -JsetTitle(K3Mce 200N O+O Test

    @oc$'e%tK)

     -Jset$bGect(K3Mce 200N O+O Test

    @oc$'e%tK)

     -Jset@escriptio%(KTest &oc$'e%t !or

    3Mce 200N O+O ge%erte& $si%g PHP clssesK)

     -Jsetey"or&s(KoMce 200N ope%x'l

    phpK)

     -JsetCtegory(KTest res$lt LleK)#

    */

     // 4&& so'e &t

    obGPHPExcel-Jset4cti.eheet%&ex(0)

      -JsetCelll$e(41 Hello)

      -JsetCelll$e(82 "orl&Q)

      -JsetCelll$e(C1 Hello)

      -JsetCelll$e(@2 "orl&Q)#

  • 8/16/2019 Export PHP to xlsx

    3/3

    // 7iscell%eo$s glyphs T,-

    obGPHPExcel-Jset4cti.eheet%&ex(0)

      -JsetCelll$e(4R 7iscell%eo$s glyphs)

      -JsetCelll$e(49 SUVWXYZ[\]^_`a^)#

    // e%'e sheet

    obGPHPExcel-Jget4cti.eheet()-JsetTitle(i'ple)#

    // et cti.e sheet i%&ex to the Lrst sheet so Excel ope%s this s the Lrst sheet

    obGPHPExcel-Jset4cti.eheet%&ex(0)#

    // e&irect o$tp$t to clie%ts "eb bro"ser (Excel200N)

    he&er(Co%te%t-Type= pplictio%/.%&ope%x'l!or'ts-oMce&oc$'e%tspre&sheet'lsheet)#

    he&er(Co%te%t-@ispositio%= ttch'e%t#Lle%'eIK01si'plexlsxK)#

    he&er(Cche-Co%trol= 'x-geI0)#

    obGriter I PHPExcelA3,ctory==creteriter(obGPHPExcel Excel200N)#

    obGriter-Js.e(php=//o$tp$t)#

    exit#