douhuiyan2772 2016-04-05 17:25
浏览 187

PHPExcel图表包含导入文件的输出已损坏

I'm a biologist and try to handle a ton of data from FlowCytometry then handling it with Excel. I have exported my files in csv then I tried to put them in a pre created Excel file with php. I figured out when I read and write exactly the same Excel file with PHPExcel PHP extension it doesn't handles my charts the output file is corrupt, and Excel prompting to fix and fixes it without the charts.

I simplified my files without any new input and produces the same results, can you help me to fix this?

My simplified code:

/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
ini_set('max_execution_time', '-1');
ini_set('memory_limit', '512M');
date_default_timezone_set('Europe/London');

define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');

/** Include PHPExcel */
require_once dirname(__FILE__) . '/../PHPExcel/Classes/PHPExcel.php';

$txtOutputExcelName = "Histogram.xlsx";

// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object from import" , EOL;

// Sample File Name that is going to be cloned
$inputFileName = './sample/Analysis_sample.xlsx';

$objPHPExcel = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load($inputFileName);

// Save Excel 2007 file
echo date('H:i:s') , " Write to Excel2007 format" , EOL;

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save($txtOutputExcelName);

My simplified Excel file is here: https://dl.dropboxusercontent.com/u/4860217/Analysis_sample.xlsx

Thank you for your help, Zoltan

  • Mac OS X 10.11.4
  • PHP version 7.0.0
  • PHPExcel 1.8.1
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向