-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add support for various missing features in HTML Writer #1814
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
Conversation
Implement a number of features implemented in PhpWord, but not yet supported in PhpWord HTML Writer. 1. Use css @page and page declarations for sections. 2. Wrap sections in div, with page break before each (except first). 3. Add ability to specify generic fallback font for html (documentation change). 4. Add ability to specify handling of whitespace in html (documentation change). Currently, Word writer preserves space but HTML writer does not. 5. Support for Language, both for document overall and individual text elements. 6. Support for PageBreak for HTML (currently only PDF is supported). 7. Support for Table Border style, color, and size. 8. Support for empty paragraphs (Word writer permits, browsers generally suppress). 9. Default paragraph style should apply to all paragraphs, as well as class Normal. 10. Paragraph style should support line-height. 11. Paragraph style should support indentation. 12. Paragraph style should support page-break-before. 13. Paragraph style should not specify margin-top/bottom when spacing is null. Testing change from Pull Request 1771 is included here, but was merged after my fork.
Mostly docblock changes, specifying that members can be null if so.
Hopefully this clears 3 remaining issues.
Reaction to Coveralls report.
I had been overriding some "false positive" Scrutinizer messages with annotations. Seeing if an alternate approach also works.
New issue after removing annotations.
Zend/Escaper is no longer maintained. However, everything that it does can be handled perfectly well by htmlspecialchars. This change removes the dependency on it, and changes code which used it. Also add additional tests. Coverage of Writer/HTML is now 100%
Scrutinizer reported a problem because Title->getText() was annotated to return a string, but it can actually return either a string or a TextTun.
Change one statement in Writer/HMTL/Title
See issue #1993. The code currently defines the same method twice; this edit fixes that.
This member was NOT part of my change, yet Travis failed my PR because of use of spaces on a blank line. Even though this is easy to correct, it seems very unreasonable (failing PR because of unchanged member).
There is quite a bunch of valuable stuff in that PR but as it is huge it is hard to review. Could you perhaps split this into multiple smaller PRs? It would be a pity if this PR would rot |
It would be a lot of work to separate things. I would sort of like some assurance from the maintainer that the current state is a problem before I undertook it. That being said, I think I might be able to split it in 3 (PR is over a year old, so details aren't exactly fresh in my mind):
I realize you can't tell from this description how much would be left to review for each part. Neither can I ("not exactly fresh") without further study. Nevertheless, do you think what I describe above might be sufficient for your purposes? |
I perfectly understand that this would be a lot of effort. I am not in the position to give any assurance so I fear we have to wait for some reaction |
That's indeed one big PR, with various fixes/improvements/features. I'll try to review this for the next minor release |
Thanks. |
Is this PR being to nbe implemented? |
@oleibman Thank your for your contribution. Could you rebase your PR ? |
@Progi1984 I am not quite as conversant with git/github as I should be. The fact that there are now a number of merge conflicts, and that the main branch has changed from develop to master, make me a little uneasy doing anything to this PR. Would the following steps accomplish what you want instead?
If that looks like an okay plan, I can probably have something for you within a week. If it's not an okay plan, please tell me how to proceed instead. |
I have completed a dry run where I applied my changes to the master version, and edited them according to the new standards (square brackets rather than array function for example - thank you @Progi1984 and @PowerKiKi, I can tell how painful a job that must have been just from my need to do it in a small number of members, but it was definitely time to do it). I am glad to report that I was able to get successful results for both the existing and the new unit tests. I want to do some more testing, but I can probably start working on a new PR in earnest in a day or two. One question for now. I use the "check" script defined in composer.json for the project, and that failed because it invokes phpcs, which is not required by composer.json. I manually added it for my testing. Is it okay to proceed with that as a dev requirement, or should the check script be changed? |
This PR supersedes PHPOffice#1814, which had become badly out of sync due to recent changes to the repository. Implement a number of features implemented in PhpWord, but not yet supported in PhpWord HTML Writer. 1. Use css @page and page declarations for sections. 2. Wrap sections in div, with page break before each (except first). 3. Add ability to specify generic fallback font for html (documentation change). 4. Add ability to specify handling of whitespace in html (documentation change). Currently, Word writer preserves space but HTML writer does not. 5. Support for Language, both for document overall and individual text elements. 6. Support for PageBreak for HTML (currently only PDF is supported). 7. Support for Table Border style, color, and size. 8. Support for empty paragraphs (Word writer permits, browsers generally suppress). 9. Default paragraph style should apply to all paragraphs, as well as class Normal. 10. Paragraph style should support line-height. 11. Paragraph style should support indentation. 12. Paragraph style should support page-break-before. 13. Paragraph style should not specify margin-top/bottom when spacing is null.
@Progi1984 Rebased version is now available as PR #2343. I was, as I feared, unable to make a second fork, so I just deleted my fork, which caused this ticket to be closed, which I was planning to do anyhow. |
This PR supersedes PHPOffice#1814 and PHPOffice#2343, which had become badly out of sync due to recent changes to the repository. Implement a number of features implemented in PhpWord, but not yet supported in PhpWord HTML Writer. 1. Use css @page and page declarations for sections. 2. Wrap sections in div, with page break before each (except first). 3. Add ability to specify generic fallback font for html (documentation change). 4. Add ability to specify handling of whitespace in html (documentation change). Currently, Word writer preserves space but HTML writer does not. 5. Support for Language, both for document overall and individual text elements. 6. Support for PageBreak for HTML (currently only PDF is supported). 7. Support for Table Border style, color, and size. 8. Support for empty paragraphs (Word writer permits, browsers generally suppress). 9. Default paragraph style should apply to all paragraphs, as well as class Normal. 10. Paragraph style should support line-height. 11. Paragraph style should support indentation. 12. Paragraph style should support page-break-before. 13. Paragraph style should not specify margin-top/bottom when spacing is null.
This PR supersedes PHPOffice#1814 and PHPOffice#2343, which had become badly out of sync due to recent changes to the repository. Implement a number of features implemented in PhpWord, but not yet supported in PhpWord HTML Writer. 1. Use css @page and page declarations for sections. 2. Wrap sections in div, with page break before each (except first). 3. Add ability to specify generic fallback font for html (documentation change). 4. Add ability to specify handling of whitespace in html (documentation change). Currently, Word writer preserves space but HTML writer does not. 5. Support for Language, both for document overall and individual text elements. 6. Support for PageBreak for HTML (currently only PDF is supported). 7. Support for Table Border style, color, and size. 8. Support for empty paragraphs (Word writer permits, browsers generally suppress). 9. Default paragraph style should apply to all paragraphs, as well as class Normal. 10. Paragraph style should support line-height. 11. Paragraph style should support indentation. 12. Paragraph style should support page-break-before. 13. Paragraph style should not specify margin-top/bottom when spacing is null.
Description
Implement a number of features implemented in PhpWord,
but not yet supported in PhpWord HTML Writer.
Testing change from Pull Request 1771 is included here, but was
merged after my fork.
Fixes # (issue)
Checklist:
composer run-script check --timeout=0
and no errors were reported