Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ v0.16.0 (xx dec 2018)
- Fix loading of Sharepoint document @Garrcomm #1498
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
- Fix parsing of Office 365 documents @Timanx #1485
- For RTF writers, sizes should should never have decimals @Samuel-BF #1536

v0.15.0 (14 Jul 2018)
----------------------
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Writer/RTF/Style/Border.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private function writeSide($side, $width, $color = '')

$content .= '\pgbrdr' . substr($side, 0, 1);
$content .= '\brdrs'; // Single-thickness border; @todo Get other type of border
$content .= '\brdrw' . $width; // Width
$content .= '\brdrw' . round($width); // Width
$content .= '\brdrcf' . $colorIndex; // Color
$content .= '\brsp480'; // Space in twips between borders and the paragraph (24pt, following OOXML)
$content .= ' ';
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Writer/RTF/Style/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function write()
$content .= '\f' . $this->nameIndex;

$size = $style->getSize();
$content .= $this->getValueIf(is_numeric($size), '\fs' . ($size * 2));
$content .= $this->getValueIf(is_numeric($size), '\fs' . round($size * 2));

$content .= $this->getValueIf($style->isBold(), '\b');
$content .= $this->getValueIf($style->isItalic(), '\i');
Expand Down
6 changes: 3 additions & 3 deletions src/PhpWord/Writer/RTF/Style/Indentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function write()
return '';
}

$content = '\fi' . $style->getFirstLine();
$content .= '\li' . $style->getLeft();
$content .= '\ri' . $style->getRight();
$content = '\fi' . round($style->getFirstLine());
$content .= '\li' . round($style->getLeft());
$content .= '\ri' . round($style->getRight());

return $content . ' ';
}
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Writer/RTF/Style/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function write()
$content .= $alignments[$style->getAlignment()];
}
$content .= $this->writeIndentation($style->getIndentation());
$content .= $this->getValueIf($spaceBefore !== null, '\sb' . $spaceBefore);
$content .= $this->getValueIf($spaceAfter !== null, '\sa' . $spaceAfter);
$content .= $this->getValueIf($spaceBefore !== null, '\sb' . round($spaceBefore));
$content .= $this->getValueIf($spaceAfter !== null, '\sa' . round($spaceAfter));

$styles = $style->getStyleValues();
$content .= $this->writeTabs($styles['tabs']);
Expand Down
14 changes: 7 additions & 7 deletions src/PhpWord/Writer/RTF/Style/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public function write()
$content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . round($style->getPageSizeW()));
$content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . round($style->getPageSizeH()));
$content .= ' ';
$content .= $this->getValueIf($style->getMarginTop() !== null, '\margtsxn' . $style->getMarginTop());
$content .= $this->getValueIf($style->getMarginRight() !== null, '\margrsxn' . $style->getMarginRight());
$content .= $this->getValueIf($style->getMarginBottom() !== null, '\margbsxn' . $style->getMarginBottom());
$content .= $this->getValueIf($style->getMarginLeft() !== null, '\marglsxn' . $style->getMarginLeft());
$content .= $this->getValueIf($style->getHeaderHeight() !== null, '\headery' . $style->getHeaderHeight());
$content .= $this->getValueIf($style->getFooterHeight() !== null, '\footery' . $style->getFooterHeight());
$content .= $this->getValueIf($style->getGutter() !== null, '\guttersxn' . $style->getGutter());
$content .= $this->getValueIf($style->getMarginTop() !== null, '\margtsxn' . round($style->getMarginTop()));
$content .= $this->getValueIf($style->getMarginRight() !== null, '\margrsxn' . round($style->getMarginRight()));
$content .= $this->getValueIf($style->getMarginBottom() !== null, '\margbsxn' . round($style->getMarginBottom()));
$content .= $this->getValueIf($style->getMarginLeft() !== null, '\marglsxn' . round($style->getMarginLeft()));
$content .= $this->getValueIf($style->getHeaderHeight() !== null, '\headery' . round($style->getHeaderHeight()));
$content .= $this->getValueIf($style->getFooterHeight() !== null, '\footery' . round($style->getFooterHeight()));
$content .= $this->getValueIf($style->getGutter() !== null, '\guttersxn' . round($style->getGutter()));
$content .= ' ';

// Borders
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Writer/RTF/Style/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function write()
if (isset($tabs[$style->getType()])) {
$content .= $tabs[$style->getType()];
}
$content .= '\tx' . $style->getPosition();
$content .= '\tx' . round($style->getPosition());

return $content;
}
Expand Down