Skip to content

Commit 69a42b0

Browse files
author
ling
committed
Add support for the firstLineChars style in Word2007.
1 parent 8392134 commit 69a42b0

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/PhpWord/Style/Indentation.php

+30
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class Indentation extends AbstractStyle
4646
*/
4747
private $firstLine = 0;
4848

49+
/**
50+
* Additional first line chars indentation (twip).
51+
*
52+
* @var float|int
53+
*/
54+
private $firstLineChars = 0;
55+
4956
/**
5057
* Indentation removed from first line (twip).
5158
*
@@ -135,6 +142,29 @@ public function setFirstLine($value)
135142
return $this;
136143
}
137144

145+
/**
146+
* Get first line chars.
147+
*
148+
* @return float|int
149+
*/
150+
public function getFirstLineChars()
151+
{
152+
return $this->firstLineChars;
153+
}
154+
155+
/**
156+
* Set first line chars.
157+
*
158+
* @param float|int $value
159+
*
160+
* @return $this
161+
*/
162+
public function setFirstLineChars($value)
163+
{
164+
$this->firstLineChars = $this->setNumericVal($value, $this->firstLineChars);
165+
return $this;
166+
}
167+
138168
/**
139169
* Get hanging.
140170
*

src/PhpWord/Writer/Word2007/Style/Indentation.php

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function write(): void
4343
$firstLine = $style->getFirstLine();
4444
$xmlWriter->writeAttributeIf(null !== $firstLine, 'w:firstLine', $this->convertTwip($firstLine));
4545

46+
$firstLineChars = $style->getFirstLineChars();
47+
$xmlWriter->writeAttributeIf(null !== $firstLineChars, 'w:firstLineChars', $this->convertTwip($firstLineChars));
48+
4649
$hanging = $style->getHanging();
4750
$xmlWriter->writeAttributeIf(null !== $hanging, 'w:hanging', $this->convertTwip($hanging));
4851

0 commit comments

Comments
 (0)