Commit Graph

67 Commits

Author SHA1 Message Date
troosan 1956908aa7 Merge remote-tracking branch
'geraldb-nicat/PHPWord/templateProcessingViaArray' into develop

Conflicts:
	docs/templates-processing.rst
2019-01-03 18:57:00 +01:00
troosan 23407c99dd Add unit tests 2018-12-29 22:03:01 +01:00
troosan 5057617de7 change regex instead of checking twice 2018-12-29 14:56:11 +01:00
Antonio Malatesta 7c8cfb7b8a Adding condition for document template saving using libreoffice
When  I save document template with libreoffice (in .docx format) the cloneRow with nested table doesn't work.
The problem is that the regular expression, that used for search if row is no longer part of the spanned row, was wrong: 
<w:vMerge w:val="continue" /> became <w:vMerge w:val="continue"/> without space at the closure tag.
Sorry for my English.
2018-12-29 14:50:30 +01:00
troosan a4b532083b
Merge pull request #1162 from abcdmitry/patch-2
Break the references in foreach within TemplateProcessor
2018-12-27 22:22:20 +01:00
troosan 7790b6a6b0 Pass values to replace macros with in cloneBlock 2018-12-27 22:13:48 +01:00
troosan 75620caf51 add parameter to keep backward compatibility + add test 2018-12-27 01:44:37 +01:00
troosan 1bcef04ddc Merge remote-tracking branch 'JPBetley/PHPWord/clone-block-variables' into rebase_pull_request 2018-12-27 01:29:51 +01:00
troosan 575c5531b8 replace self with static 2018-12-26 20:07:53 +01:00
troosan 6cf10b4562
Merge pull request #1161 from abcdmitry/patch-1
Get rid of duplicated code in TemplateProcessor
call static methods with static:: instead of self::
2018-12-26 20:04:18 +01:00
Maxim d5da80b56e Support adding images in Templates (#1170)
* setImageValue() + fix adding files via ZipArchive
* fix phpdoc variable name
* Changed logic that determines extension image file extension for document to depend on MIME type. This same logic is used in Element/Image.php
* support <w:t> tags with arguments
* allow setup size of image into template variable
* support of 'ratio' replace attribute + documentation
2018-12-26 14:35:21 +01:00
troosan b188ab94e1
Merge branch 'develop' into add-getVariableCount-method 2018-12-11 21:31:18 +01:00
Yurii.sio2 260bb75fc2 Fix TemplateProcessor :: fixBrokenMacros; (#1502)
* Fix TemplateProcessor :: fixBrokenMacros;
* add unit test for fixBrokenMacros
2018-12-07 23:22:04 +01:00
troosan 7b3b723646
Merge pull request #1430 from nicoder/patch-4
allow to override TemplateProcessor#ensureUtf8Encoded
2018-12-03 01:01:51 +01:00
troosan c12f98f69a fix check style warning 2018-11-20 22:40:54 +01:00
troosan 925e9e0919
remove trailing spaces 2018-11-16 23:33:38 +01:00
troosan c51b6febc0
rename variable to comply with rules 2018-11-16 23:00:23 +01:00
Martin Hanzl e19de8e8a4 #1253 - add explanatory comment 2018-10-11 11:28:44 +02:00
Martin Hanzl 7f55816eba detect actual filename of document xml (prevent mismatching document22.xml as in #1253) 2018-10-11 08:55:38 +02:00
troosan aa49536e3e
Merge branch 'develop' into add-getVariableCount-method 2018-07-21 14:48:24 +02:00
troosan affccc7937 Merge branch 'improve-cloneBlock-regex' of https://github.com/nicoder/PHPWord into fix_clone_block 2018-07-17 08:03:35 +02:00
Nicolas Dermine 198165ce59
allow to override TemplateProcessor#ensureUtf8Encoded
the method is `protected`,
but since it is called with `self` instead of `static`
it does not allow for subclasses to override it
2018-07-16 19:49:30 +02:00
troosan 536a1b89d7 disable entity loader 2018-07-14 00:50:01 +02:00
troosan 77f2b16bc1 update copyright to 2018 2018-03-08 23:52:25 +01:00
Frank Liepert d061c6dc7c Remove zend-stdlib dependency 2018-02-17 00:03:41 +01:00
Nicolas Dermine 623bd993d8 refactor: use extracted method in original method 2018-02-05 17:49:23 +01:00
Nicolas Dermine 07e97c38cd add `getVariableCount` method to `TemplateProcessor`
returns how many times each placeholder is present in the document

almost the same code as `getVariables`

useful when cloning a block a number of times and want to replace
placeholders that are present more than once in the block
(using the `$limit` parameter of `setValue`)
2018-02-05 17:45:24 +01:00
Nicolas Dermine 4105a9aad1 improve `cloneBlock` regex
it wrongly matched `<w:pPr` when looking for `<w:p`

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word

adding the `\b` word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

```
ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2
```

This might solve issues such as #681 and #664.
2018-02-02 17:03:49 +01:00
Nicolas Dermine 30183e2881
fix typo in comment 2018-01-26 18:31:35 +01:00
troosan 0459670a9c
Enable php-cs-fixer in build & fix resulting warnings (#1099)
* enable php 7.1 build
* upgrade to dompdf/dompdf 0.8.*
* update phpunit & hide output during tests
* run code coverage analysis on 1 build only
* Add php-cs
* Update Copyright
2017-11-04 22:44:12 +01:00
Dmitry Lukashin 7792eb2769 Break the references in foreach within TemplateProcessor 2017-10-19 19:02:26 +03:00
Dmitry Lukashin ba9e8958d7 Replace self:: with static:: calls 2017-10-19 18:51:57 +03:00
Dmitry Lukashin f7cb73e8a6 Get rid of duplicated code in TemplateProcessor.php 2017-10-19 17:33:46 +03:00
troosan 8ce1a19ec4 make FontStyle basedOn paragraph if the paragraph is set on the font (#926)
* make FontStyle based on paragraph if it set
* replace tab with spaces
* basedOn not correctly set if FontStyle is based on other FontStyle
* Fix warnings
2017-09-17 21:38:00 +02:00
Roman Syroeshko 2bcfacfbf9 Updated copyright. 2016-07-31 12:35:08 +04:00
Roman Syroeshko 54013a6164 https://github.com/PHPOffice/PHPWord/issues/399. 2016-07-30 22:32:32 +04:00
Roman Syroeshko fb863cdf21 https://github.com/PHPOffice/PHPWord/issues/335. 2016-07-30 16:02:23 +04:00
Phil Betley b011e6f157 5.3 array syntax 2016-06-16 08:54:24 -04:00
Phil Betley f51422ad8d add variable indexing for block cloning
Use the same functionality from cloneRow to index variables inside
cloned block sections
2016-06-15 14:46:07 -04:00
Roman Syroeshko ec3c62b051 #483. Output escaping for OOXML. 2016-06-04 20:06:37 +04:00
Roman Syroeshko d57973693d #618. 2016-04-23 19:49:10 +04:00
Roman Syroeshko 1c5bb3a911 #548. 2016-04-09 22:03:21 +04:00
Roman Syroeshko f359825cb7 Reviewed and merged #658. 2016-01-23 19:16:34 +04:00
Roman Syroeshko 529edcb68e Merge pull request #617 from kazitanvirahsan/develop
Template processor setValue() improvements #614
2015-12-12 21:01:31 +04:00
Roman Syroeshko 43fb23d896 Copyright update. 2015-12-05 21:26:01 +04:00
Gerald Buttinger bcfb3e868c Add methods setValuesFromArray and cloneRowFromArray to the TemplateProcessor-class and update samples and docs accordingly 2015-11-27 14:30:22 +01:00
kazi Tanvir Ahsan b446a23b61 Update 2 Template processor setValue() improvements #614 2015-09-10 23:50:23 +10:00
kazi Tanvir Ahsan 873d41a872 Update Template processor setValue() improvements #614 2015-09-10 23:46:48 +10:00
kazi Tanvir Ahsan a123ce41e5 Template processor setValue() improvements #614 2015-09-10 23:33:02 +10:00
Roman Syroeshko 3d78ee70b7 Merged #513. 2015-08-30 18:15:16 +04:00