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

我是一名生物学家,他尝试处理来自FlowCytometry的大量数据,然后用Excel处理它。 我已经在csv中导出了我的文件,然后我尝试将它们放入预先创建的带有php的Excel文件中。 我想通过PHPExcel PHP扩展读取和写入完全相同的Excel文件,它不会处理我的图表输出文件已损坏,并且Excel提示修复并修复它而没有图表。</ p>

我在没有任何新输入的情况下简化了我的文件并产生了相同的结果,你能帮我解决这个问题吗?</ p>

我的简化代码:</ p>

  / **错误报告* / 
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:'&lt; br /&gt;' );

/ **包含PHPExcel * /
require_once目录名(__ FILE__)。 '/../PHPExcel/Classes/PHPExcel.php';
nnnxtxtOutputExcelName =“Histogram.xlsx”;

//创建新的PHPExcel对象
echo日期('H:i:s'), “从导入创建新的PHPExcel对象”,EOL;

//将要克隆的示例文件名
$ inputFileName ='./sample/Analysis_sample.xlsx';
nnobjPHPExcel = new PHPExcel ();
$ objReader = PHPExcel_IOFactory :: createReader('Excel2007');
$ objReader-&gt; setIncludeCharts(TRUE);
$ objPHPExcel = $ objReader-&gt; load($ inputFileName);

//保存Excel 2007文件
echo日期('H:i:s'),“写入Excel2007格式”,EOL;

$ objWriter = PHPExcel_IOFactory :: createWriter($ objPHPExcel,'Excel2007');
$ objWriter-&gt; setIncludeCharts(TRUE);
$ objWriter-&gt; save($ txtOutputExcelName);
</ code> </ pre>

我的简化Excel文件位于: https://dl.dropboxusercontent.com/u/4860217/Analysis_sample.xlsx </ p >

感谢您的帮助,
Zoltan </ p>


  • Mac OS X 10.11.4 </ li>
  • PHP版本7.0.0 </ li>
  • PHPExcel 1.8.1 </ li>
    </ ul>
    </ div>

展开原文

原文

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问