Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add support for the firstLineChars style in Word2007. #2667

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions src/PhpWord/Style/Indentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class Indentation extends AbstractStyle
*/
private $firstLine = 0;

/**
* Additional first line chars indentation (twip).
*
* @var float|int
*/
private $firstLineChars = 0;

/**
* Indentation removed from first line (twip).
*
Expand Down Expand Up @@ -135,6 +142,29 @@ public function setFirstLine($value)
return $this;
}

/**
* Get first line chars.
*
* @return float|int
*/
public function getFirstLineChars()
{
return $this->firstLineChars;
}

/**
* Set first line chars.
*
* @param float|int $value
*
* @return $this
*/
public function setFirstLineChars($value)
{
$this->firstLineChars = $this->setNumericVal($value, $this->firstLineChars);
return $this;
}

/**
* Get hanging.
*
Expand Down
3 changes: 3 additions & 0 deletions src/PhpWord/Writer/Word2007/Style/Indentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function write(): void
$firstLine = $style->getFirstLine();
$xmlWriter->writeAttributeIf(null !== $firstLine, 'w:firstLine', $this->convertTwip($firstLine));

$firstLineChars = $style->getFirstLineChars();
$xmlWriter->writeAttributeIf(null !== $firstLineChars, 'w:firstLineChars', $this->convertTwip($firstLineChars));

$hanging = $style->getHanging();
$xmlWriter->writeAttributeIf(null !== $hanging, 'w:hanging', $this->convertTwip($hanging));

Expand Down
Loading