Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Work item 2541 - Table Cell Borders Not Displaying Correctly

git-svn-id: https://phppowerpoint.svn.codeplex.com/svn/trunk@51982 ffd33b8c-2492-42e0-bdc5-587b920b7d6d
  • Loading branch information...
commit a5013edf774b9876d51386915cb82e1e54a7364d 1 parent 7ff04ff
@maartenba maartenba authored
View
3  Classes/PHPPowerPoint/Style/Border.php
@@ -55,7 +55,7 @@ class PHPPowerPoint_Style_Border implements PHPPowerPoint_IComparable
const DASH_SYSDASHDOT = 'sysDashDot';
const DASH_SYSDASHDOTDOT = 'sysDashDotDot';
const DASH_SYSDOT = 'sysDot';
-
+
/**
* Line width
*
@@ -191,6 +191,7 @@ public function setColor(PHPPowerPoint_Style_Color $color = null) {
public function getHashCode() {
return md5(
$this->_lineStyle
+ . $this->_lineWidth
. $this->_dashStyle
. $this->_color->getHashCode()
. __CLASS__
View
48 Classes/PHPPowerPoint/Writer/PowerPoint2007/Slide.php
@@ -505,6 +505,9 @@ private function _writeTable(PHPPowerPoint_Shared_XMLWriter $objWriter = null, P
// Colspan / rowspan containers
$colSpan = array();
$rowSpan = array();
+
+ // Default border style
+ $defaultBorder = new PHPPowerPoint_Style_Border();
// Write rows
for ($row = 0; $row < count($shape->getRows()); $row++)
@@ -518,7 +521,21 @@ private function _writeTable(PHPPowerPoint_Shared_XMLWriter $objWriter = null, P
{
// Current cell
$currentCell = $shape->getRow($row)->getCell($cell);
-
+
+ // Next cell right
+ $nextCellRight = null;
+ try {
+ $nextCellRight = $shape->getRow($row)->getCell($cell + 1);
+ } catch (Exception $ex) {
+ }
+
+ // Next cell below
+ $nextCellBelow = null;
+ try {
+ $nextCellBelow = $shape->getRow($row + 1)->getCell($cell);
+ } catch (Exception $ex) {
+ }
+
// a:tc
$objWriter->startElement('a:tc');
// Colspan
@@ -577,8 +594,35 @@ private function _writeTable(PHPPowerPoint_Shared_XMLWriter $objWriter = null, P
$objWriter->writeAttribute('anchor', $horizontalAlign);
}
+
+
+
// Borders
- $this->_writeBorders($objWriter, $currentCell->getBorders());
+ // - Left
+ $this->_writeBorder($objWriter, $currentCell->getBorders()->getLeft(), 'L');
+
+ // - Right
+ $tempCell = $currentCell;
+ if (!is_null($nextCellRight) && $nextCellRight->getBorders()->getRight()->getHashCode() != $defaultBorder->getHashCode())
+ {
+ $tempCell = $nextCellRight;
+ }
+ $this->_writeBorder($objWriter, $tempCell->getBorders()->getRight(), 'R');
+
+ // - Top
+ $this->_writeBorder($objWriter, $currentCell->getBorders()->getTop(), 'T');
+
+ // - Bottom
+ $tempCell = $currentCell;
+ if (!is_null($nextCellBelow) && $nextCellBelow->getBorders()->getBottom()->getHashCode() != $defaultBorder->getHashCode())
+ {
+ $tempCell = $nextCellBelow;
+ }
+ $this->_writeBorder($objWriter, $tempCell->getBorders()->getBottom(), 'B');
+
+ // - Diagonals
+ $this->_writeBorder($objWriter, $currentCell->getBorders()->getDiagonalDown(), 'TlToBr');
+ $this->_writeBorder($objWriter, $currentCell->getBorders()->getDiagonalUp(), 'BlToTr');
// Fill
$this->_writeFill($objWriter, $currentCell->getFill());
View
1  changelog.txt
@@ -37,6 +37,7 @@ To be planned:
- Bugfix: (MB) Work item 3910 - Table width setting Office 2007
- Bugfix: (MB) Work item 4598 - Bullet characters in Master Slide Layouts of template file become corrupted
- Bugfix: (MB) Work item 3424 - Generated files cannot be opened in Office 08 for Mac OSX
+- Bugfix: (MB) Work item 2541 - Table Cell Borders Not Displaying Correctly
Initial version:
Please sign in to comment.
Something went wrong with that request. Please try again.