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

Strikethrough not working in v0.16.0 #1693

Closed
fyrefli7 opened this issue Aug 16, 2019 · 5 comments · Fixed by #2661
Closed

Strikethrough not working in v0.16.0 #1693

fyrefli7 opened this issue Aug 16, 2019 · 5 comments · Fixed by #2661

Comments

@fyrefli7
Copy link

fyrefli7 commented Aug 16, 2019

Describe the Bug

Strikethrough is no longer working in version 0.16.0, it is working in version 0.15.0

Steps to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText('Hello World!', array('strikethrough' => true));

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('/tmp/test.docx');

Expected Behavior

In the above example 'Hello World!' should have the strikethrough formatting applied.

Using "composer require phpoffice/phpword" to install the PHPWord results in strikethrough not being applied. However using "composer require phpoffice/phpword:0.15.0" to install the PHPWord does apply strikethrough.

Context

Ubuntu: 19.04
PHP Version: 7.2.19
LibreOffice: 6.2.5.2

@montypanday
Copy link

Can you please share more details. I could not replicate this issue in v0.16.0.

@liborm85
Copy link
Contributor

liborm85 commented Jan 2, 2021

Tested with version 0.17.0 and works correctly.

@NigelRel3
Copy link

NigelRel3 commented May 6, 2021

Through a question on Stackoverflow, I managed to reproduce this with

Ubuntu: 20.04
PHPOffice/PHPWord 0.18.1
LibreOffice: 6.4.7.2

After messing about with the block (in the document.xml)...

		<w:r>
			<w:rPr>
				<w:strike w:val="1" />
				<w:dstrike w:val="0" />
			</w:rPr>
			<w:t xml:space="preserve">Hello World!</w:t>
		</w:r>

I found that if you remove the <w:dstrike w:val="0" /> element, the display works OK in LibreOffice, I don't have access woth Microsoft Office to be able to check that.

@shumiv
Copy link

shumiv commented May 6, 2021

I got the same problem. Solved it by downgrading to 0.15.0

@pvy
Copy link

pvy commented Jun 10, 2021

maybe the function PhpWord/Style/AbstractStyle:: setPairedVal() should set the second value to null and not false

mussbach added a commit to mussbach/PHPWord that referenced this issue Aug 18, 2021
As stated in PHPOffice#1722 and PHPOffice#1693 `setPairedVal` sets DoubleStrikethrough to
false which does not equal `null`
This change may somehow infer with 54e7c6d but as no tests could be
found it is hard to say what would possibly break
@Progi1984 Progi1984 added this to the 1.3.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants