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

Respect indents from readed file #2570

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tugmaks
Copy link

@tugmaks tugmaks commented Feb 13, 2024

Description

If you try to save docx file immediately after reading it, paragraph indent units will be multiplied by 720.
It's all because of

public function setStyleValue($key, $value)
{
$key = Text::removeUnderscorePrefix($key);
if ('indent' == $key || 'hanging' == $key) {
$value = $value * 720; // 720 twips is 0.5 inch
}
return parent::setStyleValue($key, $value);
}

Also current implementation only reads left indent but not right

This PR fixes this bug by forcing to read all w:ind params. Tests also provided.

Fixes #507

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes

@coveralls
Copy link

Coverage Status

coverage: 97.211% (-0.006%) from 97.217%
when pulling a6894dd on tugmaks:read-indents
into 8b891bb on PHPOffice:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Paragraph Indent Units
2 participants