a-z

do you never to do

博客园 首页 新随笔 联系 订阅 管理

博客中的代码高亮效果不错,喜欢好久了,终于找到了编辑器

 1 <?php
2 /**
3 * PHPExcel
4 *
5 * Copyright (C) 2006 - 2011 PHPExcel
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 * @category PHPExcel
22 * @package PHPExcel
23 * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
24 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25 * @version 1.7.6, 2011-02-27
26 */
27
28 /** Error reporting */
29 error_reporting(E_ALL);
30
31 date_default_timezone_set('Europe/London');
32
33 include "05featuredemo.inc.php";
34
35 /** PHPExcel_IOFactory */
36 require_once '../Classes/PHPExcel/IOFactory.php';
37
38
39 echo date('H:i:s') . " Write to CSV format\n";
40 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')
41 ->setDelimiter(',')
42 ->setEnclosure('')
43 ->setLineEnding("\r\n")
44 ->setSheetIndex(0)
45 ->save(str_replace('.php', '.csv', __FILE__));
46
47 echo date('H:i:s') . " Read from CSV format\n";
48 $objReader = PHPExcel_IOFactory::createReader('CSV')
49 ->setDelimiter(',')
50 ->setEnclosure('')
51 ->setLineEnding("\r\n")
52 ->setSheetIndex(0);
53 $objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__));
54
55 echo date('H:i:s') . " Write to Excel2007 format\n";
56 $objWriter2007 = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
57 $objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
58
59
60 // Echo memory peak usage
61 echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";
62
63 // Echo done
64 echo date('H:i:s') . " Done writing files.\r\n";

 

posted on 2011-09-21 14:07  a-z  阅读(277)  评论(0)    收藏  举报