Cloned Object Behavior
| From: | catch12 at holotech dot net | Date: | Sun, 02 Jan 2011 11:52:11 +0000 |
| Subject: | Cloned Object Behavior | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-30891@lists.php.net to get a copy of this message | ||
If I clone a format object in Spreadsheet_Excel_Writer, then modify
the properties of the clone, those are not reflected in the final
output. Example (I've snipped irrelevant properties from the print_r()
output)
// Bold format
$format_bold =& $workbook->addFormat();
$format_bold->setBold();
// Bold + Underline format
$format_bold_ul = clone $format_bold;
$format_bold_ul->setUnderline(1);
print_r($format_bold);
Spreadsheet_Excel_Writer_Format Object
(
[_bold] => 700
[_underline] => 0
)
print_r($format_bold_ul);
Spreadsheet_Excel_Writer_Format Object
(
[_bold] => 700
[_underline] => 1
)
As you can see, the underline property has been set in the clone, but
does not appear in the output. Is this normal behavior, a peculiarity
of cloned objects, or a bug in Spreadsheet_Excel_Writer?
--
Alan Little
Holotech Enterprises