如何使用php pear spreadsheet excel writer向工作表添加命名范围

时间:2021-10-16 20:41:08

Is it posible using Excel_spreadsheet_writer to create a name such as

是否可以使用Excel_spreadsheet_writer来创建名称,如

$workbook  = new Spreadsheet_Excel_Writer();
$worksheet = &$workbook->addWorksheet('CheckNames');

$worksheet->writeName(0, 0, 'AnswerToEverythig', '42');

$worksheet->write(0, 1, 'Double =');

$worksheet->writeFormula(0, 2, '=AnswerToEverythig * 2');

$workbook->send('CheckNames.xls');
$workbook->close();

and dispay 84 in cell C1

并且在单元格C1中显示84

As recommended by cypher I've tried PHPExcel but now get Internal Server Error on the following

正如cypher所推荐的,我尝试过PHPExcel但现在得到的内部服务器错误如下

$prices_sheet->setCellValueByColumnAndRow(4, $row, '=IF(Round_Up=0,  (C'.$row.'+D'.$row.'),  0.01  )');

changing the formula to

将公式更改为

'=IF(0=0,  (C'.$row.'+D'.$row.'),  0.01  )'

stops the error.

停止错误。

Therefore PHPExcel has problems resolving formulas using named ranges.

因此,PHPExcel在使用命名范围解析公式时遇到问题。

Found This http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=209472

发现这个http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=209472

1 个解决方案

#1


2  

I'm not sure how about SpreadSheetExcelWriter, but it certainly can be done with PHPExcel. I've been using PHPExcel for a long time and I can only recommend it.

我不确定如何使用SpreadSheetExcelWriter,但它确实可以用PHPExcel完成。我已经使用PHPExcel很长一段时间了,我只能推荐它。

#1


2  

I'm not sure how about SpreadSheetExcelWriter, but it certainly can be done with PHPExcel. I've been using PHPExcel for a long time and I can only recommend it.

我不确定如何使用SpreadSheetExcelWriter,但它确实可以用PHPExcel完成。我已经使用PHPExcel很长一段时间了,我只能推荐它。