Commit Graph

963 Commits

Author SHA1 Message Date
Johannes Sochor f7242e1250 fix image limit 2020-11-11 17:18:52 +01:00
Julien Aupart b86c60694c feat: Update addHtml to handle style inheritance
The aim is to get the output closer to the source html
2020-11-09 11:41:03 +01:00
Libor M f2516b08b1 migrate from abandoned `Zend\Escaper` to `Laminas Escaper` 2020-10-18 13:16:43 +02:00
Libor M 4e4282a76e refixed "must not contain any null bytes" 2020-10-18 10:56:24 +02:00
Libor M b8ffe0477b fix cs issue: "Arguments with default values must be at the end of the argument list" 2020-10-18 08:54:12 +02:00
Libor M eaf2212aa8 fix format for coverage 2020-10-18 07:45:57 +02:00
Libor M 236c7c4499 fix code format 2020-10-17 17:34:51 +02:00
Libor M bf1bb2b7ca PHP 8.0 - fixed Error: Unknown named parameter $styles 2020-10-17 17:17:46 +02:00
Libor M a36a429128 rewrite check to local file 2020-10-17 17:08:23 +02:00
Libor M 9c6cf6fdb6 PHP 8.0 fix - ValueError: file_exists(): Argument #1 ($filename) must not contain any null bytes 2020-10-17 15:56:40 +02:00
Libor M 93978211a1 PHP 8.0 - depracated libxml_disable_entity_loader, is disabled by default 2020-10-17 15:48:39 +02:00
Libor M 9dad1d20e8 PHP 7.4 - fixed invalid value in hexdec
avoid notice: "Invalid characters passed for attempted conversion, these have been ignored"
2020-10-17 14:05:52 +02:00
Libor M e334ecf059 compatibility with phpmd 2.9 2020-10-17 13:39:22 +02:00
Yannik Firre aa7c1d0fe8
FIX - When setComplexValue is not found 2020-09-22 16:28:52 +02:00
Sven Ahrens 58e0200fbd Get fallback value instead of taking the last element 2020-09-02 12:12:48 +02:00
Sven Ahrens 3a7dd774a2 Add support for mc:AlternateContent 2020-09-01 18:13:25 +02:00
csk83 9a59cf0590 format check 2020-08-31 11:56:21 +08:00
troosan ec1b3d35ee
Merge pull request #1818 from caugner/patch-1
Fixes PHPDoc @param and @return types for several Converter methods
2020-08-30 19:56:35 +02:00
csk83 d42854ddb6 chart doc/sample/code comments 2020-08-29 20:41:25 +08:00
csk83 6f1b18937c code format 2020-08-26 12:50:08 +08:00
csk83 9945240ea8
Merge pull request #1 from Stephan212/develop
Add Option for Dynamic Chart Legend Position
2020-08-25 12:16:15 +08:00
Maxim d6260988bd
Allow to redefine TCPDF object
Sometimes we need create TCPDF object with modified initial arguments.
This change allow rewrite only createExternalWriterInstance() in user defined TCPDF class.
2020-07-23 18:49:25 +03:00
lubosdz 69632b3f03 remove extra line at the end, which possibly causes CI job fail 2020-07-22 10:46:23 +02:00
lubosdz f69885e7b9 fix bug - don't decode double quotes inside double quoted string 2020-07-22 10:04:12 +02:00
lubosdz 4448bda721 Better normalization for width of borders 2020-07-14 01:31:16 +02:00
lubosdz 70ad01550b Make scrunitizer happier 2020-07-13 19:16:38 +02:00
lubosdz 38788e0c7e Code style 2020-07-13 18:48:27 +02:00
lubosdz 889f4e3381 fix converting margin to incorrect unit (points instead of twips)
fix image alignment on float - relative to inner margin instead of page margin
2020-07-11 23:03:51 +02:00
lubosdz 3066d47003 Html parser (addHtml) - support vertical-align, valign 2020-07-11 22:47:40 +02:00
lubosdz 108c1cdc55 Html parser (addHtml) - support attributes start, type in ordered list <ol> 2020-07-11 17:20:36 +02:00
lubosdz ca5f081302 Html parser (addHtml) - support horizontal rule <hr/> 2020-07-11 15:42:28 +02:00
lubosdz e180cfe456 Html parser (addHtml) - support cellspacing, bgColor 2020-07-11 00:24:08 +02:00
lubosdz 701f770ab7 Html parser (addHtml) - support width in tables & cells 2020-07-10 23:44:25 +02:00
troosan 21f4bb3053
Merge pull request #1794 from ErnestStaug/image_conversion_support
Added support for "cloudConvert" images
2020-07-07 23:18:32 +02:00
troosan 250e206b59
Merge pull request #1775 from oleibman/rtfchanges
Add support for several features for the RTF writer
2020-07-06 08:36:38 +02:00
Owen Leibman 3738a6806e Improve Word2007 Test Coverage
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.
2020-04-27 21:29:27 -07:00
Owen Leibman ba3d616282 Improve Test Coverage
Coverage for Writer/ODText is now 100%.
2020-04-23 17:25:56 -07:00
oleibman 6da3fd3c06
Correct Scrutinizer Warning
Type was declared incorrectly in comment.
2020-04-16 23:55:24 -07:00
Owen Leibman 41a5b74f93 Make Default Paper Configurable
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.
2020-04-16 23:30:27 -07:00
Matze2010 258b9a65c8 fix 2020-03-02 06:10:14 +00:00
Matze2010 ad8eeccd72 remove dead code 2020-03-02 06:00:51 +00:00
Matze2010 726c8caf54 HTML checkbox input field 2020-03-01 18:15:27 +00:00
Ernestas Staugaitis 37c15e66cd Some document have non-standard locale code 2020-02-17 11:44:27 +02:00
Ernestas Staugaitis a0e57459dc Some document have non-standard locale code 2020-02-16 22:12:34 +02:00
Owen Leibman 677e042c3a Scrutinizer Workaroun
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).
2020-02-06 20:41:40 -08:00
Owen Leibman d5149b2867 Coveralls Changes
Changes to improve test coverage based on Coveralls report.
2020-02-06 19:20:13 -08:00
Claas Augner 1dee5f33cf
docs(Converter): fix @param allowing float 2020-02-04 20:36:03 +01:00
oe.sonnh 608730531f Fix: Catastrophic Backtracking RegExp 2020-01-21 16:48:27 +07:00
oe.sonnh d965a69601 Fix: CloneBlock regexp for different regexp engine with xml line-drop 2020-01-07 13:52:13 +07:00
Owen Leibman 46c41c5ac1 More Scrutinizer Changes
Still one report that I don't understand at all, and one I'm not sure of.
2020-01-05 15:05:00 -08:00
Owen Leibman cfa29cc1c2 Applying Scrutinizer Suggestions
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.
2020-01-05 13:52:20 -08:00
Owen Leibman e24b2e1ba7 ODT Changes
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.
2020-01-05 10:27:45 -08:00
Ernestas Staugaitis fa0ba2e2ab Added support for cloud convert image inclusion 2020-01-02 00:34:30 +02:00
troosan 8b2e21b634
Merge branch 'develop' into fieldstyle 2019-12-09 22:56:08 +01:00
troosan c52c7abb65
Merge branch 'develop' into rtfchanges 2019-12-09 21:10:31 +01:00
Michaël Dupont 4852028743 fix: typo in getFootnoteProperties() method name
Was "getFootnotePropoperties()".
Former bogus spelling is still working, albeit deprecated.
2019-12-09 11:29:39 +01:00
troosan dfea4e12a6
Merge pull request #1766 from stefan-91/develop
Add support for ListItemRun in HTML writer
2019-12-08 20:38:03 +01:00
troosan 5940d18ab2
Merge pull request #1755 from oleibman/master
Improvements in RTF writer
2019-12-08 20:32:09 +01:00
troosan d9cb88e987
Merge branch 'develop' into fixes-1750-block-with-images-inside 2019-12-08 14:35:14 +01:00
owen 5e64b26451 Additional Scrutinizer Recommendations
Some more editorial changes.
2019-12-05 23:24:03 -08:00
owen 7657992a83 Scrutinizer-suggested changes
Changes to doc-blocks and code suggested by Scrutinizer.
2019-12-05 22:51:00 -08:00
Owen Leibman 30e3981ed2 Documentation Change
Changed 1 doc-block comment suggested by Scrutinizer.
2019-12-05 21:51:09 -08:00
Owen Leibman 11d82be21c Word2007 Writer - Field Style, RTL, noProof
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.
2019-12-05 21:04:12 -08:00
owen ecfafd7576 RTF Changes
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.
2019-12-03 07:46:16 -08:00
Michaël Dupont f51811b96b fix: documentation about paragraph indentation
Documentation contained the wrong unit for Paragraph indentation.
2019-12-02 16:40:58 +01:00
Aurélien Vandoorine 0945a37c61 Fixed block capture so that it would work properly with blocks to be cloned in rows 2019-12-02 08:54:45 +01:00
Bc. Štefan Kubini 1451fadc4a Add List for docx to html writer #1717 2019-11-28 23:33:10 +01:00
Aurélien Vandoorine d9ea617545 Fixes #1750 added proper block cloning to put the image size part after the #number and fixing Process call to array instead of string 2019-11-28 09:24:06 +01:00
owen ebf5cf784f Convert named constant colors to RGB in Shared/Converter.
Otherwise, colors will not be as expected for RTF and ODT.
2019-11-19 14:24:29 -08:00
Owen Leibman a10fe823b2 Errors in RTF Escaping
1. Codes meant to be in hex are specified in decimal.
   Consequently characters which don't need escaping are escaped.
2. Special handling (prepend backslash) needed for {, }, and \.
   RTF docs generated with those characters cannot be opened in Word.
3. Tab character needs to be escaped as \tab.
   RTF docs drop these characters.
While running test suite, found that Writer/RTF/ElementTest was coded
only for Unix line endings, and fails on Windows. Changed so that it
would work on either.
2019-11-16 21:37:57 -08:00
Bc. Štefan Kubini b230242127 fixed List item fail #1711 2019-11-05 10:46:24 +01:00
Michel Bardelmeijer 68118685d0 Merge branch 'master' into allowImageClosure 2019-10-21 12:33:12 +02:00
troosan 4f0d6f78ba
Merge pull request #1717 from Samuel-BF/rtf-basic-fields
Add support for basic fields in RTF writer.
2019-09-30 21:56:00 +02:00
Samuel BF 7628b41fdf Add support for basic fields in RTF writer. 2019-09-10 11:24:59 +02:00
Michel Bardelmeijer 5a68ef600b Allow a closure to be passed with image replacement tags 2019-09-09 13:49:16 +02:00
František Maša 8f4f4dcd48 Added return type 2019-09-02 18:13:10 +02:00
Stephan212 90a8900208
Stephan212 chart dynamic legend position (#2)
* Writer/Part/Chart.php Add dynamic Legend positions

The position of the legend of charts was always fixed to the right. Adding in the option to set it dynamically via a new option under styles/chart

* Update Syle/Chart.php

Add in the public functions to getStyle() to get and set the legend position
2019-08-21 10:54:43 +01:00
Stephan212 9e572ecd9b
chart - Add dynamic Legend positions (#1)
* Writer/Part/chart.php - Add dynamic Legend positions

The position of the legend of charts was always fixed to the right. Adding in the option to set it dynamically via a new option under styles/chart

* Update Styles/Chart.php

Add in the public functions to getStyle() to get and set the legend position
2019-08-21 10:18:33 +01:00
troosan 85e9144822
Merge pull request #1329 from eweso/patch-1
Adding setNumId method for ListItem style
2019-08-08 07:13:03 +02:00
troosan 815bb52ebf
Merge pull request #1628 from waltertamboer/feature/fix-issue-1529
No nested w:pPr elements in ListItemRun.
2019-08-08 07:11:05 +02:00
troosan 24d120baf1
Merge pull request #1646 from SpinyMan/develop
Change private to protected to be able extending class Html
2019-08-08 07:09:35 +02:00
troosan 487622bb9e
Merge pull request #1637 from bhattnishant/master
To support PreserveText inside sub container
2019-08-08 07:08:13 +02:00
Andrew Busel 415bdb378d
Update Html.php 2019-07-03 19:25:29 +03:00
Andrew Busel 9e93d5eae5
Update Html.php 2019-07-03 19:24:15 +03:00
Mario 9abf4473b0
Update Wrong definition 2019-07-02 16:02:52 +02:00
Nishant Bhatt b209fec72b To suport preseve text inside sub container
if we use preseve text inside table, issue fix

https://stackoverflow.com/questions/33070424/phpword-cannot-add-preservetext-in-section
2019-06-03 15:44:10 +02:00
Walter Tamboer 18b3c754ef No nested w:pPr elements in ListItemRun.
This commit fixes issue #1529

This commit prevents nested w:pPr elements when using a ListItemRun with
a paragraph style. The different between a ListItem and a ListItem run
is that the setWithoutPPR method is called on the ParagraphStyleWriter
(PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph).

According to the specs it's not allowed to have nested w:pPr elements.
See http://www.datypic.com/sc/ooxml/e-w_pPr-2.html
2019-05-09 15:29:25 +02:00
arthur 2045e52db7 call static instead of self on protected method 2019-04-09 10:55:43 +02:00
troosan 1534dc23c3
Merge pull request #1595 from NickCoolii/patch-1
Added new constant to russian language
2019-03-31 20:48:10 +02:00
troosan 8cea3221dc
remove trailing spaces 2019-03-31 13:20:51 +02:00
Seamus Lee 607378b8fb Ensure that entity_loader disable variable is re-set back to the original setting
Simplify the setting of libxml_disable_entity_loader
2019-03-31 08:31:49 +11:00
Mykola Nicholas 014ff7d261
Added new constant to russian language 2019-03-13 16:39:32 +03:00
Maxim 8931ab12b2
Merge branch 'develop' into html_writer_auto_invert_text_color 2019-03-01 16:33:50 +02:00
Nick Winfield 81a1b2acff TrackChange doesn't handle all return types of \DateTime::createFromFormat(...) (#1584)
* Added boolean check before setting the date
2019-02-24 00:24:49 +01:00
troosan 9958a4825f allow other streams 2019-02-22 22:06:54 +01:00
troosan b3982ebb70 fix documentation 2019-02-22 22:06:30 +01:00
troosan 3219950d59 trim color codes and add tests 2019-02-06 22:07:42 +01:00
troosan 5206c7f690 fix parsing of border-color and add test 2019-02-06 18:19:01 +01:00
troosan e3020c0db3 fix warnings 2019-02-05 23:05:18 +01:00
troosan 235cc1205c implement support for section vAlign 2019-02-05 21:42:14 +01:00