From 07e03fc955ca39bb96647e8365c99d7ad73dd926 Mon Sep 17 00:00:00 2001
From: Philipp Scheit
Date: Tue, 15 Jul 2014 10:24:36 +0200
Subject: [PATCH] bugfix: specific borders were not written correctly in
word2007
---
CHANGELOG.md | 1 +
src/PhpWord/Writer/Word2007/Style/MarginBorder.php | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44bf46db..4cb0a086 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ This release added form fields (textinput, checkbox, and dropdown), drawing shap
- Page breaks on titles and tables - @ivanlanin GH-274
- Table inside vertical border does not rendered properly - @ivanlanin GH-280
- `add` of container should be case insensitive, e.g. `addToc` should be accepted, not only `addTOC` - @ivanlanin GH-294
+- Fix specific borders (and margins) were not written correctly in word2007 writer
### Deprecated
diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php
index fec987d3..ace1e1ac 100644
--- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php
+++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php
@@ -59,8 +59,8 @@ class MarginBorder extends AbstractStyle
$sides = array('top', 'left', 'right', 'bottom', 'insideH', 'insideV');
$sizeCount = count($this->sizes);
- for ($i = 0; $i < $sizeCount; $i++) {
- if ($this->sizes[$i] !== null) {
+ foreach ($this->sizes as $i => $size) {
+ if ($size !== null) {
$color = null;
if (isset($this->colors[$i])) {
$color = $this->colors[$i];