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

Paragraph Indent Units #507

Open
jelofson opened this issue Mar 19, 2015 · 3 comments · May be fixed by #2570
Open

Paragraph Indent Units #507

jelofson opened this issue Mar 19, 2015 · 3 comments · May be fixed by #2570

Comments

@jelofson
Copy link

jelofson commented Mar 19, 2015

Hello,
I am confused about the paragraph style indent units. The docs say that the defaults measurement units are twips, which is fine, but when adding an indent value to a paragaraph style, they are not in twips. The value set is multiplied by 720. So, if I enter a value of 4, it comes out as 2880 twips, or 2 inches (5.08 cm). Why not just use twips? Then one could use the converters.

$value = $value * 720;

$phpWord->addTitleStyle(1, [
    'size'=>22,
    'color'=>'194775',
    'bold'=>true,
    'name'=>'Cambria',
    'allCaps'=>true
], [
    'align'=>'right',
    'indent'=>4 // 2880 twips = confusion
]);

Comments?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@aoloe
Copy link
Contributor

aoloe commented Sep 1, 2016

looks even weirder here... is it using half inches?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 18, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
@drps
Copy link

drps commented May 31, 2023

i can confirm the issue.

Sample code without any changes made by custom code, only read and write operations (you need to specify paragraph's indent in sample docx file)

$phpWord = \PhpOffice\PhpWord\IOFactory::load($tempFile);
$phpWord->save('sample.docx', 'Word2007', true);
  • will read indents from tempFile (they are already in twips)
  • will multiply it by 720
  • will save them as multipliedBy720

@tugmaks tugmaks linked a pull request Feb 13, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants