Bug #19444 [Opn]: format (border) for multicolumn cells

From: Date: Fri, 01 Jun 2012 15:30:37 +0000
Subject: Bug #19444 [Opn]: format (border) for multicolumn cells
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8697@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19444&edit=1 ID: 19444 Updated by: srottt@post.cz Reported By: srottt at post dot cz Summary: format (border) for multicolumn cells Status: Open Type: Bug Package: Spreadsheet_Excel_Writer Operating System: Linux/Ubuntu Package Version: 0.9.3 PHP Version: 5.3.2 Roadmap Versions: New Comment: Although the code doesn't seem to be right/correct, it seems the following methods do the trick: class .... extends Spreadsheet_Excel_Writer_Worksheet { public function writeMergedCell($row1,$col1,$row2,$col2, $token, $format=null) { //to display full border if($col1!=$col2) //for multicolumns, right border not visible $this->write($row1,$col2,"",$format);//top-Right (one extra cell is enough) if($row1!=$row2) //for multirows, bottom border not visible $this->write($row2,$col1,"",$format);//Bottom-left //also tried with only bottom-right cell, but didn't work //create multi cell $this->setMerge($row1, $col1, $row2, $col2); //write content $this->write($row1,$col1, $token, $format); } //different arguments might be more convenient for some people public function writeMultiCell($row, $col, $height, $width, $token, $format=null){ $this->writeMergedCell($row, $col, $row+$height-1, $col+$width-1, $token, $format); } } Previous Comments: ------------------------------------------------------------------------ [2012-05-30 13:32:44] stropho Description: ------------ The border for multi-cell is not displayed properly. Using Worksheet::mergeCells instead Worksheet::setMerge doesn't help. Test script: --------------- $f=& $workbook->addFormat(array("border"=>1)); $row=0; //multicolumn $worksheet->setMerge($row,1,$row,4); $worksheet->write($row, 1, 'abc', $f); $row+=2; //switch the commands if it matters (but it doesnt) $worksheet->write($row, 1, 'abc', $f); $worksheet->setMerge($row,1,$row,4); $row+=2; //multirow $ws->setMerge($row,1,$row+1,1); $ws->write($row, 1, 'xyz',$f); $row+=2; //switch commands $ws->write($row, 1, 'xyz',$f); $ws->setMerge($row,1,$row+1,1); Expected result: ---------------- 4 cells(2 multi columns, 2 multi rows) with full borders (left, right, top, bottom) Actual result: -------------- Multi column cell - right border missing Multi row cell - bottom border missing cell 2x2 (4cells) - bottom and right border missing ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19444&edit=1

« previous php.pear.bugs (#8697) next »