Skip to content

Commit ddb1c59

Browse files
authored
Update Tab.php
Implement all Tab features.
1 parent 0ab0b49 commit ddb1c59

File tree

1 file changed

+13
-1
lines changed
  • src/PhpWord/Writer/RTF/Style

1 file changed

+13
-1
lines changed

src/PhpWord/Writer/RTF/Style/Tab.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,24 @@ public function write()
3838
\PhpOffice\PhpWord\Style\Tab::TAB_STOP_RIGHT => '\tqr',
3939
\PhpOffice\PhpWord\Style\Tab::TAB_STOP_CENTER => '\tqc',
4040
\PhpOffice\PhpWord\Style\Tab::TAB_STOP_DECIMAL => '\tqdec',
41+
\PhpOffice\PhpWord\Style\Tab::TAB_LEADER_DOT => '\tldot',
42+
\PhpOffice\PhpWord\Style\Tab::TAB_LEADER_HYPHEN => '\tlhyph',
43+
\PhpOffice\PhpWord\Style\Tab::TAB_LEADER_UNDERSCORE => '\tlul',
44+
\PhpOffice\PhpWord\Style\Tab::TAB_LEADER_HEAVY => '\tlth',
45+
\PhpOffice\PhpWord\Style\Tab::TAB_LEADER_MIDDLEDOT => '\tlmdot',
4146
];
4247
$content = '';
4348
if (isset($tabs[$style->getType()])) {
4449
$content .= $tabs[$style->getType()];
4550
}
46-
$content .= '\tx' . round($style->getPosition());
51+
if (isset($tabs[$style->getLeader()])) {
52+
$content .= $tabs[$style->getLeader()];
53+
}
54+
if ($style->getType() == \PhpOffice\PhpWord\Style\Tab::TAB_STOP_BAR) {
55+
$content .= '\tb' . round($style->getPosition());
56+
} else {
57+
$content .= '\tx' . round($style->getPosition());
58+
}
4759

4860
return $content;
4961
}

0 commit comments

Comments
 (0)