20readexcel5.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (C) 2006 - 2008 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 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.6.1, 2008-04-28
  26. */
  27. /** Error reporting */
  28. error_reporting(E_ALL);
  29. /* Modified by Bertrand Zuchuat */
  30. require_once 'symfony.inc.php';
  31. /** PHPExcel_Writer_Exce5 */
  32. require 'PHPExcel/Reader/Excel5.php';
  33. include 'PHPExcel/Writer/Excel2007.php';
  34. $file_path = dirname(__FILE__) . '/14excel5.xls';
  35. if (!file_exists($file_path)) {
  36. exit("Please run 14excel5.php first.\n");
  37. }
  38. echo date('H:i:s') . " Load from Excel5 file\n";
  39. $objReader = new PHPExcel_Reader_Excel5;
  40. $objPHPExcel = $objReader->load($file_path);
  41. echo date('H:i:s') . " Write to Excel2007 format\n";
  42. $objWriter = new PHPExcel_Writer_Excel2007 ($objPHPExcel);
  43. $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
  44. // Echo memory peak usage
  45. echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";
  46. // Echo done
  47. echo date('H:i:s') . " Done reading file.\r\n";