PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 31, 2022

[FIXED] how do you add a named range to worksheet using php pear spreadsheet excel writer

 August 31, 2022     excel, pear, php     No comments   

Issue

Is it posible using Excel_spreadsheet_writer to create a name such as

$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

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

$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.

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


Solution

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.



Answered By - cypher
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,209,907

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing