PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.16k stars 2.68k forks source link

FIX: StrikeThrough property in word2007 #2604

Open noec764 opened 3 months ago

noec764 commented 3 months ago

I had a problem with strike through in Word2007. If a strikethrough style was added to a text element it never appeared in the resulting document. Indeed, the XML generated was as follows

<w:r>
    <w:rPr>
        <w:strike w:val="1"/>
        <w:dstrike w:val="0"/>
     </w:rPr>
     <w:t xml:space="preserve">some text</w:t>
</w:r>

The statement <w:dstrike w:val="0"/> should not be present here I figure out that the test $style->isDoubleStrikethrough() !== null is true if $style->isDoubleStrikethrough() === false So as a text cannot be strike and doublestrike at the same time, word2007 ignores it.

coveralls commented 2 months ago

Coverage Status

coverage: 97.217%. remained the same when pulling bde34d3cb1bcc58d847bb69725a390915de14fde on noec764:FIX_StrikeThrough_property_Word2007 into 8b891bb6842dd383f679b47898fad0b7c181f325 on PHPOffice:master.