Home » File Formats » Spreadsheet_Excel_Writer » Bug #266
setmerge
Details
| Submitted | 2003-11-18 03:45 UTC |
|---|---|
| From | russ at snowcompanies dot com |
| Assigned | xnoguer |
| Status | No Feedback |
| Package | Spreadsheet_Excel_Writer |
| PHP Version | 4.3.3 |
| OS | red hat |
| Roadmaps | (Not assigned) |
Comments
[2003-11-18 03:45 UTC] russ at snowcompanies dot com
Description:
------------
I have tried several ways to get cells to merge. My last attempt was taken the code that is posted in example 23-3. The output is what I expected except that there are no merged cells.
Reproduce code:
---------------
require_once 'Spreadsheet/Excel/Writer.php';
// We give the path to our file here
//$workbook = new Spreadsheet_Excel_Writer('./test/test.xls');
$workbook = new Spreadsheet_Excel_Writer();
$format_title =& $workbook->addFormat();
$format_title->setMerge();
$worksheet =& $workbook->addWorksheet();
$worksheet->write(0, 0, "", $format_title);
$worksheet->write(0, 1, "", $format_title);
$worksheet->write(0, 2, "", $format_title);
$worksheet->write(1, 0, "Quarter", $format_bold);
$worksheet->write(1, 1, "Profit", $format_bold);
$worksheet->write(2, 0, "Q1");
$worksheet->write(2, 1, 0);
$worksheet->write(3, 0, "Q2");
$worksheet->write(3, 1, 0);
$workbook->send('test.xls');
$workbook->close();
[2003-12-16 21:33 UTC] xnoguer at php dot net
Can you try the latest code from cvs?
I added a new Worksheet::setMerge() method, but it will only work for BIFF8. You will have to do:
$workbook->setVersion(8); // this is just a temporary method
$worksheet =& $workbook->addWorksheet();
$worksheet->setMerge(0, 0, 0, 1); // merging just 2 cells
It wont be a real fix until BIFF8 becomes the default though.