After this change, Writer/Word2007 is 100% covered.
One source change is required. Writer/Word2007/Style/AbstractStyle
has incorrectly searched Measurement Array using
in_array (which searches values) rather than array_key_exists (keys).
There was no test for this, and now there is.
3 changes in tests/PhpWord/_includes are borrowed from "ODT Changes"
(pull request 1796, not yet merged)
and "Fix PHPUnit Tests" (pull request 1771,
merged after work on this change was started).
Writer/Word2007/ElementTest was becoming too unwieldy. Tests for
Chart and FormFields were moved to their own members.
Each section currently has a hard-coded default paper of A4.
It would make sense to allow the user to set this default,
and specify it in a configuration file, just as is done
with default font name and size.
Attempt to work around demonstrably incorrect Scrutinizer analysis
(flags code as bug because "condition is always false"
even though Coveralls reports that code which would be
executed only if condition is true is indeed executed).
I do not understand one suggestion, and I believe one is wrong.
I will add comments to my ticket once this is pushed.
One that I can discuss up front
PhpWord/Style/Paragraph indicates that Indentation must be of type
\PhpOffice\PhpWord\Style\Indentation, but it can also be null.
My test for instanceof ... is one of the Scrutinizer reports.
I did not change PhpWord/Style/Paragraph, but this commit does so
by updating @var for indentation.
Implement a number of features implemented in PhpWord,
but not yet supported in PhpWord ODT Writer.
1. Add default file to tests/PhpWord/_includes/XmlDocument.php to make it
considerably easier to test ODT changes (and Word2007 changes involving
files other that document.xml).
2. Page break before each section.
3. Page numbering start.
4. Font style for Headings.
5. Alignment for images.
6. Paragraph style for TextRun.
7. "Hide grammatical errors" for whole document.
8. Page layout for each section.
9. For each page layout, support user-specified page width, page height,
orientation, margin top, margin bottom, margin left, margin right.
10. Page header and footer.
11. Named colors.
12. NoProof font style.
13. Paragraph Style - spaceBefore, spaceAfter, lineHeight, pageBreakBefore,
indentation, text alignment.
14. Tab stops.
15. Basic support for some Fields (DATE, PAGE, NUMPAGES).
16. Link had an error in how it was handling internal links (needs leading #).
17. In addition to tests for all the above, added some tests for Tables.
Item 11 above needs 1 module from Pull Request 1775, which is targeted
for v0.18.0 but not yet merged, so the relevant module is also here.
Item 15 above needs 1 module from Pull Request 1774, which is targeted
for v0.18.0 but not yet merged, so the relevant module is also here.
Testing change from Pull Request 1771 is included here, but was
merged after my fork.
\Symfony\Component\Process\Process refuses being passed a string
with version > 5, which is installed with PHP > 7.2.5.
It also refuses being passed an array with version < 3.3, which is
installed with PHP < 5.5.9.
Solved by checking if Process::fromShellCommandLine() exists, which
was introduced in version 4.2.0.
1. Add support for font styles for fields, and write those to Word docs.
2. Word seems to require explicit inline w:rtl tag even when rtl is specified
in a named style. Without this tag, words are placed in ltr order.
Allow PhpWord doc to specify rtl in named style and have it
display correctly in resulting doc.
3. A recent change incorrectly changed how noProof tag was generated,
omitting the third parameter of 4 parameters in the call. There was
no test case for this change. The call is now corrected, and a
test case has been added.
1. Converter is currently expecting colors as strings of hex digits,
but PhpWord allows specification of colors by named constant, so
result is random when one of those is used. This change handles
all the named colors.
2. Table needs \pard at end; formatting may be wrong without it.
3. RTF writer will no longer ignore paragraph style for TextRun.
4. RTF writer will no longer ignore paragraph and font style for Title.
5. Add support for RTF headers and footers.
6. Add support for right-to-left in font.
7. Add support for PageBreakBefore and LineHeight for paragraphs.
8. Add support for PageNumberingStart for sections.
There are test cases for all of these changes.