Compare commits

...

1579 Commits

Author SHA1 Message Date
Ahmad Syamim
08064480ea
Update recipes.rst (#2367) 2023-01-08 09:39:08 +01:00
Erik Hazington
aac3a601e1
Add support for fractional font sizes (#2363)
* Add support for fractional font sizes

Word supports fractional font sizes like 8.5pt, but PHPWord doesn't.

* Add background color support for textboxes

* Add background color support for text boxes for Word writer

* Added period to the comments to match the cs-fixer configuration

* Fixed cs-fixer issues.

* Added type hints and matching PHPDoc. Also added @return void.

* Added bgcolor unit test coverage

* Removed @return void as not compatible with projects coding standard.

* Fixed several CS-Fixer issues

* Replaced deprecated "assertRegExp" test method by assertMatchesRegularExpression.

* Address the CI coverage issue for the regex match assertion.

* Add support for fractional font sizes

Word supports fractional font sizes like 8.5pt, but PHPWord doesn't.

* The default font size method now supports int and float font sizes. Added type hinting to settings class and unit test coverage for fractional (float) font size.

* The default font size method now supports int and float font sizes. Added type hinting to settings class and unit test coverage for fractional (float) font size.

Co-authored-by: hazington <hazington@eweso.de>
Co-authored-by: Progi1984 <progi1984@gmail.com>
2023-01-06 21:04:39 +01:00
Yohann Tilotti
ef99fac8e1
Add support table row height when importing HTML (#2350)
* Add support table row height when importing HTML

* fix space

* fix phpcsfixer

* Add test table row height

* Fix xpath test table row height

* Fix attribute first test table row height

* Fix $cValue

Co-authored-by: Progi1984 <progi1984@gmail.com>

* Fix css

* Fix test on pt

Co-authored-by: Progi1984 <progi1984@gmail.com>
2023-01-06 16:26:34 +01:00
Progi1984
60734dd7f1
Merge pull request #2277 from amir9480/patch-1
Add softhyphen support to Word2007 Reader
2023-01-05 22:04:27 +01:00
Progi1984
ed8d9ff420
Fixed some stylelint 2023-01-05 21:53:50 +01:00
Progi1984
a379577ac9
Merge pull request #2364 from hazington/patch-5
Add background color support for text box element for Word writer
2023-01-04 09:23:26 +01:00
hazington
53d34fd049 Address the CI coverage issue for the regex match assertion. 2023-01-04 00:07:39 +01:00
hazington
679a738c42 Replaced deprecated "assertRegExp" test method by assertMatchesRegularExpression. 2023-01-03 23:56:04 +01:00
hazington
0f6fbf2b11 Fixed several CS-Fixer issues 2023-01-03 23:44:51 +01:00
hazington
050802bdb5 Removed @return void as not compatible with projects coding standard. 2023-01-03 23:38:08 +01:00
hazington
a215501cc9 Added bgcolor unit test coverage 2023-01-03 23:35:37 +01:00
hazington
1a80aacb4f Added type hints and matching PHPDoc. Also added @return void. 2023-01-03 23:26:02 +01:00
Erik Hazington
40d5770651
Fixed cs-fixer issues. 2022-12-30 21:50:28 +01:00
Erik Hazington
143e01b29b
Added period to the comments to match the cs-fixer configuration 2022-12-30 21:46:44 +01:00
Erik Hazington
25575c80ca
Add background color support for text boxes for Word writer 2022-12-30 21:34:47 +01:00
Erik Hazington
1dc3dc6ce5
Add background color support for textboxes 2022-12-30 21:32:48 +01:00
Progi1984
b453cf00ff
Merge pull request #2261 from ismail1432/customize-macro
Allow to customize macro delimiters in TemplateProcessor
2022-12-23 19:36:07 +01:00
Progi1984
f195d282d0
Merge pull request #2111 from brammeleman/patch-1
Fixed code example
2022-11-29 22:04:08 +01:00
Progi1984
b2dfa65698
Merge pull request #1848 from rikvdlooi/patch-1
Fixed setting width of Cell Style
2022-11-29 21:46:07 +01:00
Progi1984
be499388da
Merge pull request #2336 from kernusr/read-empty-vmerge
Word2007 : Read empty vmerge
2022-11-29 21:40:09 +01:00
Adrien Crivelli
20f3a3e370
Use pcov instead of xdebug because it is much faster 2022-11-29 11:09:02 +01:00
Adrien Crivelli
803cdee4f3
Use local install of friendsofphp/php-cs-fixer
Otherwise, `composer check` and `composer fix` are broken and contributing
becomes much harder than it should be. Also using the same version
everywhere is a benefit to get consistent result locally and on CI.
2022-11-29 10:50:45 +01:00
Progi1984
25de4b819c Fixed PHPCSFixer error 2022-11-23 20:36:39 +00:00
Progi1984
6041bb3fb5
Merge pull request #2339 from Progi1984/className
HTML Reader : Set style name from the CSS class (and if not CSS is loaded)
2022-11-23 13:47:30 +01:00
Progi1984
249e049894
Merge pull request #2171 from amgad-naiem/patch-1
Added Swedish language
2022-11-23 13:44:11 +01:00
Progi1984
9658c12084
Merge pull request #2308 from fbclol/develop
Call static instead of self on protected method
2022-11-23 13:41:37 +01:00
Progi1984
83f6b020b3
Merge pull request #2329 from nicoder/improve-phpdoc
improve TemplateProcessor#setValueForPart parameter phpdoc
2022-11-23 13:34:28 +01:00
Progi1984
d721b5eda7 HTML Reader : Set style name from the CSS class (and if not CSS is loaded) 2022-11-23 13:32:03 +01:00
Progi1984
02e3aa96b6
Merge pull request #2338 from Progi1984/className
HTML Reader : Set style name from the CSS class
2022-11-22 21:53:53 +01:00
Progi1984
02a92c8924 HTML Reader : Set style name from the CSS class 2022-11-22 21:38:41 +01:00
Artem Vasilev
b457ff5f7f set default value for vMerge 2022-11-22 13:45:55 +03:00
Artem Vasilev
573f1c3ea1 set default value on empty value attribute 2022-11-22 13:43:03 +03:00
Nicolas Dermine
0189977743 improve phpdoc
The `tempDocumentHeaders` and `tempDocumentFooters` array attributes are
passed to this method parameter
2022-11-20 07:56:42 +01:00
Franck Boué
9afd53d622
remove - 2022-11-18 13:44:35 +01:00
Franck Boué
a075740e32
remove espaces 2022-11-18 13:38:18 +01:00
Franck Boué
ecd2fcbda8
add blank lines 2022-11-18 13:34:21 +01:00
Franck Boué
9ed82d1f5a
delete blank lines 2022-11-18 13:31:04 +01:00
Progi1984
0af4ca1f6e
Merge pull request #2327 from Progi1984/htmlReaderExtractCssStyle
HTML Reader : Add basic support for CSS Style Tag
2022-11-18 10:42:04 +01:00
Progi1984
228bada972
Remove stale Github Actions 2022-11-18 10:37:07 +01:00
Adrien Crivelli
6deea59905
Update GitHub Actions 2022-11-17 14:39:30 +01:00
Adrien Crivelli
95ce998651
Drop obsolete coverall references
Instead, we've been using Scrutinizer for a while
2022-11-17 09:53:27 +01:00
Adrien Crivelli
c37be288a5
Consume half of the 1000 operations per hour limit of GitHub API 2022-11-17 09:45:21 +01:00
Adrien Crivelli
28ca75eca4
Close oldest stale issues first 2022-11-16 22:55:44 +01:00
Adrien Crivelli
0b9f30fc77
Remove all traces of Travis 2022-11-16 22:35:01 +01:00
Adrien Crivelli
d2c6b9f790
master is the new default branch
`master` is now the only permanent branch. Features and fixes should be merged
into `master` when stable. Pull requests should be forked from `master`.

`develop` branch disappear entirely in favor of temporary features/fixes branches.
2022-11-16 22:27:10 +01:00
Adrien Crivelli
a771de75b9
Keep things as private as possible 2022-11-16 22:02:21 +01:00
Progi1984
ab3a2c0418 HTML Reader : Add basic support for CSS Style Tag 2022-11-16 22:02:07 +01:00
Adrien Crivelli
14c6e6f370
Merge pull request #2104 from simivar/feature/delete-row
Introduce deleteRow() method for TemplateProcessor
2022-11-16 21:58:25 +01:00
Adrien Crivelli
8521612b39
1.0.0 2022-11-15 21:24:50 +01:00
simivar
f482f2600b CS Fixer 2022-11-07 22:38:19 +01:00
Krystian Marcisz
46e61d4c18 Apply suggestions from code review
Co-authored-by: Progi1984 <progi1984@gmail.com>
2022-11-06 19:19:25 +01:00
Krystian Marcisz
4b7e7e4612 Update src/PhpWord/TemplateProcessor.php
Co-authored-by: Progi1984 <progi1984@gmail.com>
2022-11-06 19:19:25 +01:00
Krystian Marcisz
9a6eb6970d Update src/PhpWord/TemplateProcessor.php
Co-authored-by: Progi1984 <progi1984@gmail.com>
2022-11-06 19:19:25 +01:00
simivar
91504dfddc Introduce deleteRow() method for TemplateProcessor 2022-11-06 19:19:23 +01:00
Adrien Crivelli
fab9966b8c
Code style 2022-10-24 11:25:54 +02:00
Adrien Crivelli
e81520f94c
Document PHP 7.1 support
Fixes #2302
2022-10-24 11:08:15 +02:00
Franck
024fdf9c1a call static instead of self on protected method 2022-10-07 16:04:39 +02:00
Smaine Milianni
c4bcba9741 allow to customize macro in TemplateProcessor 2022-09-30 11:51:05 +01:00
Progi1984
f92ec7e3ad
Merge pull request #2302 from Progi1984/php7.1+
Support for PHP7.1 (min.)
2022-09-26 08:52:37 +02:00
Progi1984
c3e34a0d24 Support for PHP7.1 (min.) 2022-09-25 22:15:11 +02:00
Progi1984
c467fe02d3
Merge pull request #2301 from Progi1984/htmlTableStyleAttribute
HTML Reader : Override inline style on HTML attribute for table
2022-09-25 21:34:08 +02:00
Progi1984
f8d0b2ad87 HTML Reader : Override inline style on HTML attribute for table 2022-09-25 21:18:39 +02:00
Adrien Crivelli
02ccca1551
Configure actions/stale 2022-09-20 11:50:08 +02:00
Manunchik
f80f660457
Add PhpOffice\PhpWord\Cell\IOFactory::createWriter unit test 2022-09-20 11:12:53 +02:00
Adrien Crivelli
2b7b4ddc5f
Revert "Add destructor wich will try to clean up temp file of the template"
This reverts commit e9cd17d4c7bc0ab4df09e858284369dbf7a98fff. Because
the temp file is the result of the `save()` method and it's up to the calling
code to handle the result appropriately. Or alternatively use `saveAs()` to
avoid handling it.
2022-09-20 11:05:16 +02:00
Adrien Crivelli
99d4b29471
Use PSR autoloading 2022-09-20 10:05:08 +02:00
Adrien Crivelli
62444d2161
Merge pull request #2176 from maartendekeizer/cleanuptempfile
[TemplateProcessor] Clean up temp files
2022-09-17 23:21:07 +02:00
Adrien Crivelli
969448ff12
Merge pull request #2177 from tvbeek/patch-1
Update homepage in composer.json
2022-09-17 23:20:16 +02:00
Adrien Crivelli
b9f1151bc6
Drop most deprecations 2022-09-16 16:29:15 +02:00
Adrien Crivelli
c5e7a535e6
Fix phpmd violation 2022-09-16 14:24:22 +02:00
Adrien Crivelli
a49618f248
Don't hardcode version number in documentation 2022-09-16 14:23:58 +02:00
Adrien Crivelli
d59591b7ab
Automatic code style 2022-09-16 14:14:57 +02:00
Adrien Crivelli
5b5de9e514
symfony/process is only a dep for dev 2022-09-16 14:11:55 +02:00
Adrien Crivelli
c8d360e095
Use PSR autoload mechanism for tests 2022-09-16 14:09:17 +02:00
Adrien Crivelli
2bc75771cc
Use same code style as PhpSpreadsheet 2022-09-16 11:45:45 +02:00
Adrien Crivelli
25c56a3e2d
Update all PHP dependencies
This way we can share the same dependencies across PHP 7.4 to PHP 8.1,
and simplify our CI pipeline
2022-09-16 11:27:29 +02:00
Adrien Crivelli
207438270f
Drop implicit code coverage
Because not all PHP installs have code coverage enabled, and that makes
testing more difficult, and slower than necessary. Instead, use local config
if you need to always have code coverage.
2022-09-16 10:19:51 +02:00
Adrien Crivelli
0e8bcb63e7
Drop PHP 7.3 and older
This is according to our formal, published, policy to only support
eol PHP after 6 months within PHPOffice organisation.

See https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support
2022-09-16 10:17:31 +02:00
Adrien Crivelli
2ee6df65bc
Merge pull request #2272 from seamuslee001/php81_locale
PHP8.1 Fix issue with passing NULL value for locale into string function
2022-09-16 00:16:31 +02:00
Adrien Crivelli
82769b9736
Merge pull request #2209 from RismaSystems/PHP8.1-fixes
PHP 8.1 compatability fix for PreserveText and XMLWriter
2022-09-16 00:14:09 +02:00
Adrien Crivelli
93e16d4001
Merge pull request #2292 from neopheus/php8.1-fix-2290
Php 8.1 fix #2290
2022-09-16 00:12:45 +02:00
Adrien Crivelli
f853b9f125
Tolerate small imprecisions 2022-09-15 21:43:36 +02:00
Adrien Crivelli
ecee8339c3
Don't use teamcity format in CI
It's much harder to read for human
2022-09-15 19:10:04 +02:00
Adrien Crivelli
301e481fbe
loadConfig returns config that was actually applied 2022-09-15 19:07:28 +02:00
Adrien Crivelli
54415c113b
Fix code style 2022-09-15 17:55:24 +02:00
Adrien Crivelli
26532b5f3f
Test PHP 8.1 2022-09-15 17:45:46 +02:00
Progi1984
7df75b2efe
Merge pull request #2294 from Progi1984/htmlTableBorder
HTML Reader : Use `border` attribute for tables
2022-09-14 18:16:34 +02:00
Progi1984
62584900b5
Merge pull request #2239 from cscrewsandcaptains/develop
PHP 8.1 Support for addPreserveText
2022-09-14 18:12:50 +02:00
Progi1984
a4cdcd6250 HTML Reader : Use border attribute for tables 2022-09-14 17:50:54 +02:00
neopheus
fa84160f7f str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated" 2022-09-12 13:59:21 +02:00
neopheus
077175efbe Fix : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
2022-09-12 13:48:13 +02:00
neopheus
83b0bef3a8 Fix #2290 2022-09-12 12:56:45 +02:00
Progi1984
a006aa8780
Merge pull request #2289 from Progi1984/htmlBlockPageBreak
HTML Reader : Style page-break-after in paragraph
2022-09-07 21:14:10 +02:00
Progi1984
2de551647b HTML Reader : Style page-break-after in paragraph 2022-09-06 22:05:33 +02:00
amir
26757c29bb
Add softhyphen support to word reader 2022-08-12 14:38:49 +04:00
Seamus Lee
2f93873a7c PHP8.1 Fix issue with passing NULL value for locale into string function 2022-07-30 07:28:01 +00:00
Progi1984
4dc34d43d8
Merge pull request #2266 from Progi1984/htmlBlockHeadingInTextRun
HTML Reader : Heading in Text Run is not allowed
2022-07-25 22:07:06 +02:00
Progi1984
945cbd9b93 HTML Reader : Heading in Text Run is not allowed 2022-07-20 14:04:04 +02:00
Christian Stein
91416e48ac
XMLWriter ReturnTypeWillChange fix
add  #[\ReturnTypeWillChange] Attribute to the function writeAttribute (php 8.1 deprecate warning)
2022-06-08 14:22:51 +02:00
Christian Stein
fc18246b20
PreserveText preg_split fix
third parameter must be -1 not null (php 8.1 deprecate warning)
2022-06-08 14:14:25 +02:00
Michael Als
6b331603e6 Added return type will change to XMLWriter.php 2022-03-30 12:42:45 +00:00
Michael Als
2bba013311 PHP 8.1 compatability fix for PreserveText 2022-03-29 13:13:45 +00:00
Adrien Crivelli
be0190cd5d
0.18.3 2022-02-17 16:40:03 +01:00
Adrien Crivelli
3bcd4b5370
PHP 8.1 compatibility 2022-02-17 16:37:24 +01:00
Adrien Crivelli
01d87e17fb
Merge pull request #2193 from garethellis36/2187-php8.1-deprecation
#2187 Addresses deprecation on PHP 8.1 in ZipArchi
2022-02-17 16:35:57 +01:00
Gareth Ellis
c57c292915 #2187 Addresses deprecation on PHP 8.1 in ZipArchi 2022-02-08 12:40:06 +00:00
Tobias van Beek
e159b723bd
Update homepage in composer.json
I found out that the homepage link on packagist.org points to: http://phpoffice.github.io/ but that site doesn't exist. So this PR updates the link to the documentation site.
2022-01-04 14:02:52 +01:00
Maarten de Keizer
e9cd17d4c7 Add destructor wich will try to clean up temp file of the template
processor
2022-01-04 10:35:29 +01:00
Amgad Naiem
d9c1daa89c
Added Swedish language 2021-12-06 22:39:26 +02:00
brammeleman
5bd4ad39a5
fixed code example
classes not found and missing dollar sign
2021-06-29 11:57:41 +02:00
troosan
aca10785cf Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop 2021-06-04 22:58:45 +02:00
troosan
e37b22bf2b prepare release 18.2.0 2021-06-04 22:58:27 +02:00
troosan
5a5562cd99 Merge branch 'master' of https://github.com/PHPOffice/PHPWord into develop 2021-06-04 22:50:17 +02:00
troosan
bb106f9052
Merge pull request #2090 from DShkrabak/DShkrabak-patch-1
Add BorderStyle for Cell Style to documentation
2021-06-04 22:37:26 +02:00
Artem Kolotilkin
eec9e975da Added support for Garamond font 2021-06-04 22:29:29 +02:00
DDim
7744ef2234
Add BorderStyle for Cell Style to documentation
Add BorderStyle for Cell Style  to documentation.
2021-06-02 13:52:49 +03:00
troosan
d905e764e3
Merge pull request #2063 from tpv-ebben/develop
when adding image to relationship first check that the generated RID is actually unique
2021-05-29 17:58:25 +02:00
troosan
612fefd636
Merge pull request #2087 from MegaChriz/patch-1
Corrected namespace for Language class in docs.
2021-05-29 17:56:41 +02:00
Youri
1e0157f184
Corrected namespace for Language class in docs.
The docs referenced the wrong namespace for the Language class. It said ``PhpOffice\PhpWord\ComplexType\Language``, but there's no Language class in the namespace ``PhpOffice\PhpWord\ComplexType``. I searched in the tests to figure out where the Language class has moved to and found in ``PhpOffice\PhpWord\Writer\Word2007\Part\SettingsTest::testLanguage()`` this had to be ``PhpOffice\PhpWord\Style\Language``.
2021-05-25 15:48:13 +02:00
troosan
d6e0a3ebdb
Merge pull request #2070 from PHPOffice/dependabot/add-v2-config-file
Upgrade to GitHub-native Dependabot
2021-05-05 21:01:50 +02:00
dependabot-preview[bot]
a9deeb8c25
Upgrade to GitHub-native Dependabot 2021-04-29 21:47:21 +00:00
troosan
7fd0489567 fix checkstyle issues 2021-04-16 23:38:14 +02:00
Ebben Feagan
524c08bafb running composer fix 2021-04-16 15:19:55 -05:00
Ebben Feagan
94b74c27a4 when adding image to relationship list check that the generated relationship id is actually unique 2021-04-16 15:06:37 -05:00
troosan
ab7d82274e
Merge pull request #2052 from dfsd534/develop
Update chart, don't write 'c:overlap' if grouping is 'clustered'
2021-04-15 22:23:24 +02:00
troosan
fa52c92561
Merge pull request #2041 from joelgo/patch-1
Update Html parser to accept line-height:normal
2021-04-15 22:23:08 +02:00
DE TROOSTEMBERGH Antoine
3a7301c700 try to fix the php-cs-fixer pr annotation 2021-04-15 21:44:37 +02:00
DE TROOSTEMBERGH Antoine
0692a55fa4 checkstyle fixes 2021-04-15 21:19:38 +02:00
DE TROOSTEMBERGH Antoine
a4055fb7a0 'normal' line-height means default line height
Add unit test
2021-04-15 21:04:45 +02:00
DE TROOSTEMBERGH Antoine
8efd9ff9da Merge branch 'develop' into develop_tmp 2021-04-14 22:19:05 +02:00
DE TROOSTEMBERGH Antoine
d731e9284f fix checkstyle issues 2021-04-14 22:15:58 +02:00
troosan
55defcc892 relax some phpmd rules 2021-04-14 00:16:28 +02:00
dfsd534
afed126ab1 update 2021-04-10 11:49:32 +08:00
joelgo
7f78322d04
Update html.php
For acept text in line-height how "line-height:normal", etc.
2021-03-17 13:09:13 -05:00
troosan
a30bbbdc62
Merge pull request #2021 from kamilmmach/develop
Fix image border in Word2007 Writer for LibreOffice 7
2021-03-13 17:27:03 +01:00
Adrien Crivelli
06b90e39a3
0.18.1 2021-03-08 10:06:35 +09:00
Adrien Crivelli
84d1da6ce2
Merge pull request #2032 from mussbach/f_2028_dont_replace_package
Fix BC break in #1946. This package does not replace laminas/laminas-zendframework-bridge
2021-03-08 10:02:32 +09:00
Sami Mussbach
556a250fb3 Fix BC break in #1946. This package does not replace laminas/laminas-zendframework-bridge
This commit fixes the BC break introduced by #1946 where it was stated
that phpword replaces package laminas/laminas-zendframework-bridge which
is not the case. Package laminas/laminas-zendframework-bridge only was
replaced from phpword.
2021-03-04 17:50:16 +01:00
troosan
5dcb3e53ee coverage with xdebug 2021-02-21 21:46:22 +01:00
troosan
2ae000cbad hack for phpunit 8 compatibility 2021-02-21 21:32:45 +01:00
troosan
b71b4fdb71 update phpunit params 2021-02-21 21:16:27 +01:00
troosan
2961b72c7a don't fail on non existing lock file 2021-02-21 21:07:20 +01:00
troosan
1e5fd83222 remove travis config file 2021-02-21 21:01:01 +01:00
troosan
67ea85688e add git workflow 2021-02-21 20:53:45 +01:00
Kamil Mach
68cbca530f Fix image border in Word2007 Writer for LibreOffice 7 2021-02-17 09:22:32 +01:00
troosan
1bd7cd6238 set release date 2021-02-12 22:28:06 +01:00
troosan
c2e2ec4004
Merge pull request #1832 from Matze2010/udz-checkbox-feature
Add parsing of HTML checkbox input field
2021-02-12 20:37:35 +01:00
troosan
659d3d7b4b
Update Html.php
fix
2021-02-12 20:16:18 +01:00
troosan
bed1f7afbf
pass the paragraph style 2021-02-11 21:44:20 +01:00
troosan
4c5e760871 Merge branch 'master' of https://github.com/PHPOffice/PHPWord.git into develop 2021-02-11 20:39:01 +01:00
troosan
c550a53c3e prepare changelog for 0.18.0 2021-02-11 20:38:40 +01:00
troosan
a382f9d754
fix 2021-02-11 19:25:28 +01:00
troosan
8bb0b73733 fix merge 2021-02-10 21:10:06 +01:00
troosan
d4f08a3f8a Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into tmp
Conflicts:
	tests/PhpWord/Shared/HtmlTest.php
2021-02-10 21:04:16 +01:00
troosan
9736d37bc9
Merge pull request #1986 from emnabs/develop
add/setting page element border style.
2021-02-10 20:49:37 +01:00
troosan
81d613bc4d php 5.3 compatible code 2021-02-10 08:25:09 +01:00
troosan
4840faa422
Merge pull request #1922 from csk83/develop
Add Option for Dynamic Chart Legend Position #1699
2021-02-09 21:26:47 +01:00
troosan
1b7b43a4e5 fix code formatting 2021-02-08 22:58:14 +01:00
troosan
e1bbc85cc4
Make syntax php 5.3 compliant 2021-02-08 22:40:46 +01:00
troosan
b2585dfd28 move constants to simpleType 2021-02-08 22:20:00 +01:00
troosan
1c3fdd2719 prepare release 0.18.0 2021-02-08 22:12:24 +01:00
troosan
264f1590f0 make xmlReplaceBlock public 2021-02-08 22:08:29 +01:00
troosan
cba1edc9e8
remove trailing whitespaces 2021-02-08 00:59:44 +01:00
troosan
486321bb02
Compatibility with old PHP versions 2021-02-08 00:58:00 +01:00
troosan
6db2927484
Merge pull request #1965 from naept/feature_handle-style-inheritance-for-html
feat: Update addHtml to handle style inheritance
2021-02-08 00:51:34 +01:00
troosan
f832a7c9db
Merge branch 'develop' into develop 2021-02-08 00:37:42 +01:00
troosan
ca45d14511
Merge pull request #1809 from juzser/dev-master
Update the regexp to avoid catastrophic backtracking
2021-02-07 23:42:57 +01:00
troosan
5080139511
Merge pull request #1824 from ErnestStaug/locale_support
Some document have non-standard locale code
2021-02-07 23:33:14 +01:00
troosan
6baf287a5f
Merge branch 'develop' into udz-checkbox-feature 2021-02-07 23:30:28 +01:00
troosan
d592b8e4c9
Merge pull request #1877 from ThanasisMpalatsoukas/patch-1
Unused variables $rows, $cols
2021-02-07 23:26:48 +01:00
troosan
9e322dd6e7
Merge pull request #1902 from lubosdz/develop
Enhancements to addHTML parser
2021-02-07 22:53:53 +01:00
troosan
bf8f2ac12f
Merge pull request #1763 from TimeTonic/fixes-1750-block-with-images-inside
TemplateProcessor cloneBlock wrongly clones images
2021-02-07 22:27:40 +01:00
troosan
137238faed
Merge pull request #1967 from jsochor/develop
fix image limit
2021-02-07 22:09:34 +01:00
troosan
f5c96beedd
Merge pull request #2012 from dbarzin/develop
Add support for charts in template processor
2021-02-07 22:08:26 +01:00
troosan
26e479422a
Fix formatting 2021-02-07 15:06:01 +01:00
troosan
dc9b1edb5b fix formatting 2021-02-06 22:50:11 +01:00
Antoine de Troostembergh
31259f6448 fix 2021-02-06 22:12:19 +01:00
Antoine de Troostembergh
1168789e8a fix formatting 2021-02-06 21:32:30 +01:00
dbarzin
214df1a1cb fix unit test 2021-02-06 12:57:16 +01:00
dbarzin
48ee2eb78a fix param error 2021-02-06 10:50:21 +01:00
dbarzin
31002fc6e8 add chart in template 2021-02-06 10:40:52 +01:00
troosan
4e87e72110
Merge pull request #1716 from enflow/allowImageClosure
Allow a closure to be passed with image replacement tags
2021-02-05 22:08:56 +01:00
troosan
8922632ead
Merge pull request #1936 from YannikFirre/patch-1
Add null check when setComplexValue is not found
2021-02-05 21:26:02 +01:00
troosan
24e46544d8
remove space 2021-02-05 21:25:21 +01:00
troosan
3c66ce9a73
Merge pull request #1988 from Ciki/patch-1
Fix deprecated warning for non-hexadecimal number
2021-02-05 21:16:25 +01:00
troosan
13384f63d3
update comment 2021-02-05 21:15:51 +01:00
Antoine de Troostembergh
83ba5a7b57 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into patch-1 2021-02-05 21:12:43 +01:00
troosan
ca1272bd69
remove whitespace 2021-02-05 20:48:05 +01:00
troosan
554e90a46c
Merge pull request #1851 from oleibman/defaultpaper
Make Default Paper Configurable
2021-01-12 21:40:26 +01:00
troosan
c391b90823
Merge pull request #1924 from sven-ahrens/feature/parse-shapes
Feature Request: Read shape node values
2021-01-12 21:37:23 +01:00
troosan
06c82488a8
Merge pull request #1996 from liborm85/drop-common-package
Remove legacy PHPOffice/Common package, fix PHP 8.0 compatibility
2021-01-12 21:30:49 +01:00
Libor M
40966dd5c5 remove allow failures for PHP 8.0 2021-01-10 14:56:54 +01:00
Libor M
293efab0c2 TCPDF doesn't support PHP 8.0, skip test 2021-01-10 14:33:13 +01:00
Libor M
ea917c28da fix coverage 2021-01-10 14:06:19 +01:00
Libor M
7a131d0ae1 allow dompdf/dompdf 1.0 version 2021-01-02 09:37:43 +01:00
Libor M
681d5c4709 fix PHP 8.0 compatibility 2021-01-02 09:08:43 +01:00
Libor M
67b15986a7 remove require phpoffice/common package 2021-01-02 08:36:05 +01:00
Libor M
a2c8d8c2d5 \PhpOffice\Common\XMLWriter -> \PhpOffice\PhpWord\Shared\XMLWriter 2021-01-02 08:26:46 +01:00
Libor M
357e905e8b fix PasswordEncoder namespace 2021-01-01 16:52:15 +01:00
Libor M
0cca050bcd \PhpOffice\Common\XMLReader -> \PhpOffice\PhpWord\Shared\XMLReader 2021-01-01 16:33:27 +01:00
Libor M
9a26ad9189 \PhpOffice\Common\Microsoft\PasswordEncoder -> \PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder 2021-01-01 16:23:58 +01:00
Libor M
b656720619 \PhpOffice\Common\Drawing -> \PhpOffice\PhpWord\Shared\Drawing 2021-01-01 16:15:24 +01:00
Libor M
c52686c243 \PhpOffice\Common\Text -> \PhpOffice\PhpWord\Shared\Text 2021-01-01 16:09:16 +01:00
Antoine de Troostembergh
cf808cb3fc Fix merge issue 2020-12-31 21:56:45 +01:00
Antoine de Troostembergh
834a95c503 fix formatting 2020-12-30 20:29:43 +01:00
Yannik Firre
15ee5dee05
Fix missing space after if keyword 2020-12-30 14:02:29 +01:00
troosan
20856fc102
Merge pull request #1858 from oleibman/wordcoverage
Improve Word2007 Test Coverage
2020-12-29 23:56:22 +01:00
troosan
f780c5d18f
Merge pull request #1866 from manishbhatias/patch-1
Fix example for cloneRowAndSetValues
2020-12-29 23:44:49 +01:00
troosan
7c7d7fd405
Merge pull request #1983 from FCG-Group/allow_to_use_customized_pdf_libraries
allow to use customized pdf library
2020-12-29 23:41:23 +01:00
troosan
31d8b547c8
Merge pull request #1992 from Adizbek/develop
Fix image stroke in libreoffice 7.x
2020-12-29 23:32:32 +01:00
troosan
e3732ef610
Merge pull request #1907 from SailorMax/patch-2
Allow to redefine TCPDF object
2020-12-29 23:19:47 +01:00
troosan
b2335d2b73
Merge pull request #1796 from oleibman/odtchanges
ODT Changes
2020-12-29 23:18:23 +01:00
troosan
6126080cdf
Merge pull request #1952 from mnvx/develop
Fix typo in docs. Update templates-processing.rst
2020-12-29 22:53:22 +01:00
troosan
7a97d24c77
Merge pull request #1946 from liborm85/php80
Compatibility with PHP 7.4, PHP 8.0 and migrate to Laminas Escaper
2020-12-29 22:42:02 +01:00
Ergashev Adizbek
18e41a1c4e
Update TemplateProcessor.php 2020-12-23 16:00:06 +05:00
Ciki
1f67c993e2
Fix deprecated warning for non-hexadecimal number
I've come across this deprecated warning when trying to save docx to pdf.. if cellBgColor is set to `auto` it should be converted back to `null` which has in practice the same functionality.
2020-12-22 12:12:18 +01:00
emhome
cc9dfb8630 add/setting page element border style. 2020-12-19 16:46:14 +08:00
SailorMax
c8de86a7ec allow to use customized pdf library 2020-12-16 17:24:42 +03:00
Libor M
36b63a107c skip test, because php 8.0 contain internally validation 2020-12-11 12:43:15 +01:00
Libor M
4b4dfb4ccd update ugly hack for PHPUnit 8 support 2020-12-10 16:54:49 +01:00
Libor M
a9e012530d
travis support latest php as 8.0 now 2020-12-09 13:03:49 +01:00
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
Nicholas Moore
ecc13ff62a
Update templates-processing.rst
fix typo in doc
2020-10-22 13:53:28 +03:00
Libor M
6b99923363 travis php 8 - convert tests from phpunit 7 format to phpunit 8 format 2020-10-19 15:05:14 +02:00
Libor M
4cc2cc1aeb travis upgrade to PHPUnit 8 for PHP 8 2020-10-19 14:23:42 +02: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
b7dc71ab1b scrutinizer fix, allow zip extension 2020-10-18 08:37:53 +02:00
Libor M
6d49b28678 skip TCPDF test in PHP 5.3, because
version 6.3.5 doesn't support PHP 5.3, fixed via https://github.com/tecnickcom/TCPDF/pull/197, pending new release.
2020-10-18 07:47:25 +02:00
Libor M
eaf2212aa8 fix format for coverage 2020-10-18 07:45:57 +02:00
Libor M
0edcab0da6 allow php 5.3, 5.4, 5.5 except xenial os 2020-10-18 07:26:06 +02:00
Libor M
236c7c4499 fix code format 2020-10-17 17:34:51 +02:00
Libor M
2845284284 revert from develop branch 2020-10-17 17:25:02 +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
93579e90ef forgotten condition for libxml_disable_entity_loader 2020-10-17 16:05:30 +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
7fd4b64e8a - composer in php 5.x require increase memory limit
- in PHP 7.3, 7.4 not necessary remove ignore platforms
2020-10-17 15:47:27 +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
Libor M
adb917273c allow PHP 7.4, 8.0 2020-10-17 12:56:06 +02:00
Yannik Firre
aa7c1d0fe8
FIX - When setComplexValue is not found 2020-09-22 16:28:52 +02:00
Sven Ahrens
166a136f22 Fix spacing 2020-09-02 14:36:08 +02:00
Sven Ahrens
51034af207 Remove filter option 2020-09-02 13:03:49 +02:00
Sven Ahrens
ae34ae9518 Add testcase 2020-09-02 13:03:29 +02:00
Sven Ahrens
58e0200fbd Get fallback value instead of taking the last element 2020-09-02 12:12:48 +02:00
Sven Ahrens
63d1ffceb8 Restore gitignore 2020-09-01 18:14:27 +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
troosan
e7f70f3450
Merge pull request #1774 from oleibman/fieldstyle
Add font style for Field elements
2020-07-06 08:34:30 +02:00
Sakis bal
2c7a306961
Unused variables $rows, $cols
Columns are hardcoded in the basic table loop instead of using the predefined $rows and $cols variables
2020-06-01 12:28:11 +03:00
Manish Bhatia
1587c59f40
Fix example for cloneRowAndSetValues
Added a fix for missing parameter to the cloneRowAndSetValues function call in its example.
2020-05-13 12:48:54 +05:30
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
rikvdlooi
04b224caa5
Fixed setting width of Cell Style
The setWidth method did not change the width in the style, seems to be a small mistake.
Now the width is correctly for the Cell Style.
2020-04-15 22:34:19 +02: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
4e347b33d7 One Additional Coveralls Test
Cover one line previously omitted from coverage.
2020-02-06 23:34:24 -08: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
troosan
733f845f8f
Merge pull request #1776 from mdupont/footnotes-typo
Fix documentation and method name for FootnoteProperties
2019-12-09 21:08:39 +01:00
Michaël Dupont
cb3e211135 fix(documentation): snippet for FootnoteProperties
The documentation contained an incorrect code snippet for
configuring FootnoteProperties. Now the code is valid.
2019-12-09 11:29:39 +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
DE TROOSTEMBERGH Antoine
9fe6a58669 Merge remote-tracking branch 'upstream/master' into develop 2019-12-08 18:22:01 +01:00
Michaël Dupont
072c3bfdb3 fix: PHPUnit test Process() format
\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.
2019-12-08 15:47:53 +01:00
troosan
d9cb88e987
Merge branch 'develop' into fixes-1750-block-with-images-inside 2019-12-08 14:35:14 +01:00
troosan
5a7a11a62b
Merge pull request #1729 from hcdias/patch-1
Update templates processing docs
2019-12-08 14:32:03 +01:00
troosan
9020e6769e
Merge pull request #1764 from mdupont/358-paragraph-indent
fix: documentation about paragraph indentation
2019-12-08 13:28:35 +01:00
troosan
d423e9bb57
Merge pull request #1745 from igronus/patch-1
Update templates-processing.rst
2019-12-08 13:16:03 +01:00
troosan
38345041fd
Merge pull request #1744 from Manunchik/Manunchik-patch-4
Improve unit test
2019-12-08 13:15:28 +01:00
troosan
777b48f184
Merge pull request #1743 from Manunchik/Manunchik-patch-3
Improve unit test
2019-12-08 13:15:18 +01:00
troosan
3583cfe7eb
Merge pull request #1742 from Manunchik/Manunchik-patch-2
Improve unit test
2019-12-08 13:15:08 +01:00
troosan
638154936c
Merge pull request #1771 from mdupont/fix-tests
Fix PHPUnit tests on develop branch
2019-12-08 13:14:37 +01:00
owen
122aaf17b1 Incorporate Pull Request 1771
Fix PHPUnit tests on develop branch
2019-12-05 23:48:44 -08:00
Owen Leibman
9b5483a1e0 Incorporating Pull Request 1771
That Pull Request is "Fix PHPUnit tests on Develop Branch".
2019-12-05 23:42:54 -08: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
Michaël Dupont
aa44594ed3 fix: PHPUnit test Process() format
\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.
2019-12-02 16:17:26 +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
oleibman
2d60f3220d
Merge pull request #1 from oleibman/master
Master
2019-11-17 02:38:34 -08:00
Owen Leibman
00f9bb5897 Formatting changes in source code. 2019-11-17 00:07:02 -08:00
Owen Leibman
2513e54540 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 23:20:02 -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
igronus
0ce843016b
Update templates-processing.rst
Typo fix.
2019-10-24 11:07:33 +03:00
Manunchik
21db2d40a4
Improve unit test 2019-10-23 13:46:58 +05:00
Manunchik
cb7ffd0ac2
Improve unit test 2019-10-23 13:44:47 +05:00
Manunchik
b0de8e7d1d
Improve unit test 2019-10-23 13:41:35 +05:00
Michel Bardelmeijer
68118685d0 Merge branch 'master' into allowImageClosure 2019-10-21 12:33:12 +02:00
Hugo Carvalho
5e93950bc3
Update templates processing docs
Adding save() and saveAs() methods docs
2019-10-02 22:15:14 -03:00
troosan
b8346af548 update changelog for version 0.17 2019-10-01 22:43:33 +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
troosan
dfa0b5f8ce
Merge pull request #1712 from fmasa/fix/return-types
Added return type
2019-09-30 21:38:38 +02:00
Samuel BF
7628b41fdf Add support for basic fields in RTF writer. 2019-09-10 11:24:59 +02:00
Michel Bardelmeijer
6ed320311e Add documentation for image closure support 2019-09-09 13:55: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
troosan
8fbd060148
Merge pull request #1661 from andreybolonin/patch-1
add php 7.4snapshot
2019-09-01 22:30:21 +02:00
troosan
aec9582d83
allow php 7.4 build to fail 2019-09-01 22:12:34 +02:00
troosan
18664fb955
Merge branch 'develop' into patch-1 2019-09-01 21:57:27 +02:00
troosan
e9a4251c7e Use precise only for php 5.3 2019-09-01 21:54:28 +02:00
troosan
5b34391eea
Merge pull request #1707 from mdupont/fix-travis-ci
Fix apt-get crash in Travis CI for PHP 5.3
2019-09-01 21:06:24 +02:00
troosan
18ec5d63f3 fix phpmd config 2019-09-01 21:03:22 +02:00
Michaël Dupont
72311767c5 Fix Travis crash with Composer memory usage 2019-08-28 11:11:19 +02:00
Michaël Dupont
41227e8e08 Fix apt-get crash in Travis CI 2019-08-28 10:59:06 +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
troosan
fa6a80fb4d
Merge pull request #1658 from 0b10011/readmelinks
Use relative links in README to ensure they go to the correct branch
2019-07-28 21:21:44 +02:00
Andrey Bolonin
5fe485adac
add php 7.4snapshot 2019-07-14 15:26:23 +03:00
Brandon Frohs
5f8fad3985 Use relative links in README to ensure they go to the correct branch 2019-07-11 17:14:35 -04:00
troosan
06c2f5683b
Merge pull request #1653 from auipga/patch-1
Fix link anchor
2019-07-10 23:59:34 +02:00
troosan
58adc1eb1f
Merge pull request #1644 from 0b10011/contributing
Update CONTRIBUTING to match reality and add issue templates for bug reports, feature requests, and usage questions
2019-07-10 23:55:57 +02:00
Manuel Transfeld
4f7790baab
Fix link anchor
Fix a typo in a link
2019-07-09 17:22:30 +02:00
troosan
7768c56a56
Merge pull request #1645 from JBlond/develop
Update Wrong definition
2019-07-09 07:43:10 +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
Brandon Frohs
b13aa70ae9 Move pull request template to avoid confusion 2019-07-01 13:36:41 -04:00
Brandon Frohs
71ac081cfa Add note about using composer check before submitting pull requests 2019-07-01 13:34:05 -04:00
Brandon Frohs
74e52ce71b Remove the existing issue template 2019-07-01 13:33:48 -04:00
Brandon Frohs
e401adeb7e Update CONTRIBUTING to match reality and account for new issue templates 2019-07-01 13:10:55 -04:00
Brandon Frohs
d6b0977afe Add issue templates for bug reports, feature requests, and usage questions 2019-07-01 13:09:36 -04:00
troosan
d7ed18c39d fix test 2019-06-14 00:19:44 +02:00
troosan
3c6a1a1568 add unit test 2019-06-13 23:03:09 +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
troosan
fe531cae55
Merge pull request #1616 from nicoder/patch-5
fix typo in changelog
2019-04-24 22:00:31 +02:00
Nicolas Dermine
c00c77c4c1
fix typo in changelog 2019-04-17 18:27:33 +02:00
troosan
b1903524b9
Merge pull request #1611 from zearg/develop
call static instead of self on protected method
2019-04-16 20:40:48 +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
troosan
6e4f18c2b0
Merge pull request #1585 from seamuslee001/libxml_improve
Ensure that entity_loader disable variable is re-set back to the orig…
2019-03-31 13:19:25 +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
troosan
2d2fe52b7a
Merge pull request #1387 from SailorMax/html_writer_auto_invert_text_color
Html writer auto invert text color
2019-03-05 23:05:37 +01:00
Maxim
8931ab12b2
Merge branch 'develop' into html_writer_auto_invert_text_color 2019-03-01 16:33:50 +02:00
Maxim Bulygin
57ae7008b2 add test to auto invert text color 2019-03-01 16:31:47 +02:00
troosan
81af913a66
Update CONTRIBUTING.md 2019-02-24 21:23:59 +01: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
0a73bfd115
Merge pull request #1570 from troosan/fix_parsing_html_border_color
fix parsing of border-color and add test
2019-02-06 22:43:41 +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
6e172747ec
Merge pull request #1569 from troosan/page_vertical_align
implement support for section vAlign
2019-02-06 07:44:10 +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
troosan
5b0c8a3e28 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into rebase_pull_request 2019-02-05 00:09:27 +01:00
troosan
58a2849e38 Add reading of the settings part 2019-02-04 23:59:37 +01:00
troosan
98026aefaf
Merge pull request #1565 from troosan/set_complex_type_in_template
Set complex type in template
2019-02-04 23:27:13 +01:00
troosan
d2b0b317e0 fix scrutinizer warnings 2019-02-04 22:57:33 +01:00
troosan
bc448aed6c improve code coverage 2019-02-04 21:53:19 +01:00
troosan
d862b1f267 update documentation 2019-01-31 01:32:00 +01:00
troosan
67f3bd369c Add methods to replace macro with ComplexType 2019-01-31 01:26:19 +01:00
troosan
af31fc5340
Merge pull request #1558 from ramsalt/develop
Language::validateLocale should pass with locale 'zxx'.
2019-01-30 20:18:20 +01:00
Stathis Papadopoulos
3c9fa2df13 Language::validateLocale should pass with locale 'zxx'. 2019-01-28 10:50:28 +01:00
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
3a7b8aba44
Merge pull request #1550 from troosan/add_support_for_table_rtl
Add RightToLeft table presentation
2019-01-03 12:44:49 +01:00
troosan
6aae8bdccb update doc and release note 2019-01-03 11:36:28 +01:00
troosan
f91863ed64 Add RTL aligning of tables 2019-01-03 11:33:56 +01:00
troosan
4d76baea42
Merge pull request #1544 from troosan/avoid_remote_image_loading_during_tests
Use embedded http server to test loading of remote images
2019-01-02 14:36:54 +01:00
troosan
c408ac5d50 Use embedded http server to test loading of remote images 2018-12-30 14:14:27 +01:00
troosan
7b7d4e4936 release version 0.16.0 2018-12-30 01:35:03 +01:00
troosan
b375b8580f fix broken samples 2018-12-30 01:13:54 +01:00
troosan
54e7c6dd5a don't default styles to false
this allows us to for instance make part of a Heading not bold, which
would otherwise be the default.
2018-12-30 00:45:45 +01:00
troosan
1c35c4871a update develop badge 2018-12-30 00:41:58 +01:00
troosan
481f2c7310 fix code indenting 2018-12-29 23:30:23 +01:00
troosan
067c4f6809 update badges 2018-12-29 23:17:17 +01:00
troosan
3390c907dc fix scrutiniser warning 2018-12-29 23:16:56 +01:00
troosan
54b94be65a fix doc 2018-12-29 23:14:18 +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
b2c627d57c Merge branch 'parsing_heading2' develop
Conflicts:
	src/PhpWord/Reader/Word2007/Styles.php
	tests/PhpWord/Reader/Word2007/StyleTest.php
2018-12-28 22:33:48 +01:00
troosan
9e5da1e025 update changelog 2018-12-28 22:26:30 +01:00
troosan
ccf291234e Avoid warning if variable is null 2018-12-28 20:32:10 +01:00
troosan
d8d697c848 added convertors with test 2018-12-28 18:04:36 +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
01209ddbd1 improve template processor documentation 2018-12-27 21:05:56 +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
1717bd4978 add test for cloneBlock operation 2018-12-27 00:30:04 +01:00
troosan
0f963e40a7
Merge pull request #1536 from Samuel-BF/fix-RTF-numerals
For RTF writers, sizes should should never have decimals
2018-12-26 23:16:22 +01:00
troosan
bbe517aa60
Merge pull request #1541 from morrisdj/develop
Add "Plain Text" type to SDT (Structured Document Tags)
2018-12-26 23:16:06 +01:00
troosan
254d300ea7
Merge pull request #1511 from carusogabriel/ternary-expressions
Remove unnecessary ternary expressions
2018-12-26 23:15:49 +01:00
troosan
dcf637df5a update changelog 2018-12-26 22:53:49 +01:00
troosan
d84da93a36 Add test and fix warnings 2018-12-26 22:50:19 +01:00
troosan
8ffaa1c8b7 add test to cover get TemplateProcessor::getVariables 2018-12-26 22:27:17 +01:00
Daniel Morris
5e2374be4a Merge remote-tracking branch 'upstream/develop' into develop 2018-12-26 21:49:41 +02:00
Daniel Morris
a5ec49d99d Add plain text SDT type 2018-12-26 21:45:32 +02:00
troosan
575c5531b8 replace self with static 2018-12-26 20:07:53 +01:00
troosan
2a088fb45b Update changelog 2018-12-26 20:07:32 +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
troosan
c9b19cf65b Merge remote-tracking branch 'upstream/master' into rebase_pull_request 2018-12-26 19:54:41 +01:00
troosan
10b106ce05
Update CHANGELOG.md 2018-12-26 17:20:15 +01:00
troosan
56ca30ab95
Merge pull request #1539 from GautierDele/develop
Update documentation on usage of ListItemRun
2018-12-26 14:35:42 +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
Gautier
0b99f8f3e2 docs: ListItemRun 2018-12-26 11:23:43 +01:00
troosan
e6496bf411
Merge pull request #1537 from isometriks/patch-1
[WIP] Still add text if link missing
2018-12-23 21:11:30 +01:00
Craig Blanchette
b1661af71a
Still add text if link missing
If link target doesn't exist, still add the text anyway.
2018-12-19 15:17:42 -05:00
Samuel BF
c0f8cae55c Fixing RTF writers : numbers should be printed as integers and not float.
This is specified in the spec, for example here :
http://www.biblioscape.com/rtf15_spec.htm#Heading2
« The delimiter marks the end of an RTF control word, and can be one of the following : [...]
* A digit or a hyphen (-), which indicates that a numeric parameter follows. The subsequent digital sequence is then delimited by a space or any character other than a letter or a digit. »
2018-12-18 15:04:25 +01:00
troosan
0db21ae115
Merge pull request #1272 from nicoder/add-getVariableCount-method
Add getVariableCount method in TemplateProcessor
2018-12-11 21:56:14 +01:00
troosan
b188ab94e1
Merge branch 'develop' into add-getVariableCount-method 2018-12-11 21:31:18 +01:00
troosan
8f85424fb7 update changelog 2018-12-11 21:30:18 +01:00
Nathan Dench
cf3132acac Add ability to pass a Style object to a Section element (#1416)
* Add ability to pass a Style object to a Section
* Fix typo
* update changelog
2018-12-08 23:35:32 +01:00
Alex Morozov
c2b54cc343 add support for hidden text (#1527)
* added hidden text word 2007
* update changelog
* update documentation
* added unit test
* docx reader
* html reader/writer
* odt writer
* updated samples
2018-12-08 23:21:59 +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
af5a271e9e
Line spacing is wrong when using "exact" line spacing rule (#1509)
* Only add 240 twips when in auto lineRule
* don't add 1 line when using EXACT line spacing rule
* fix style & scrutinizer warning
2018-12-03 16:09:20 +01:00
troosan
c15d4d155d
Merge pull request #1521 from bulbaka/patch-1
Update Language.php
2018-12-03 16:08:03 +01:00
Eugene Bulbaka
7930f5d136
Update Language.php
Added Language constants and values for Ukrainian (lines 71, 72):
const UK_UA = 'uk-UA';
const UK_UA_ID = 1058;
2018-12-03 16:04:19 +02: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
c177c55d07
Merge pull request #1433 from Tom-Magill/develop
Add feature to set Chart Title and Legend visibility
2018-12-03 00:58:54 +01:00
troosan
9f684c745e update changelog 2018-12-02 23:54:40 +01:00
troosan
0c4bd1d02f update documentation 2018-12-02 23:54:32 +01:00
troosan
5b688d50d8 fix formatting 2018-12-02 23:54:25 +01:00
troosan
31968fa814 Merge branch 'develop' of https://github.com/Tom-Magill/PHPWord into develop_upstream 2018-12-02 23:38:08 +01:00
troosan
fb60865b8d test build php 7.3 2018-12-02 22:09:24 +01:00
troosan
a44aee8c34 fix some sonar warnings 2018-12-01 21:13:11 +01:00
troosan
6a7594630c add sonar config files 2018-12-01 21:12:41 +01:00
troosan
d9165f00fa
Merge pull request #1513 from carusogabriel/phpunit
Use dedicated PHPUnit assertions
2018-11-30 22:58:01 +01:00
troosan
9dd5e0c27d
Merge pull request #1441 from aarangara/add_html_table_layout
Adding table layout to the generated HTML
2018-11-29 17:39:31 +01:00
troosan
f472bfbc75
Merge branch 'develop' into add_html_table_layout 2018-11-28 22:58:29 +01:00
troosan
b50de97a41 support auto table layout too 2018-11-28 22:54:57 +01:00
Christopher ARZUR
32fb85fc8e Added PHP 7.3 support for travis (#1495)
* Added PHP 7.3 support for travis
* mark php 7.3 as failable
2018-11-28 22:06:32 +01:00
troosan
7aef21faca add test for parsing HTML containing entities 2018-11-28 22:03:43 +01:00
troosan
78ffbff0c1
Merge pull request #1498 from Garrcomm/fix-sharepoint
Fix loading of Sharepoint document
2018-11-25 01:40:12 +01:00
troosan
a7bfc8da51
Merge pull request #1485 from Timanx/develop
Fix parsing of Office 365 documents
2018-11-25 01:38:48 +01:00
troosan
d0bcfea4a4
Merge branch 'develop' into fix-sharepoint 2018-11-22 23:07:01 +01:00
troosan
a2a70736ad update changelog 2018-11-22 23:05:43 +01:00
Christopher ARZUR
5ccf985f9a Added PHP 7.3 support for travis (#1495)
* Added PHP 7.3 support for travis
* mark php 7.3 as failable
2018-11-22 23:04:31 +01:00
troosan
c12f98f69a fix check style warning 2018-11-20 22:40:54 +01:00
troosan
1c20a4ed22 update changelog 2018-11-20 21:22:50 +01:00
troosan
79a7d5fe0e Merge remote-tracking branch 'upstream/develop' into rebase_pull_request 2018-11-20 21:17:51 +01:00
troosan
55da063ed9 Merge remote-tracking branch 'upstream/develop' into rebase_pull_request 2018-11-20 21:15:26 +01:00
troosan
586f45efea
Merge pull request #1493 from Patrick64/develop
RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals
2018-11-20 21:06:29 +01:00
troosan
718f84c8f6 Merge remote-tracking branch 'Patrick64/PHPWord/develop' into round_page_size_for_rtf 2018-11-20 20:00:26 +01:00
troosan
b5865b2fc2 update changelog 2018-11-20 19:59:30 +01:00
Ralph02
d9d79c0666 RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals 2018-11-20 19:57:35 +01:00
troosan
1a03a6cf58
Merge pull request #1512 from carusogabriel/patch-1
Fix typo in the PR template
2018-11-19 09:08:54 +01:00
troosan
25348c6e49
Merge pull request #1504 from gimler/patch-1
[Doc] add/align possible values from class constant
2018-11-19 09:08:28 +01:00
Gabriel Caruso
663fb036d0
Use dedicated PHPUnit assertions 2018-11-19 01:36:23 -02:00
Gabriel Caruso
9b174e52c1
Fix typo in the PR template 2018-11-19 01:35:03 -02:00
Gabriel Caruso
3cf0770376
Remove unnecessary ternary expressions 2018-11-19 01:32:28 -02:00
troosan
49eb9d1f17
Fix non auto line spacing (#1508)
* Only add 240 twips when in auto lineRule
2018-11-17 15:03:29 +01:00
Christopher ARZUR
ea6edf95cc Added PHP 7.3 support for travis (#1495)
* Added PHP 7.3 support for travis
* mark php 7.3 as failable
2018-11-17 00:35:57 +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
troosan
9f28ece4e9
Fix path to test document 2018-11-16 22:40:37 +01:00
Gordon Franke
768a070715
add/align possible values from class constant 2018-11-12 08:02:15 +01:00
Stefan Thoolen
54eb6e6f2c Fix for undefined index
PHP Notice:  Undefined index: document in /home/stefan/Projects/garrcomm/PHPWord/src/PhpWord/Reader/Word2007.php on line 65
PHP Warning:  Invalid argument supplied for foreach() in /home/stefan/Projects/garrcomm/PHPWord/src/PhpWord/Reader/Word2007.php on line 65
2018-11-06 14:24:56 +01:00
Ralph02
28505b0b77 RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals 2018-10-25 11:23:53 +01:00
Martin Hanzl
e19de8e8a4 #1253 - add explanatory comment 2018-10-11 11:28:44 +02:00
Martin Hanzl
7eb19c8f76 add test case for issue #1253 2018-10-11 09:40:12 +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
18760620b3
Merge pull request #1445 from FCG-Group/writer_fixes_valign_watermark
writer / word2007 / support valign and watermark without paragraph
2018-10-03 23:28:05 +02:00
troosan
8a20678a7a
Merge pull request #1455 from vblinden/feature-dutch-language
Added Dutch (nl-NL)
2018-10-03 23:17:32 +02:00
troosan
9d65414684
Merge pull request #1476 from kisabelle/patch-1
Add documentation for enabling evenAndOddHeaders
2018-10-03 23:15:31 +02:00
kisabelle
45ee8b7faf
Add documentation for enabling evenAndOddHeaders 2018-09-21 11:53:16 -07:00
vblinden
d8c0441975 Fix indenting 2018-09-03 13:32:00 +02:00
vblinden
683d91990f
Added Dutch (nl-NL) 2018-09-03 12:30:05 +02:00
Maxim Bulygin
677e3f6a19 writer / word2007 / support valign and watermark withouth paragraph 2018-07-31 18:25:29 +03:00
Abubakkar Rangara
4b9ae18d5a Adding table layout to the generated HTML - fixed php-cs-fixer error 2018-07-24 14:23:23 +01:00
Abubakkar Rangara
e61c40e71d Adding table layout to the generated HTML if element has layout style. This is useful when using creating PDF from PHPWord (e.g. using dompdf), otherwise the PDF does not contain any layout for table. 2018-07-24 13:59:16 +01:00
troosan
aa49536e3e
Merge branch 'develop' into add-getVariableCount-method 2018-07-21 14:48:24 +02:00
troosan
2bfd82e229
Merge pull request #1439 from PHPOffice/master
Merge pull request #1429 from PHPOffice/develop [ci skip]
2018-07-21 14:31:53 +02:00
troosan
d09da0b6f2
Update CHANGELOG.md 2018-07-19 02:01:40 +02:00
troosan
18c26f9218
Merge pull request #1436 from begnini/fixing_title
HTML Title Writer loses text when Title contains a TextRun instead a string.
2018-07-19 02:00:36 +02:00
troosan
f376f207b8
Merge pull request #1269 from nicoder/improve-cloneBlock-regex
Fix regex in `cloneBlock` function
2018-07-19 01:43:37 +02:00
troosan
1951db58c1 update changelog 2018-07-19 01:16:25 +02:00
troosan
e07c6559a9 adapt test 2018-07-19 00:52:22 +02:00
Humberto Pereira
8c62cea580 Fix Writer losing text when Title contains a TextRun instead a string. 2018-07-17 21:10:53 -04:00
Humberto Pereira
f5e3807654 Improving Style Parsing - handling Heading style 2018-07-17 19:35:31 -04:00
Tom-Magill
139242612d
Update Chart.php 2018-07-17 14:11:55 +01:00
Tom-Magill
0c3eb4bafc
Update Chart.php 2018-07-17 14:10:02 +01: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
dfa2f36cad
Merge pull request #1429 from PHPOffice/develop
Merge 0.15 to master
2018-07-14 18:59:43 +02:00
troosan
4c9e75088a alias for develop branch
[ci skip]
2018-07-14 18:36:29 +02:00
troosan
fe454dbaf3
Merge pull request #1428 from troosan/parse_short_lang_code
Allow passing short lang code
2018-07-14 18:11:50 +02:00
troosan
27946cad30
Merge pull request #1413 from jgpATs2w/develop
allows decimal numbers in line-height style
2018-07-14 17:53:14 +02:00
troosan
8fa1d4f224 run checks with php 7.0 2018-07-14 17:47:34 +02:00
troosan
87498e43e1 Allow passing short lang code 2018-07-14 17:21:30 +02:00
troosan
54155bf5a9
Update Sample_30_ReadHTML.html 2018-07-14 17:16:24 +02:00
troosan
af4f834149
Merge branch 'develop' into develop 2018-07-14 17:12:45 +02:00
troosan
9ee99d2c45
Merge pull request #1324 from troosan/parse_drawings
Support reading of w:drawing for documents produced by word 2011+
2018-07-14 10:23:44 +02:00
troosan
de83da2bbf
Merge branch 'develop' into parse_drawings 2018-07-14 03:30:11 +02:00
troosan
6475812e82 fix documentation 2018-07-14 03:28:09 +02:00
troosan
32907215ed fix phpstan issues 2018-07-14 02:54:17 +02:00
troosan
adc1428607 use PasswordEncoder from phpoffice/common instead 2018-07-14 02:51:08 +02:00
troosan
e028aef6d2 update to final phpoffice/common version 2018-07-14 02:26:47 +02:00
smaug1985
3906be19ee Added Support for Indentation & Tabs on RTF Writer. (#1405)
* Added Support for Indentation  & Tabs on RTF Writer.
* add decimal tab writer + tests
* Update CHANGELOG.md
2018-07-14 02:13:45 +02:00
troosan
cdc18522a2
Merge pull request #1427 from troosan/libxml_disable_entity_loader
disable entity loader before parsing XML to avoid XXE injection
2018-07-14 01:01:49 +02:00
troosan
4c4c6f43ca remove options not compatible with latest phpunit version 2018-07-14 00:59:54 +02:00
troosan
96b21badaf update changelog 2018-07-14 00:54:41 +02:00
troosan
536a1b89d7 disable entity loader 2018-07-14 00:50:01 +02:00
Jonathan Jefferies
94cf1aecb6 Require ext-zip for development (#1419)
* Require `ext-zip` for development
* Require `ext-gd` for development
2018-07-14 00:12:34 +02:00
Javier Garcia
c93880b125 clean sample resource 2018-06-13 18:14:13 +02:00
Javier Garcia
2593e9e200 Merge branch 'develop' of github.com:jgpATs2w/PHPWord into develop 2018-06-13 17:57:55 +02:00
Javier Garcia
fe647f6e55 fix when style line-height size comes in decimal number 2018-06-13 17:41:17 +02:00
troosan
4fa945561f
Merge pull request #1352 from troosan/column_width_for_odt
write column width in ODT writer
2018-06-03 23:09:33 +02:00
troosan
5b9719071e remove unused imports 2018-06-03 22:36:30 +02:00
troosan
682b88bd28 Merge commit '4e37afa15da62cdd695a18db2a40d86615086e9d' into
column_width_for_odt

# Conflicts:
#	CHANGELOG.md
2018-06-03 21:24:12 +02:00
troosan
da43a880e3 Address scrutinizer issues 2018-06-03 00:32:21 +02:00
troosan
d9ddc162a3 write column width in ODT writer 2018-06-03 00:32:20 +02:00
troosan
844a7c95ba
Merge pull request #1391 from omarpiani/develop
Added Italian to supported languages
2018-06-01 09:13:40 +02:00
troosan
4e37afa15d
Update CHANGELOG.md 2018-05-31 20:10:49 +02:00
troosan
0bd7c0b301
Add constants for Italian 2018-05-31 19:50:43 +02:00
Omar Piani
aa27109101
Update Language.php 2018-05-31 11:43:20 +02:00
javier
1a06173e1b Add parsing of html image in base64 format (#1382)
* increased test coverage of new lines
* added exception control to file_get_contents error
* update changelog
2018-05-31 01:28:14 +02:00
troosan
e76487172b update changelog 2018-05-31 00:31:41 +02:00
troosan
b2cafffffc Merge remote-tracking branch 'upstream/develop' into develop_upstream 2018-05-31 00:25:31 +02:00
Edvin Hultberg
82f3a2ab44 Update documentation for Style::add*Style methods (#1383)
* Update documentation for Style::add*Style methods
* remove phpDocumentor, simplify dependencies
2018-05-31 00:21:08 +02:00
troosan
c22f7eab5e add check on opened file 2018-05-27 21:27:45 +02:00
troosan
da604a80c4 use annotation instead 2018-05-27 20:53:42 +02:00
troosan
e02c5f74e6 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop_upstream 2018-05-27 20:39:36 +02:00
troosan
0c9626cedd add .gitattributes 2018-05-27 20:38:25 +02:00
Javier Garcia
65a594d271 cs-fixer fixes 2018-05-25 09:29:58 +02:00
Javier Garcia
a89e4c93a7 added exception control to file_get_contents error 2018-05-25 08:01:17 +02:00
Maxim Bulygin
e40449e7c8 fix variable names 2018-05-24 17:40:21 +03:00
Maxim Bulygin
13fc647d01 html writes / setup table cell color 2018-05-24 17:03:35 +03:00
Maxim Bulygin
d1ce0c366a Merge remote-tracking branch 'PHPOffice/develop' into develop 2018-05-24 16:19:00 +03:00
Javier Garcia
46b7bea097 increased test coverage of new lines 2018-05-24 07:19:45 +02:00
troosan
c5d0f71963
Merge pull request #1380 from WouterSioen/fix-get-ending-notes-calls
Fix calls to the getEndingNotes method in the samples
2018-05-23 22:52:17 +02:00
Javier Garcia
a228811a61 fixes 2018-05-23 18:48:28 +02:00
Javier Garcia
d54cc6efee fix lint 2018-05-23 18:35:12 +02:00
Javier Garcia
58c6c52ee9 merged with local version 2018-05-23 18:22:54 +02:00
woutersioen
90d4d30dd3 Fix calls to the getEndingNotes method in the samples
This call requires both an array of writes and the filename, which was
missing in both method calls.
2018-05-23 09:18:24 +02:00
troosan
e6501eb9ff
Update coverage badge
[skip ci]
[skip Scrutinizer]
2018-05-20 23:45:03 +02:00
troosan
cdb3633e37
Merge pull request #1360 from adfinis-forks/drop-gh-pages
Drop GitHub pages, switch to coveralls
2018-05-20 22:11:19 +02:00
troosan
0b27bb927d update changelog
[ci skip]
2018-05-20 22:08:53 +02:00
troosan
254064150d disable external code coverage 2018-05-20 20:59:34 +02:00
troosan
2480103b49 run coveralls when running build with code coverage 2018-05-20 17:13:04 +02:00
troosan
7f46d951eb Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop_upstream 2018-05-20 14:40:15 +02:00
troosan
453ddf078b Do not try to read document protection if not present 2018-05-20 14:37:59 +02:00
Christian Zosel
e47ce1b4fc Coveralls integration 2018-05-19 12:56:44 +02:00
JAEK-S
65b0f062ad New features when creating charts (#1332)
* add stacked bar and column charts
* add chart colors feature
* adding preliminary chart axis title functionality to XMLwriter
* added percent_stacked to available types array
* Make tick mark and tick label positions configurable
* scrutinizer fixes
* update changelog
2018-05-11 22:50:19 +02:00
Christian Zosel
96a47ec0ae Drop GitHub pages
First step to fix #1355
2018-04-26 08:42:55 +02:00
troosan
94be56b0ec fix parsing of link style 2018-04-25 23:57:07 +02:00
troosan
4d9e9bc81b
Merge branch 'develop' into column_width_for_odt 2018-04-25 22:39:38 +02:00
troosan
84fa44090f
Merge pull request #1343 from meteocontrol/feature-add-table-indent-option
Add support for table indent
2018-04-25 22:37:16 +02:00
troosan
5ec2c8560e
do not push code coverage after build of develop branch
[ci skip]
2018-04-25 22:33:48 +02:00
troosan
b147919a64 write column width in ODT writer 2018-04-18 22:34:53 +02:00
troosan
c52c96d657 add support for STYLEREF field 2018-04-17 07:34:57 +02:00
troosan
85e1e5c280
fix warning 2018-04-14 23:21:02 +02:00
troosan
b394247740
Merge branch 'develop' into feature-add-table-indent-option 2018-04-14 22:46:09 +02:00
troosan
dd27f668e0 add line height test
[ci skip]
2018-04-14 22:42:58 +02:00
troosan
9bc85347ef fix code formatting 2018-04-14 21:15:36 +02:00
troosan
6ba2df474f
Merge pull request #1336 from lalop/addhtpl-bookmark
support internal link in addHtml method
2018-04-13 22:40:09 +02:00
troosan
3380aa8b19
Merge pull request #1339 from meteocontrol/feature-wrong-unit-in-image-doc
Wrong unit in image style documentation
2018-04-13 22:37:19 +02:00
troosan
57ededeabf
Merge pull request #1338 from pcworld/image-security-doc
Improve security-related documentation of addImage and addHtml
2018-04-13 22:36:18 +02:00
troosan
9989e4e387
Merge pull request #1341 from Trainmaster/fix-add-missing-param-annotation
Add missing param annotation
2018-04-13 22:35:25 +02:00
Frank Liepert
833cf07c1a Consistently format "pt" unit 2018-04-12 16:58:48 +02:00
Frank Liepert
853fcec1b6 Fix documented unit for image height/width 2018-04-12 16:58:48 +02:00
Frank Liepert
081c6722f6 Add support for table indent 2018-04-11 10:06:58 +02:00
Frank Liepert
e885b371bc Add missing param annotation 2018-04-10 20:30:04 +02:00
pcworld
6253adaba1 Warn about parsing user-generated HTML 2018-04-09 02:48:49 +02:00
pcworld
a7981717b3 addImage docs: Warn about user-generated strings 2018-04-09 02:45:50 +02:00
Sam
ca82e19bba support internal link in addHtml method 2018-04-07 11:24:52 +02:00
troosan
67b18c32e7
fix
[ci skip]
2018-04-02 14:50:31 +02:00
troosan
ed24140e2f
update samples instructions
[ci skip]
2018-04-02 14:47:18 +02:00
eweso
91ada213c5
Update ListItem.php 2018-03-31 00:38:43 +02:00
eweso
5741e47129
Update ListItem.php 2018-03-31 00:37:50 +02:00
eweso
a09e7151ac
Update ListItem.php 2018-03-30 22:58:03 +02:00
eweso
71618f704d
Adding setNumId method for ListItem style
By allowing to set the numId in the ListItem style manually, you can separate lists. Every ListItem with the same numId belongs to one list. This allows you to restart list counting.
2018-03-30 19:24:45 +02:00
troosan
566e625b85 merge/add test/cleanup 2018-03-25 22:46:50 +02:00
gthomas2
9b722a5b0c Added missing namespaces 2018-03-23 21:29:41 +01:00
gthomas2
34bda10536 Fix images added in word 2011 2018-03-23 21:28:53 +01:00
troosan
400ee57bee fix 2018-03-22 22:47:27 +01:00
troosan
ade497d9d7 update changelog and doc 2018-03-21 22:19:56 +01:00
troosan
c08f2718af check style fixes 2018-03-21 21:58:41 +01:00
troosan
45e2e92af7 fix graph data 2018-03-21 21:50:41 +01:00
troosan
a8d1775eb1 Merge remote-tracking branch 'FrankMeyer/develop' into develop 2018-03-21 06:51:22 +01:00
troosan
2c5970a388 php 5.3 compatibility 2018-03-20 23:42:01 +01:00
Tim Jarrett
d8387c1aba Escape incoming invalid XML characters using htmlspecialchars(). 2018-03-20 22:47:15 +01:00
troosan
d8caa0b572
Merge pull request #1292 from mattbolt/develop
Fix colspan and rowspan for tables in HTML Writer
2018-03-20 22:22:19 +01:00
troosan
d7fc1a5f7b
Merge branch 'develop' into develop 2018-03-20 21:49:36 +01:00
troosan
296706aa03 add unit tests 2018-03-20 21:35:06 +01:00
troosan
992d842552 fix 2018-03-19 23:07:35 +01:00
troosan
f73beaa26a reset static collections at instantiation 2018-03-19 23:06:00 +01:00
troosan
16a9ded2c9 add exact line spacing test 2018-03-19 22:50:55 +01:00
troosan
de01e86d41 parse fixed line space 2018-03-19 22:50:54 +01:00
troosan
97d60dd985 tranlate percentage to rate 2018-03-19 22:50:54 +01:00
troosan
fe3f383621
Merge pull request #1316 from troosan/html_css_parse
add parsing of line-height and text-indent
2018-03-19 07:58:52 +01:00
troosan
de2e05bc11 update changelog
[ci skip]
2018-03-19 06:41:46 +01:00
troosan
997e21433c add parsing of line-height and text-indent 2018-03-18 22:32:55 +01:00
troosan
4c846426ce format & changelog 2018-03-18 20:53:05 +01:00
troosan
fb1e2e41cc Merge branch 'ComputerTinker-AddFieldDateFormats' of
https://github.com/ComputerTinker/PHPWord into
ComputerTinker-ComputerTinker-AddFieldDateFormats

# Conflicts:
#	src/PhpWord/Element/Field.php
2018-03-18 20:44:05 +01:00
troosan
9ffce350f5
Merge pull request #1299 from zobo/word2007_read_tabs
Add support for reading <w:tab/> element in runs.
2018-03-18 17:54:47 +01:00
troosan
bb70eb0b4c fix docx parsing 2018-03-18 12:37:39 +01:00
troosan
17680f7aec
Merge branch 'develop' into word2007_read_tabs 2018-03-11 22:37:05 +01:00
troosan
6b48451ebc
Merge pull request #1310 from troosan/add_image_wrap_distance
add text wrapping distance
2018-03-11 20:42:40 +01:00
troosan
a0111be6ae update changelog and doc 2018-03-11 15:02:24 +01:00
troosan
e29a3e7c10 add text wrapping distance 2018-03-11 13:27:35 +01:00
troosan
8bafe0000f
Merge pull request #1307 from franciscosens/add-suport-pt-br 2018-03-10 08:48:30 +01:00
troosan
77f2b16bc1 update copyright to 2018 2018-03-08 23:52:25 +01:00
Henri MEDOT
f9a05547f7 Added support for Floating Table Positioning (tblpPr) (#639)
Added support for Floating Table Positioning (tblpPr)
2018-03-08 23:46:22 +01:00
Francisco Lucas Sens
eb6900969f Added new constant to Brazilian portuguese language 2018-03-08 16:15:31 -03:00
troosan
9affbf4ecf
Merge pull request #1306 from Trainmaster/feature-make-composer-scripts-compatible-with-windows
Make Composer scripts compatible with Windows
2018-03-07 21:19:56 +01:00
Frank Liepert
d8f4a28b94 Make Composer scripts compatible with Windows
Windows does not like the "./" syntax
2018-03-07 20:05:40 +01:00
Frank Liepert
9ffbd98cc6 Add missing tests 2018-03-07 07:01:54 +01:00
Frank Liepert
edc3aa3cce Improve assertions 2018-03-07 07:01:54 +01:00
Frank Liepert
f41c542ba0 Enforce valid value for on/off type 2018-03-07 07:01:54 +01:00
Frank Liepert
6a6497956d Allow to set "autoHyphenation" setting (#1282)
* Allow to set "autoHyphenation" for document
* Allow to set "consecutiveHyphenLimit" for document
* Allow to set "hyphenationZone" for document
* Allow to set "doNotHyphenateCaps" for document
* Allow to set "suppressAutoHyphens" for paragraph
* randomize the tempDir more
* Word2007 parsing title formatting (#1297)
* Improve Title parsing
- Title should be able to contain TextRun
- Style 'Title' should be treated the same with as Heading
- Add tests for Heading/Title reader
* update the documentation and the changelog
* PHP 7.2 build should not fail anymore
* fix parsing of footnotes and endnotes
* add method to remove an element from a section
* add method to allow sorting of sections
2018-03-06 22:19:39 +01:00
troosan
250fbd49b1
Added support for Vertically Raised or Lowered Text (w:position) (#1294)
* Added support for Vertically Raised or Lowered Text (w:position). Note that only docx writing is implemented for now.
* Add tests + changelog
* add reader + tests + doc
2018-03-06 06:35:43 +01:00
troosan
30b224b3d0
Word2007 parsing title formatting (#1297)
* Improve Title parsing
- Title should be able to contain TextRun
- Style 'Title' should be treated the same with as Heading
- Add tests for Heading/Title reader

* update the documentation and the changelog
* PHP 7.2 build should not fail anymore
* reduce dependencies versions
* fix parsing of footnotes and endnotes
* add method to remove an element from a section
2018-03-06 06:34:55 +01:00
Damjan Cvetko
8a2cba2292 Support multiple elements (w:t, w:delText, w:tab) in w:r. 2018-03-04 17:13:06 +01:00
troosan
740e66acf5
randomize the tempDir more
to make sure directory is unique [ci skip]
2018-03-02 07:17:26 +01:00
Damjan Cvetko
0869bdc8f7 Add support for reading <w:tab/> element in runs. Internaly encoding it as "\t". 2018-03-01 01:40:54 +01:00
Lenz Weber
7fe32e6ac1 Add support for MACROBUTTON Field (#1021)
* add functionality to use MACROBUTTON as Field, use Styles for Field, add noProof to Font Style
* code review
* refactoring + fixes + unit tests
2018-02-27 23:27:18 +01:00
Samuel Laulhau
f3c73f333a Fix HTML parsing when style attribute is empty (#1295) 2018-02-27 23:24:00 +01:00
Matt Bolt
a95c3f83bc Fix colspan and rowspan for tables in HTML Writer. Syntax improved. 2018-02-19 18:02:55 +08:00
Matt Bolt
557af99a6d Fix colspan and rowspan for tables in HTML Writer 2018-02-19 13:08:17 +08:00
troosan
59de019881
Fix listitem parsing (#1290)
* Word 2007 Reader: Added support for ListItemRun
* Add tests + changelog
2018-02-18 01:41:32 +01:00
troosan
def023752d
Merge pull request #1248 from carusogabriel/patch-1
Refactoring
2018-02-18 01:40:24 +01:00
troosan
bded91af9f
Footnote in listitem (#1289)
* Allow footnote to be added in ListItems
2018-02-18 00:39:00 +01:00
dox07
04d0c02e23 Add support for cellSpacing for tables (#1040)
* Add cellSpacing  into table
* add word 2007 reader
* add tests
* add documentation
2018-02-18 00:10:10 +01:00
troosan
ba035185c7
point next dev version to develop branch
[ci skip]
2018-02-18 00:09:14 +01:00
troosan
cc57eb987e
Merge pull request #1286 from meteocontrol/feature-consistent-twip-naming
Use consistent name for twip unit
2018-02-17 08:40:48 +01:00
troosan
7324070c30
Merge pull request #1284 from Trainmaster/feature-remove-zend-stdlib-dependency
Remove zend-stdlib dependency
2018-02-17 08:39:55 +01:00
Frank Liepert
d061c6dc7c Remove zend-stdlib dependency 2018-02-17 00:03:41 +01:00
Frank Liepert
fede4f736e Add missing unit of measurement descriptions 2018-02-16 15:45:20 +01:00
Frank Liepert
ab978356c3 Use same markup for describing unit of measurement 2018-02-16 14:40:31 +01:00
Frank Liepert
e7232a715b Use singular form of twip 2018-02-16 14:34:37 +01:00
troosan
99d8b5256f
Merge pull request #1281 from troosan/add_table_layout
Add support for table layout
2018-02-14 01:21:33 +01:00
troosan
6a926e26f1 refactor attribute name to layout, add doc and tests 2018-02-14 00:39:37 +01:00
troosan
615c1d5576 Merge branch 'stretch-table' of https://github.com/aoloe/php-PHPWord
into tableLayout

Conflicts:
	src/PhpWord/Writer/Word2007/Style/Table.php
2018-02-13 23:29:53 +01:00
ale rimoldi
7ddaed240f table->setStretch() optionally avoids the table to stretch to the page width (only for word output) 2018-02-13 23:24:15 +01:00
troosan
e846602d1e fix null check
[ci skip]
2018-02-11 13:58:26 +01:00
troosan
ee95cf3df0
Merge pull request #1278 from troosan/fix_internal_links_in_html_output
Add HTML writer for Bookmarks + tests
2018-02-11 00:21:12 +01:00
troosan
5ff15e06a2
update testing instructions
[ci skip]
2018-02-11 00:17:19 +01:00
troosan
377fb99fbc Add HTML writer for Bookmarks + tests 2018-02-10 23:43:15 +01:00
troosan
b868c3370c
Merge pull request #1277 from troosan/fix_parsing_of_textbreaks
Fix parsing of textbreaks
2018-02-10 23:05:53 +01:00
troosan
874c6d6fb6 update changelog 2018-02-10 22:19:04 +01:00
troosan
91a8dd3b22 add parsing of p:br and add unit test 2018-02-10 22:16:55 +01:00
troosan
3f40c5e408
Merge pull request #1273 from troosan/various_html_parsing_fixes
Various html parsing fixes, fixes for #1252 and #1254
2018-02-09 22:50:18 +01:00
troosan
5b381bc0c0
Merge branch 'develop' into various_html_parsing_fixes 2018-02-09 21:53:48 +01:00
troosan
604e60cae9
Add support for Track changes (#1262)
* add changed information to HTML writer
* add missing writeFontStyle
* refactor track changes
* set the style
* update documentation and release note
* Update the changelog and doc
* fix scrutinizer issues
2018-02-09 21:49:11 +01:00
troosan
9cd5ab7433 update changelog 2018-02-09 17:17:13 +01:00
troosan
fd127ef9bb
Merge pull request #779 from samsullivan/imagesavealpha
Save PNG alpha information when using remote images.
2018-02-09 17:16:03 +01:00
troosan
24f3463f9a remove output 2018-02-08 07:18:02 +01:00
troosan
c0ed4ab03d Merge remote-tracking branch 'samimussbach/PHPWord/fixNestedLists' into various_html_parsing_fixes 2018-02-08 07:02:38 +01:00
troosan
304173c4d7 fix nested list 2018-02-08 07:02:28 +01:00
troosan
33739ea21c cannot add list on textrun 2018-02-07 21:39:01 +01:00
troosan
46476d7101 update phpdoc 2018-02-07 07:09:27 +01:00
troosan
47c837abef add unit tests 2018-02-06 23:31:56 +01:00
troosan
46a5f96d3b fix parsing of table and p inside table cells 2018-02-06 23:16:32 +01:00
Nicolas Dermine
12ad6fa865 adapt code for php 5.3 2018-02-06 09:30:24 +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
troosan
cf6319d7d4
Merge pull request #1264 from lalop/patch-1
Delete VERSION
2018-02-04 20:29:54 +01:00
troosan
4308ce9eab
Merge pull request #1271 from nicoder/patch-2
fix typo in CONTRIBUTING.md
2018-02-04 20:29:32 +01:00
Nicolas Dermine
edd9617c03
fix typo 2018-02-04 08:42:38 +01:00
troosan
1813e2db38
Merge pull request #1266 from samimussbach/fixTypoInTest
fix typo in test method name
2018-02-02 21:59:37 +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
Sami Mussbach
e0096dba08 fix typo in test method name 2018-02-01 14:12:56 +01:00
Sami Mussbach
8a9a4784d9 add (failing) test and correct documentation sample to valid HTML 2018-02-01 13:58:08 +01:00
Samuel Laulhau
caba7e238f
Delete VERSION
Delete VERSION file since it's outdated so not usefull anymore
2018-01-31 10:17:40 +01:00
troosan
9a91d54e10
Merge pull request #1259 from nicoder/patch-1
fix typo in comment
2018-01-30 20:55:49 +01:00
Nicolas Dermine
30183e2881
fix typo in comment 2018-01-26 18:31:35 +01:00
troosan
4f6fa5079f
Merge pull request #1258 from troosan/parse_html_links
Add parsing of HTML links
2018-01-26 07:59:28 +01:00
troosan
0425a25cdb Add parsing of HTML links 2018-01-25 23:24:21 +01:00
Gabriel Caruso
8ed3cacfe8
Refactoring 2018-01-16 20:19:54 -02:00
samimussbach
4c68ebbe9d Parse formatting inside HTML lists (#1239) 2018-01-13 10:03:53 +01:00
troosan
99b04f0353
fix reading of docx default style (#1238) 2018-01-12 23:42:22 +01:00
troosan
4a530d1d97
Do not show script source when running from CLI 2018-01-03 17:16:19 +01:00
troosan
35aa6d6291 Merge branch 'master' of https://github.com/PHPOffice/PHPWord into upstream_develop 2018-01-03 14:27:34 +01:00
troosan
bdca366d91 remove link to obsolete URL [skip ci] 2018-01-03 14:15:59 +01:00
troosan
7d929fee8c add branch alias for 0.15.0 [skip ci] 2017-12-29 21:48:15 +01:00
troosan
d480aab1b0 add branch alias for 0.15.0 [skip ci] 2017-12-29 21:48:08 +01:00
troosan
23693b403c change impl to avoid compilation issue 2017-12-29 21:47:55 +01:00
troosan
ca29ceb1fa
add branch alias for 0.15.0 [skip ci] 2017-12-29 21:33:29 +01:00
troosan
d1a79b79f1
add branch alias for 0.15.0 [skip ci] 2017-12-29 21:29:31 +01:00
troosan
2d87fd320d fix merge 2017-12-29 20:27:05 +01:00
Maxim
400a8e65d3 rename 'Object' classes to 'ObjectElement' (php 7.2 compatibility) (#1185)
merge develop branch
2017-12-29 20:19:35 +01:00
troosan
526d0ac8de create alias for develop branch 2017-12-29 15:46:31 +01:00
troosan
709ea1e14c update changelog [skip ci] 2017-12-29 15:16:03 +01:00
troosan
46e179d148 add instructions on how to run the samples in a browser 2017-12-29 15:16:03 +01:00
troosan
b20cd4fa9f output the source code of the sample that was run 2017-12-29 15:16:03 +01:00
troosan
1d8e7b8374 split composer scripts, add description (only works with composer 1.6) 2017-12-29 15:16:03 +01:00
troosan
d2b9e88047 add parsing of "align" HTML attribute 2017-12-29 15:16:03 +01:00
troosan
fd7ee76438 create alias for develop branch 2017-12-29 03:01:36 +01:00
troosan
b614497ae6
fix dependencies to have 7.1 compatible build (#1228)
* add assertions in test methods without assertions
* loosen dependencies so 7.0 & 7.1 builds can succeed
* fix some scrutinizer errors
* update release date
2017-12-29 02:30:53 +01:00
troosan
fce1bf28c8 format code 2017-12-25 22:05:46 +01:00
troosan
512cf952ae randomise temp directory name to avoid collisions 2017-12-25 20:42:37 +01:00
troosan
4767703f86 Merge branch 'master' of https://github.com/PHPOffice/PHPWord into upstream_develop 2017-12-25 17:14:27 +01:00
troosan
7250b15e74 Title can be added in Cell 2017-12-25 08:33:02 +01:00
troosan
6daf31be8f
Merge pull request #1226 from PHPOffice/develop
Merge develop branch to master branch
2017-12-25 01:37:54 +01:00
troosan
56720df487 update version 2017-12-25 01:32:34 +01:00
troosan
ed704da5b2 set release date 2017-12-25 01:24:20 +01:00
SRG Group
3e6745f146 HTML image support & TextRun paragraph style (#934)
* Adding setParagraphStyle to Textrun for indentation
* Html Image support added
* fix formatting, add tests & update changelog
2017-12-21 00:03:52 +01:00
troosan
200c2f1eb0
Merge pull request #1019 from jun-i-corn/feature/EnablePasswordProtection
enable password protection (Word)
2017-12-20 22:00:34 +01:00
troosan
7908491ba3 revert mistakenly deleted line 2017-12-19 22:14:52 +01:00
troosan
8929917677
Merge pull request #592 from ComputerTinker/ComputerTinker-FixEmptyDropdownEntry
Pad Empty Dropdown Entry
2017-12-19 21:53:59 +01:00
troosan
0f200d99f4
Merge pull request #1222 from carusogabriel/clean-elses
Clean elses
2017-12-19 21:41:21 +01:00
troosan
46a037ebd0 add composer scripts 2017-12-18 17:02:34 +01:00
troosan
219f3bcee1
Merge pull request #1221 from troosan/fix_parsing_of_on-off
correctly parse on/off values (w:val="true|false|1|0|on|off")
2017-12-18 08:52:35 +01:00
Gabriel Caruso
87acd3764b Clean elses 2017-12-14 12:21:16 -02:00
troosan
5d5362a3fd sort imports 2017-12-14 00:15:23 +01:00
troosan
5a57409df0 fix tests 2017-12-13 23:55:48 +01:00
troosan
ad38d4c20f Merge branch 'feature/EnablePasswordProtection' of https://github.com/jun-i-corn/PHPWord into feature/EnablePasswordProtection 2017-12-13 23:25:32 +01:00
troosan
f7d2ad7201 formatting 2017-12-13 23:24:37 +01:00
troosan
9e029415cc align with pull request submitted in PHPOffice/Commom 2017-12-13 23:17:01 +01:00
troosan
dc7cb1ee75 update changelog & doc 2017-12-13 22:48:58 +01:00
troosan
253b060241 correctly parse on/off values (w:val="true|false|1|0|on|off") 2017-12-13 07:47:49 +01:00
troosan
194e5c47e4 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop 2017-12-05 21:39:35 +01:00
troosan
f6dd78daa6 update doc and changelog 2017-12-05 21:39:28 +01:00
troosan
88bbe49d01
Merge pull request #1217 from troosan/html_br
Added support for linebreaks <br/> in Shared\Html::addHtml()
2017-12-05 21:38:55 +01:00
troosan
d4c6427418
Merge pull request #727 from irond/container_for_checkbox
Add TextRun as container for CheckBox
2017-12-05 21:28:59 +01:00
troosan
0c7593ba10
Merge pull request #582 from SSchwaiger/patch-2
A chart object can also be added to a table cell
2017-12-05 21:04:07 +01:00
troosan
905029a59e
Merge branch 'develop' into html_br 2017-12-05 20:50:33 +01:00
troosan
fd156bf12a
Merge branch 'develop' into html_br 2017-12-05 20:50:13 +01:00
troosan
c079bf7f10 update changelog 2017-12-05 20:47:34 +01:00
troosan
9081ed9868 fix warning 2017-12-05 17:40:23 +01:00
troosan
8f512bf618 Merge branch 'develop-html-br' of https://github.com/anrikun/PHPWord
into develop

Conflicts:
	src/PhpWord/Shared/Html.php
2017-12-05 17:33:51 +01:00
troosan
05e2f1bf63 use non deprecated method 2017-12-05 08:02:23 +01:00
troosan
3b7b894290
Merge branch 'develop' into feature/EnablePasswordProtection 2017-12-05 00:35:29 +01:00
troosan
cfc89b7853
Merge branch 'develop' into feature/EnablePasswordProtection 2017-12-05 00:34:14 +01:00
troosan
86115b9e2d update installation instructions 2017-12-05 00:14:57 +01:00
troosan
3b6f9cea21 Allow use of stdlib 3.x 2017-12-04 22:31:10 +01:00
troosan
274f50ce5a Add unit tests & add array type checks 2017-12-04 22:30:49 +01:00
troosan
ca25eba8aa Scrutinizer fixes 2017-11-26 22:55:37 +01:00
troosan
23bc837666 Scrutinizer fixes 2017-11-26 17:54:47 +01:00
troosan
6a460c292d
Merge pull request #1206 from troosan/odt_page_break
Implement PageBreak for the ODText writer
2017-11-26 00:39:25 +01:00
troosan
def9123575
Merge branch 'develop' into odt_page_break 2017-11-26 00:37:16 +01:00
troosan
911739a0b2
Merge branch 'develop' into odt_page_break 2017-11-26 00:36:37 +01:00
troosan
01008a591b update changelog 2017-11-26 00:35:21 +01:00
troosan
355027d854 PHP-CS fix, improve code coverage 2017-11-26 00:11:09 +01:00
troosan
2ea9ffbdd4 Merge branch 'develop' of https://github.com/cookiekiller/PHPWord into odt_page_break 2017-11-25 23:45:04 +01:00
troosan
72a6b1b19f Add unit test 2017-11-25 23:44:46 +01:00
Michael Spahn
5d928db916 Implement PageBreak for odt writer 2017-11-25 23:44:45 +01:00
troosan
6faddc684a
Merge pull request #1205 from troosan/update_fields
Allow to force an update of all fields on opening a document
2017-11-25 21:56:17 +01:00
troosan
5a5ae48bb6 also add w:bCs 2017-11-25 21:37:11 +01:00
troosan
ab5d4468f9 add the updateFields option on document settings
When set to true, word will ask you to update the fields in the document
when you open the document.
2017-11-25 01:48:30 +01:00
troosan
3429c443ad
Create PULL_REQUEST_TEMPLATE.md 2017-11-25 01:46:20 +01:00
troosan
446d3478e4
Create ISSUE_TEMPLATE.md 2017-11-25 01:45:27 +01:00
troosan
2e562512f4 Add unit tests for PasswordEncoder 2017-11-24 14:45:05 +01:00
troosan
ad83196a05 move password encoding in separate class
fix PHPCS errors
add documentation
add sample
2017-11-23 22:49:21 +01:00
troosan
7b30145270
Merge branch 'develop' into feature/EnablePasswordProtection 2017-11-22 22:59:46 +01:00
troosan
ffa9c156d7 fix formatting 2017-11-22 22:31:59 +01:00
troosan
b4b87cd1dc CS fixer stronger checks 2017-11-22 09:43:35 +01:00
troosan
6a5d2a636d CS fixer warning 2017-11-22 09:02:16 +01:00
troosan
8d82340589 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into release_0.14 2017-11-22 08:42:13 +01:00
troosan
38ea5ecb5f fix wrong variable 2017-11-22 08:41:42 +01:00
troosan
e07195c512 add test, fix warnings 2017-11-22 08:14:22 +01:00
troosan
0354e4e4a1
Merge pull request #480 from fergusean/patch-1
Skip inquiring PHP for temp directory when it's user defined
2017-11-22 00:24:03 +01:00
troosan
670d46e543 add getter/setter on paragraph for child spacing rule 2017-11-22 00:14:31 +01:00
troosan
ac357d10d5 Various fixes
- parse text inside list items
- add tests
- rename Cell widthType attribute to unit
2017-11-18 15:55:05 +01:00
troosan
b22208f810 format 2017-11-16 23:09:56 +01:00
troosan
bc4750dd7c
Merge pull request #1060 from Mord1n/patch-1
ODT Writer automatic-styles should be closed before opening master-styles.
2017-11-16 23:08:13 +01:00
troosan
ab9a3dbc63 fix warning 2017-11-16 18:03:37 +01:00
troosan
9cd373806c fix build 2017-11-16 17:47:48 +01:00
troosan
5ad68e0ba6 add tests, improve code coverage 2017-11-15 22:58:28 +01:00
troosan
8eb72c976a add HTML table parsing 2017-11-15 22:49:13 +01:00
troosan
c9350d3e80 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into bring_back_bold_and_italic 2017-11-11 23:52:40 +01:00
troosan
a01d22ed67 improve HTML parser and add tests 2017-11-11 23:49:23 +01:00
troosan
3f8892ed91
Merge pull request #1168 from FBnil/bring_back_bold_and_italic
Html::addHTML should parse <b> <i> <u>
2017-11-11 00:31:52 +01:00
troosan
e72446442b fix format 2017-11-10 23:47:10 +01:00
troosan
ff8234bce4 add tests 2017-11-10 23:37:02 +01:00
troosan
d8dcc770a9 Merge branch 'bring_back_bold_and_italic' of https://github.com/FBnil/PHPWord into bring_back_bold_and_italic 2017-11-10 21:47:57 +01:00
troosan
8bb9a99975 fix warning 2017-11-10 21:47:45 +01:00
troosan
07c9d9fd00 Add unit tests for Html parser 2017-11-10 21:47:44 +01:00
Nilton
379df3cebd Bring back b, i, <span style="font-style: italic;"> and <span style="font-weight: bold;"> 2017-11-10 21:47:43 +01:00
ejuhjav
e4fe0c6673 Update elements.rst
Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle)
2017-11-10 21:47:43 +01:00
troosan
266817ecac
Merge pull request #1188 from gabriel-caruso/phpunit
Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase
2017-11-10 11:21:42 +01:00
troosan
6328b83388 fix warning 2017-11-09 23:07:17 +01:00
Gabriel Caruso
ba6c03e06d Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase 2017-11-09 06:36:47 -02:00
troosan
9e7e07d0bc Add unit tests for Html parser 2017-11-09 00:41:56 +01:00
troosan
c8b55b8e59 Merge branch 'bring_back_bold_and_italic' of https://github.com/FBnil/PHPWord into bring_back_bold_and_italic 2017-11-08 21:46:55 +01:00
Nilton
fcdafeedd4 Bring back b, i, <span style="font-style: italic;"> and <span style="font-weight: bold;"> 2017-11-08 21:46:37 +01:00
ejuhjav
778a77ecff Update elements.rst
Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle)
2017-11-08 21:46:37 +01:00
troosan
7b9e262e44 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into release_0.14 2017-11-08 00:45:36 +01:00
troosan
ebd4741774 update changelog 2017-11-08 00:45:14 +01:00
troosan
13dc3bb2e4
Merge pull request #874 from bskrtich/develop
Fix incorrect image size between windows and mac.
2017-11-08 00:45:00 +01:00
troosan
5412df29fa update doc 2017-11-08 00:34:22 +01:00
troosan
64a6505f70
Merge pull request #578 from ComputerTinker/develop
#574 Incorrect Constant Names in \Style\Font.php
2017-11-08 00:31:45 +01:00
troosan
610d91e041 call parent constructor in SDT and FormField 2017-11-08 00:27:58 +01:00
troosan
0bd396b5cb
Merge pull request #724 from garethellis36/fix-html-tables
Resolves certain HTML tags rendering no output
2017-11-07 23:14:46 +01:00
troosan
9634352b0f update changelog 2017-11-07 23:13:41 +01:00
troosan
1b9c1d921b format 2017-11-07 23:13:41 +01:00
troosan
75bf84fa48
Merge pull request #887 from taophp/patch-1
Fix division by zero
2017-11-07 22:34:49 +01:00
troosan
ac4180ef7d
Merge pull request #1016 from jun-i-corn/feature/DefaultValueForDropDownSDT
allow setValue() for SDTs
2017-11-07 22:23:53 +01:00
troosan
56a3a53e7b add unit test 2017-11-07 22:11:31 +01:00
troosan
5ddb3f0b77 Merge remote-tracking branch 'origin/develop' into tmp
Conflicts:
	src/PhpWord/Writer/Word2007/Element/SDT.php
2017-11-07 17:43:22 +01:00
troosan
9653619c48
Merge pull request #980 from sergeizelenyi/dev-sdt
Add support for alias and tag on SDT elements
2017-11-06 22:09:55 +01:00
troosan
1e9203adc9 add unit tests 2017-11-06 21:47:02 +01:00
troosan
603bb9b02b Merge branch 'dev-sdt' of https://github.com/sergeizelenyi/PHPWord into dev-sdt 2017-11-06 20:53:29 +01:00
sergeizelenyi
9c1c544954 stylization code 2017-11-06 20:53:08 +01:00
sergeizelenyi
9ac9016f50 added functionality specified alias and tag 2017-11-06 20:53:08 +01:00
troosan
a7a35c688d Allow reading of TargetMode for external images 2017-11-05 22:48:04 +01:00
troosan
200d846f61 implement paragraph textAlignment 2017-11-05 21:39:10 +01:00
troosan
92fc54992a fix end of line space 2017-11-05 08:54:52 +01:00
troosan
ce377b9b58 fix php-cs error 2017-11-05 02:16:04 +01:00
troosan
67ca6ec1fd Merge branch 'develop' of https://github.com/troosan/PHPWord into develop 2017-11-05 02:10:27 +01:00
troosan
8c7ed19d62
Support for Mirrored page setup for docx (#1183) 2017-11-05 02:07:53 +01:00
troosan
64957d9ec8 Support for Mirrored page setup for docx 2017-11-05 01:58:17 +01:00
troosan
de9268ae12
Merge pull request #1150 from kaigoh/patch-2
pad the $args array instead of ignoring errors
2017-11-05 00:54:20 +01:00
troosan
056f81078f Merge branch 'develop' of https://github.com/troosan/PHPWord into
develop

Conflicts:
	composer.json
2017-11-05 00:39:14 +01:00
troosan
aa4c3f8486
HTML writer fixes
* fixed HTML superscript, and added allcaps, smallcaps, and letter-spacing
* make Comment constructor attributes optional
2017-11-05 00:27:14 +01:00
troosan
15eeaa2574
Merge branch 'develop' into fix_php7_issues 2017-11-05 00:23:09 +01:00
troosan
835aa9c5a4
Merge branch 'develop' into fix_php7_issues 2017-11-05 00:22:04 +01:00
troosan
b926eec3bc update changelog 2017-11-05 00:08:15 +01:00
troosan
03d4a36b9b fixed HTML superscript, and added allcaps, smallcaps, and letter-spacing 2017-11-05 00:03:06 +01:00
troosan
601a2b6ec6 make Comment constructor attributes optional 2017-11-04 23:26:04 +01:00
troosan
f4697ab6e1
Merge pull request #1178 from lightbringer1991/489-fix-wrappingStyle-z-index-in-64bit-OS
489: Fix z-index size too big in 64bit OS
2017-11-04 22:44:44 +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
lightbringer
3cbc65bae4 489: Fix z-index size too big in 64bit OS 2017-10-28 18:56:16 +11:00
troosan
0f50b6dc61 update documentation 2017-10-23 23:05:29 +02:00
Nilton
87a355bb82 Bring back b, i, <span style="font-style: italic;"> and <span style="font-weight: bold;"> 2017-10-21 00:07:52 +02: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
a4df134a4c Merge remote-tracking branch 'origin/develop' into develop
Conflicts:
	samples/Sample_27_Field.php
	src/PhpWord/Element/AbstractElement.php
	src/PhpWord/Element/Comment.php
	src/PhpWord/Element/TrackChange.php
	src/PhpWord/Writer/Word2007/Element/AbstractElement.php
	tests/PhpWord/Writer/Word2007/Part/StylesTest.php
2017-10-17 20:35:43 +02:00
Kai Gohegan
4084d4f191 Update AbstractContainer.php
Suppressing the PHP warning doesn't seem to work. Padding the $args array does.
2017-10-09 13:19:23 +01:00
troosan
e6f4d0276a Merge branch 'development' into fix_php7_issues 2017-09-27 01:09:23 +02:00
troosan
0beeb275fe Add support for changing the document language (#1108) 2017-09-27 00:40:08 +02:00
troosan
75a3fb8e40 Improve code coverage 2017-09-27 00:27:33 +02:00
troosan
6657f0eec3 fix doc 2017-09-26 22:46:46 +02:00
troosan
7e3d9fb89a replace @link with @see 2017-09-26 22:00:02 +02:00
troosan
cb469b973e more fixes 2017-09-26 17:34:57 +02:00
troosan
e0a2c40fb4 fix failing test 2017-09-26 08:01:28 +02:00
troosan
5364feb6c8 remove cache-file option 2017-09-25 22:48:53 +02:00
troosan
3f3f398524 php-cs fix 2017-09-25 21:30:59 +02:00
troosan
0be9ae3353 Fix php-cs option 2017-09-25 07:00:58 +02:00
troosan
a8ade6d22d general updates
Change "some" code to comply to php-cs rules
Update copyright year to 2010-2017
2017-09-24 22:15:42 +02:00
troosan
743dbff9d4 use php 5.3 array construct 2017-09-18 22:35:27 +02:00
troosan
34a1be0053 Add support for XE and INDEX fields (#922) 2017-09-18 21:45:59 +02: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
troosan
f6aafe48bb Add php-cs 2017-09-14 22:16:35 +02:00
troosan
8b0ce2e936 commit doc based on php 5.6 build 2017-09-14 00:12:29 +02:00
troosan
0115fc3d91 fix formating 2017-09-14 00:00:48 +02:00
troosan
6cd2633b85 fix travis config 2017-09-13 23:38:44 +02:00
troosan
f1aee39700 run code coverage analysis on 1 build only 2017-09-13 23:24:35 +02:00
troosan
9d57693acd update phpunit & hide output during tests 2017-09-13 23:15:46 +02:00
troosan
34ac7170a2 Merge remote-tracking branch 'github_troosan/fix-travis-build' into fix_php7_issues 2017-09-13 22:25:16 +02:00
troosan
d5291629f7 Merge remote-tracking branch 'github_troosan/develop' into fix_php7_issues 2017-09-13 22:19:16 +02:00
troosan
41a048604e upgrade to dompdf/dompdf 0.8.* 2017-09-13 22:10:04 +02:00
troosan
2fc685b4da Merge pull request #1138 from troosan/fix-travis-build
do not force dependency to old ZF version
2017-09-11 22:49:34 +02:00
troosan
15585dd3c7 - fix ZF version
Fix travis build to run on precise
Update the changelog
2017-09-09 01:25:33 +02:00
troosan
c653377b2e Merge pull request #1116 from ctrlaltca/fix_footer_first_page
Fix: different header/footer works only for headers, not for footers
2017-08-13 22:10:15 +02:00
Fabio Bas
c448046b52 Fix: different footer for first page 2017-08-02 10:52:42 +02:00
troosan
cf76b1f217 Simplify SimpleType validation 2017-07-22 00:06:04 +02:00
troosan
7c256b5344 Merge pull request #537 from ejuhjav/patch-1
Update elements.rst
2017-07-11 02:20:05 +02:00
troosan
18cb0b26f7 Add support for comments (#1067)
Just a writer for now, reader to be done
2017-07-11 01:58:54 +02:00
troosan
be6b6008e8 add reader/writer for additional values in settings.xml (#1098)
* add reader/writer for settings.xml
The following values can currently be set/read
- w:trackRevisions
- w:doNotTrackMoves
- w:doNotTrackFormatting
- w:proofState
- w:zoom
- w:decimalSymbol
- w:revisionView
2017-07-11 01:56:20 +02:00
troosan
b72ffbdc98 enable php 7.1 build 2017-07-09 22:21:52 +02:00
troosan
4c7c84b17e fix pclzip compatibility issues 2017-07-09 22:21:34 +02:00
troosan
88cc13dd85 fix 2017-07-07 08:02:31 +02:00
troosan
722c81d89d fix md remarks 2017-07-06 23:03:07 +02:00
troosan
24c440b0ab disable 7.1 and hhvm build as they currently do not work 2017-07-06 22:54:28 +02:00
troosan
b919d58bac add reader for settings 2017-07-06 22:41:04 +02:00
troosan
e9cc289243 refactor Settings to not mix PHPWord settings and document settings 2017-07-05 21:42:38 +02:00
troosan
21303ed4fb prepare release notes 2017-07-05 21:39:22 +02:00
troosan
17849b3514 Merge pull request #1075 from slowprog/develop
Fix names of styles
2017-07-04 15:54:41 +02:00
troosan
a6c6f9faa1 Merge branch 'development' into develop
Conflicts:
	tests/PhpWord/Writer/Word2007/Part/SettingsTest.php
2017-07-04 15:38:01 +02:00
troosan
f3f11cb64b Merge pull request #1092 from troosan/implement_request_#1041
add new NumberFormat values and refactor FootnoteProperties to use same values
2017-07-04 15:30:21 +02:00
troosan
8a5433e5df add new NumberFormat values and refactor other uses 2017-07-04 15:04:30 +02:00
troosan
663a552d29 Merge pull request #1008 from slowprog/develop
Fix name of style definitions
2017-07-03 14:14:43 +02:00
troosan
ef95611203 Fix multiple paragraphs being created 2017-07-03 12:54:18 +02:00
troosan
e7c551a0bf Add possibility to show/hide spelling and grammatical errors (#985)
* Add possibility to show/hide spelling and grammatical errors
2017-07-02 00:37:29 +02:00
troosan
6a3135bff2 Merge pull request #989 from troosan/fix_for_different_even_odd_headers
add possibility to write w:evenAndOddHeaders in settings.xml
2017-07-01 23:36:46 +02:00
troosan
29f7cfb581 Merge pull request #1068 from troosan/footnote_properties
Add possibility to control the footnote number
2017-07-01 23:27:10 +02:00
troosan
ce492133a6 Merge pull request #1088 from troosan/add_support_for_contextual_spacing
Add support for contextual spacing
2017-07-01 23:09:40 +02:00
troosan
0f649f3f37 Add test & update documentation 2017-07-01 22:51:53 +02:00
Maxim Barulin
d5dbfb98b0 add support for contextualSpacing attribute issue #1037 2017-07-01 21:08:05 +02:00
troosan
fd418e0746 Make sample php 5.3 compliant 2017-07-01 17:15:50 +02:00
troosan
ccccb3d679 Merge pull request #988 from troosan/fix_image_loading_over_https
fix image loading over https
2017-07-01 17:07:07 +02:00
troosan
f59b7228bb Merge pull request #977 from troosan/paper_size_computation
fix paper size and add tests for Paper class
2017-07-01 17:03:01 +02:00
troosan
8c3efa4a51 remove unused variable 2017-07-01 16:56:33 +02:00
Andrey Tyshev
2074d35ab0 Fix PreserveText in Section #452 2017-06-19 13:51:41 +03:00
Andrey Tyshev
aae9ad4249 Fix names of styles 2017-06-19 13:47:47 +03:00
Andrey Tyshev
28e3242a1d Merge remote-tracking branch 'upstream/develop' into develop 2017-06-19 13:25:56 +03:00
Hubert Miazek
e22ece8c00 #431 2017-06-19 11:05:59 +02:00
antoine
cbea5aed87 Merge branch 'footer_properties' into develop 2017-06-17 01:02:40 +02:00
antoine
eff532e64f make code php 5.3 -> 5.5 compatible 2017-06-17 01:01:54 +02:00
antoine
2d1b52bc90 Merge branch 'support_for_xe_and_index_field' into develop 2017-06-17 00:35:39 +02:00
antoine
2b4b200e42 fix namespace 2017-06-17 00:34:02 +02:00
antoine
11d816f94d php 5.3 compatibility 2017-06-16 22:39:20 +02:00
antoine
373039cbdc Merge branch 'support_for_xe_and_index_field' into develop 2017-06-16 18:01:23 +02:00
antoine
64f06e1114 use fully qualified name 2017-06-16 17:55:24 +02:00
antoine
f0fa91f63c Merge branch 'support_for_xe_and_index_field' into develop 2017-06-11 12:58:06 +02:00
antoine
8aabf812f8 update XE field to support formatted text + add documentation 2017-06-11 12:56:59 +02:00
antoine
ee2dcddc6e Merge branch 'support_for_xe_and_index_field' into develop 2017-06-07 02:27:55 +02:00
antoine
6a84b8ed26 Add possiblity to add not defined options 2017-06-07 02:26:59 +02:00
antoine
7ce54abac3 Merge remote-tracking branch 'github_troosan/footnote_properties' into develop 2017-05-30 00:37:37 +02:00
antoine
ac89cc39ea Add possibility to control the footnote number 2017-05-30 00:31:32 +02:00
antoine
f21f79761a fix sample 2017-05-25 22:04:23 +02:00
antoine
68dd3fd576 rename attribute to match generated XML node name 2017-05-24 00:18:17 +02:00
Mord1n
a55405e655 Update Styles.php
automatic-styles should be closed before opening master-styles.

This will prevent issue that styles wont work in future if you implement styling for ODT writer....
2017-05-18 16:25:05 +02:00
antoine
11c711b275 Merge branch 'fix_font_style_based_on' into develop 2017-05-16 02:41:52 +02:00
antoine
09e669f9e9 basedOn not correctly set if FontStyle is based on other FontStyle 2017-05-16 02:38:15 +02:00
antoine
6e49e89547 Merge branch 'support_comments' into develop 2017-05-15 23:00:10 +02:00
antoine
1cfb62de0d Add support for comments 2017-05-15 22:49:02 +02:00
antoine
0e0817c972 ignore the build directory 2017-05-12 00:45:31 +02:00
antoine
759794d746 fix twig dependency so build can succeed 2017-05-12 00:45:21 +02:00
Lenz Weber
71574d1fe2 Code Review; minor changes to salt handling, corrected some comments 2017-03-13 16:22:04 +01:00
Progi1984
4decaffd53 PHPWord is looking for a new maintainer 2017-03-13 14:45:57 +01:00
Maria Haubner
76246630ce add test 2017-03-10 17:30:51 +01:00
Maria Haubner
0221414ee0 randomly genereate salt for word password protection 2017-03-10 16:57:42 +01:00
Maria Haubner
703e34137b refactored hash function to word settings 2017-03-10 16:24:52 +01:00
Maria Haubner
483a167500 refactoring of hash function 2017-03-10 15:44:13 +01:00
Maria Haubner
05387fac09 enable password setting in word 2017-03-10 13:28:32 +01:00
Maria Haubner
488b10b73b allow setValue() for SDTs 2017-03-08 13:08:33 +01:00
Andrey Tyshev
f9cab8d02c Fix name of style definitions 2017-02-21 21:42:56 +03:00
antoine
d8c5703e06 Merge remote-tracking branch
'github_troosan/fix_for_different_even_odd_headers' into develop

Conflicts:
	tests/PhpWord/SettingsTest.php
	tests/PhpWord/Writer/Word2007/Part/SettingsTest.php
2017-01-29 14:54:08 +01:00
antoine
aef7a0ba76 add possibility to write w:evenAndOddHeaders in settings.xml 2017-01-29 14:34:19 +01:00
antoine
7c08dd595b Merge remote-tracking branch 'github_troosan/fix_image_loading_over_https' into develop 2017-01-29 13:47:59 +01:00
antoine
217fd6ecf1 fix image loading over https 2017-01-29 13:37:43 +01:00
antoine
517c432ee6 fix image loading over https 2017-01-29 13:16:54 +01:00
antoine
91f79d85cf Merge branch 'show_hide_spelling_grammatical_errors' into develop 2017-01-28 12:04:51 +01:00
antoine
d23409f687 Add possibility to show/hide spelling and grammatical errors 2017-01-28 11:39:43 +01:00
sergeizelenyi
8b960c79d5 stylization code 2017-01-23 16:43:56 +03:00
sergeizelenyi
1ab93e7e8a added functionality specified alias and tag 2017-01-23 16:15:33 +03:00
antoine
8d7775552c Merge remote-tracking branch 'github_troosan/paper_size_computation' into develop 2017-01-22 15:16:16 +01:00
antoine
fc3bc29a02 fix default page size 2017-01-22 11:09:44 +01:00
antoine
da60645be3 Merge remote-tracking branch 'github_troosan/paper_size_computation' into develop 2017-01-21 19:29:14 +01:00
antoine
b6a9f7c9b3 fix paper size and add tests for Paper class 2017-01-21 19:06:49 +01:00
antoine
38a4e79c3c Merge branch 'image_from_string' into develop 2016-12-14 22:41:28 +01:00
Stéphane Mourey
1a1b362f40 Update Paragraph.php 2016-12-13 21:51:44 +01:00
Progi1984
6da9d8a0bf Merge pull request #928 from likeuntomurphy/develop
Fixes PHPOffice/PHPWord#927
2016-12-13 16:56:57 +01:00
Progi1984
c4c35ddb63 Merge pull request #937 from troosan/image_from_string
add support for Image creation from string image data
2016-12-13 09:32:25 +01:00
antoine
204f0c32ec update documentation 2016-12-12 20:39:10 +01:00
antoine
51c6b5fc38 add support for Image creation from string image data 2016-11-08 23:40:10 +01:00
antoine
a070628225 Merge remote-tracking branch 'origin/develop' into develop 2016-11-08 23:33:50 +01:00
antoine
46eebe2136 add support for Image creation from string image data 2016-11-08 23:22:22 +01:00
Progi1984
60e7f53945 Merge pull request #935 from liangtaohy/patch-1
Update MsDoc.php
2016-11-08 13:51:36 +01:00
liangtaohy
3f9ab94812 Update MsDoc.php
fix style\font not found bug
2016-11-08 18:32:22 +08:00
Jonathan Cox
000e36acfe Fixes PHPOffice/PHPWord#927 2016-10-28 20:06:03 -04:00
antoine
1c0444646e Merge branch 'fix_font_style_based_on' into develop 2016-10-28 23:30:11 +02:00
antoine
c50e3c581a replace tab with spaces 2016-10-28 23:28:05 +02:00
antoine
18474c56c4 replace tab with spaces 2016-10-28 23:27:24 +02:00
antoine
2216bc6130 Merge branch 'fix_font_style_based_on' into develop 2016-10-28 23:15:05 +02:00
antoine
8318b412e9 Merge remote-tracking branch 'github_troosan/support_for_xe_and_index_field' into develop 2016-10-28 23:14:34 +02:00
antoine
77ed1565c3 make FontStyle based on paragraph if it set 2016-10-28 22:40:44 +02:00
antoine
e7229fc15c make FontStyle based on paragraph if it set 2016-10-28 22:27:05 +02:00
antoine
0953065b8c improve code coverage 2016-10-28 00:20:47 +02:00
antoine
d52d9b8985 Add support for XE and INDEX fields 2016-10-27 23:12:26 +02:00
Stéphane Mourey
23e19a2d47 Fix division by zero
See #886
2016-09-12 16:43:21 +02:00
Brandon Skrtich
49492b2516 Fix incorrect image size between windows and mac.
See Issue #224
2016-08-26 11:06:19 -06:00
Progi1984
c71069022e Merge pull request #821 from brutto/patch-1
Add info about Invalid image
2016-08-23 10:24:27 +02:00
Michael Spahn
98d2e0df33 Implement PageBreak for odt writer 2016-08-16 17:10:51 +02:00
Roman Syroeshko
0a3f873972 Updated change log. 2016-07-31 12:53:39 +04:00
Roman Syroeshko
31cc01a3d1 Updated change log. 2016-07-31 12:51:09 +04:00
Roman Syroeshko
4486e2befb Updated change log. 2016-07-31 12:50:01 +04:00
Roman Syroeshko
2bcfacfbf9 Updated copyright. 2016-07-31 12:35:08 +04:00
Roman Syroeshko
1827eab20c Removed deprecated code. 2016-07-30 22:41:31 +04:00
Roman Syroeshko
7817524b31 https://github.com/PHPOffice/PHPWord/issues/399. 2016-07-30 22:33:24 +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
ale rimoldi
133b727f59 table->setStretch() optionally avoids the table to stretch to the page width (only for word output) 2016-07-25 10:11:52 +02:00
Roman Syroeshko
7deb010318 Fixed formatting. 2016-07-08 23:43:12 +04:00
Roman Syroeshko
e2ea1eec7c Fixed tests. 2016-07-08 23:21:38 +04:00
Roman Syroeshko
3f1e0ac4a7 #483. Output escaping for RTF. 2016-07-08 22:56:59 +04:00
Roman Syroeshko
649da97a42 Fixed build. 2016-06-28 21:50:02 +04:00
Roman Syroeshko
4c7e1399fe #483. Output escaping for HTML. 2016-06-28 21:37:36 +04:00
Anton Karakulov
0652302423 add info about Invalid image
if there are many images in document are used and one of them throws `InvalidImageException` it is very difficult to detect which one without any message here...
2016-06-19 15:27:01 +03: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
Phil Betley
c6fff318f3 Merge remote-tracking branch 'refs/remotes/PHPOffice/develop' into develop 2016-06-15 12:31:38 -04:00
Roman Syroeshko
508d6194fc Fixed build. 2016-06-13 20:31:33 +04:00
Roman Syroeshko
ebbb3a525e #483. Output escaping for ODF. 2016-06-13 20:14:54 +04:00
Roman Syroeshko
a2d307936d Fixed build. 2016-06-04 20:56:06 +04:00
Roman Syroeshko
a07dc6cdf0 #483. Output escaping for OOXML. 2016-06-04 20:21:54 +04:00
Roman Syroeshko
ec3c62b051 #483. Output escaping for OOXML. 2016-06-04 20:06:37 +04:00
Progi1984
4954f28012 Merge pull request #807 from githubjeka/patch-1
Update Sample_09_Tables.php
2016-05-30 14:21:29 +02:00
Evgeniy Tkachenko
d3f3a4a172 Update Sample_09_Tables.php 2016-05-30 12:36:24 +03:00
Progi1984
38ca52ead1 Merge pull request #804 from githubjeka/patch-1
Update Sample_09_Tables.php
2016-05-26 09:56:39 +02:00
Evgeniy Tkachenko
d9627e19fd Update Sample_09_Tables.php 2016-05-25 14:36:57 +03:00
Progi1984
023977a885 Merge pull request #803 from githubjeka/patch-1
Update DOC: Added note about direction of text inside a cell
2016-05-24 10:05:55 +02:00
Evgeniy Tkachenko
40984dcc88 Update DOC: Add note about direction of text inside cell 2016-05-24 08:57:24 +03:00
Roman Syroeshko
d57973693d #618. 2016-04-23 19:49:10 +04:00
Sam Sullivan
f4ec74a4c5 imagesavealpha() in Element\Image 2016-04-11 12:49:18 -05:00
Sam Sullivan
adfcc62e64 imagesavealpha() in Writer\AbstractWriter 2016-04-11 12:48:43 -05:00
Roman Syroeshko
1c5bb3a911 #548. 2016-04-09 22:03:21 +04:00
Roman Syroeshko
28f801b5d0 #704. 2016-02-23 19:02:35 +04:00
Denis Solovyov
0857f36572 Add TextRun as container for CheckBox 2016-02-12 17:37:44 +02:00
Roman Syroeshko
16495a0a0d Reviewed and merged #612. 2016-02-06 22:48:37 +04:00
Roman Syroeshko
53a53695ff Reviewed and merged #612. 2016-02-06 22:14:29 +04:00
Gareth Ellis
d2daa5a48c Update changelog 2016-02-04 14:14:53 +00:00
Gareth Ellis
17521e7593 PHPCS fixes 2016-02-04 14:06:47 +00:00
Gareth Ellis
3c3eecd4da PHPCS fixes 2016-02-04 14:06:11 +00:00
Gareth Ellis
a68634c3f1 Properly fixing #257 and helps out on #324 2016-02-04 13:40:16 +00:00
Roman Syroeshko
995dc68706 Improved coverage for \PhpOffice\PhpWord\Element\Section (#665). 2016-01-23 22:19:06 +04:00
Roman Syroeshko
8bc236460a Improved coverage for \PhpOffice\PhpWord\Element\Section (#665). 2016-01-23 22:10:13 +04:00
Roman Syroeshko
a621447993 Improved coverage for \PhpOffice\PhpWord\Element\Section (#665). 2016-01-23 21:35:04 +04:00
Roman Syroeshko
ea4388def5 Improved coverage for \PhpOffice\PhpWord\Element\Section (#665). 2016-01-23 21:06:09 +04:00
Roman Syroeshko
3981e01489 Add PHP 7.0 into the build script. 2016-01-23 19:25:59 +04:00
Roman Syroeshko
f359825cb7 Reviewed and merged #658. 2016-01-23 19:16:34 +04:00
Roman Syroeshko
5781f659b1 #617. 2015-12-12 21:53:27 +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
9f0b437e60 Copyright update. 2015-12-05 21:30:02 +04:00
Roman Syroeshko
7bd6cbdb64 Copyright update. 2015-12-05 21:28:46 +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
Roman Syroeshko
e6d73d8ff8 Removed custom autoloader. 2015-11-21 20:24:49 +04:00
Roman Syroeshko
95c097106f Reorganized unit tests. 2015-11-15 21:34:36 +04:00
Roman Syroeshko
c75056f076 Reorganized unit tests. 2015-11-15 21:22:29 +04:00
Roman Syroeshko
ef3c3b8a9d Reorganized unit tests. 2015-11-15 13:33:05 +04:00
Roman Syroeshko
c75bbf16a7 Merge branch 'master' into develop
Conflicts:
	CHANGELOG.md
	VERSION
	samples/Sample_12_HeaderFooter.php
	tests/PhpWord/Tests/Element/PreserveTextTest.php
2015-11-14 22:18:57 +04:00
Roman Syroeshko
e771b473a6 Added backward compatibility for deprecated alignment options. 2015-11-14 18:13:51 +04:00
Roman Syroeshko
e24fec7966 Added backward compatibility for deprecated alignment options. 2015-11-14 17:34:30 +04:00
Roman Syroeshko
4ebd668d7a Added backward compatibility for deprecated alignment options. 2015-11-14 17:32:32 +04:00
Roman Syroeshko
e3c88526b9 Added backward compatibility for deprecated alignment options. 2015-11-14 17:30:22 +04:00
Roman Syroeshko
f884527af1 Added backward compatibility for deprecated alignment options. 2015-11-14 17:24:36 +04:00
Roman Syroeshko
015a34f5cb Added backward compatibility for deprecated alignment options. 2015-11-14 16:50:52 +04:00
Roman Syroeshko
3965f110ff Added backward compatibility for deprecated alignment options. 2015-11-14 15:57:15 +04:00
Roman Syroeshko
d74c0bd878 Added backward compatibility for deprecated alignment options. 2015-11-14 15:31:50 +04:00
Henri MEDOT
f7afdebb03 Added support for linebreaks <br /> in Shared\Html::addHtml() 2015-11-12 18:51:04 +01:00
Roman Syroeshko
d3908deff8 Updated change log due to the changes previously committed. 2015-10-23 20:37:20 +04:00
Roman Syroeshko
09e5e352a9 Changed init value of the NumberingLevel.alignment property. 2015-10-21 21:44:10 +04:00
Roman Syroeshko
12823a5fbf Fixed build. 2015-10-10 19:32:53 +04:00
Roman Syroeshko
505cc76406 Fixed build. 2015-10-10 19:22:19 +04:00
Roman Syroeshko
94c0d02330 Next round of refactoring of alignment-related functionality. 2015-10-10 19:06:23 +04: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
3a58c818bd Released v0.12.1. 2015-08-30 18:44:55 +04:00
Roman Syroeshko
38cb04d322 Merge pull request #605 from PHPOffice/hotfix-0.12.1
Hotfix 0.12.1
2015-08-30 17:30:44 +03:00
Roman Syroeshko
e6671d6416 Releasing 0.12.1 today. 2015-08-30 18:19:24 +04:00
Roman Syroeshko
3d78ee70b7 Merged #513. 2015-08-30 18:15:16 +04:00
Roman Syroeshko
adf20d318f #513. 2015-08-30 18:03:31 +04:00
Roman Syroeshko
48a88f9cba Fixed build. 2015-08-16 22:55:40 +04:00
Roman Syroeshko
4238154034 Fixed build. 2015-08-16 22:54:35 +04:00
Roman Syroeshko
2a62b3ac43 Fixed build. 2015-08-16 22:36:28 +04:00
Roman Syroeshko
757b49b5a8 Merged `TemplateProcessorTest`. 2015-08-16 21:13:15 +04:00
Roman Syroeshko
310991bf26 Updated changelog. 2015-08-16 20:50:42 +04:00
Roman Syroeshko
3a5009517a Merged changelog. 2015-08-16 20:38:01 +04:00
Roman Syroeshko
9be25449e1 Merged #498. 2015-08-16 20:27:05 +04:00
Roman Syroeshko
8dc276a0db Merged #513. 2015-08-16 20:20:13 +04:00
Roman Syroeshko
7c371e1d08 Merged #532. 2015-08-16 19:53:03 +04:00
Roman Syroeshko
90295fe09c #532. 2015-08-16 19:50:47 +04:00
Roman Syroeshko
5a22f574b5 Next version is 0.12.1. 2015-08-16 19:23:27 +04:00
Roman Syroeshko
3a799ad771 Merged Travis CI config. 2015-08-16 19:17:19 +04:00
Roman Syroeshko
ecc3c5f96f Removed `composer.lock`. 2015-08-16 19:16:32 +04:00
Roman Syroeshko
e351717f3e Merged #495. 2015-08-16 19:13:14 +04:00
Roman Syroeshko
eff9ca22cb Next version is 0.12.1. 2015-08-16 19:05:08 +04:00
Roman Syroeshko
75b479fa23 Removed redundant *.md documentation. 2015-08-08 22:12:13 +04:00
Russ
d11b2467aa Fix Empty Dropdown Entry
Pad any empty dropdown entries we find so that xmlWriter doesn't
generate an error.
2015-08-06 15:57:18 -05:00
Russ
a9398e32c7 Fix Hour Casing for Intended Formats to Work Correctly
Time formats should either be "h" or "HH".  There were some formats
which were incorrectly specified as "H".
2015-08-06 13:22:01 -05:00
Russ
cb034879b4 Add Date Formats to Field Element
Fix a typo (d-M-yyy H:mm), and expand the list of valid date formats.
2015-08-06 12:50:31 -05:00
Sebastian Schwaiger
13a1c9f24f A chart object can also be added to a table cell 2015-07-29 11:16:04 +02:00
Russ
e929610746 Map Underline Codes to Corrected Constant Values 2015-07-22 09:01:01 -05:00
Russ
304765162e #574 Incorrect Constant Names in \Style\Font.php
Correct constants mapped to "dotDash" and "dotDashHeavy", leaving old spellings for backwards compatibility.
2015-07-22 08:57:15 -05:00
Frank Meyer
a6528471c2 changed if statement due to error in codesniffer 2015-07-21 15:11:34 +02:00
Frank Meyer
3a251770e8 Removed complains of php-codesniffer
removed whitespace
changed inline if statement
2015-07-21 14:56:29 +02:00
Frank Meyer
62d3f97e30 dded the ability to enable gridlines and axislabels on charts
added options 'showAxisLabels', 'showGridX', 'showGridY' to charts style element
2015-07-21 14:07:23 +02:00
Roman Syroeshko
cd2e7f7347 Playing with Travis CI. 2015-07-04 12:07:40 +04:00
Roman Syroeshko
b0ff13c075 Playing with Travis CI. 2015-07-02 22:40:06 +03:00
Roman Syroeshko
c1cfd503a5 Playing with Travis CI. 2015-07-02 22:30:48 +03:00
Roman Syroeshko
637c2bce79 Playing with Travis CI. 2015-07-02 22:24:12 +03:00
Roman Syroeshko
07e0d4cd6d Fix for #532. 2015-07-02 21:52:05 +03:00
Roman Syroeshko
db8221d303 Fix for #532. 2015-07-02 21:46:29 +03:00
Roman Syroeshko
988eaca87e Fix for #532. 2015-07-02 21:39:54 +03:00
Roman Syroeshko
7a2125c7e9 .travis.yml cleanup. 2015-06-23 21:34:31 +04:00
Roman Syroeshko
1b56db21dc .travis.yml cleanup. 2015-06-23 21:23:51 +04:00
Roman Syroeshko
858ab18919 .travis.yml cleanup. 2015-06-23 21:12:14 +04:00
Roman Syroeshko
26b0eaca2a .travis.yml clanup. 2015-06-23 21:03:04 +04:00
Roman Syroeshko
1383cefec6 Performance improvement for #513. 2015-06-02 22:18:07 +03:00
Roman Syroeshko
1cd4fbf5ae Performance improvement for #513. 2015-06-02 22:15:58 +03:00
Roman Syroeshko
7fdc50b6b8 Changed Gitter badge to the Shields version. 2015-05-26 22:23:19 +04:00
Roman Syroeshko
4212c7e32a Added Gitter badge. 2015-05-26 21:58:52 +04:00
ejuhjav
daf7d11144 Update elements.rst
Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle)
2015-05-20 13:17:11 +02:00
Roman Syroeshko
9770f44877 Shortened names of `TemplateProcessor` properties. 2015-04-15 00:12:37 +03:00
Roman Syroeshko
6ef9ac222c Merge remote-tracking branch 'origin/develop' into develop
Conflicts:
	CHANGELOG.md
2015-04-14 23:43:41 +03:00
Roman Syroeshko
fef4a367fe Implementation for #371. 2015-04-14 23:41:11 +03:00
Roman Syroeshko
d5e276ac62 Reimplemented #498. 2015-04-14 22:56:39 +03:00
Roman Syroeshko
b7387be3fd Reimplemented #498. 2015-04-14 22:47:41 +03:00
Roman Syroeshko
a5c3645717 Performance improvement for #513. 2015-04-11 21:41:58 +04:00
Roman Syroeshko
520a7a8bc6 Performance improvement for #513. 2015-04-11 21:26:46 +04:00
Roman Syroeshko
f33abcdcc4 Performance improvement for #513. 2015-04-11 21:25:40 +04:00
Roman Syroeshko
75022c5526 #495. 2015-03-22 12:12:32 +04:00
Roman Syroeshko
8e9f86564d Removed typo. 2015-03-22 11:54:46 +04:00
Roman Syroeshko
a38ec77afe #495. 2015-03-22 11:53:35 +04:00
Roman Syroeshko
0198aec0d1 #495. 2015-03-22 11:49:16 +04:00
Roman Syroeshko
f2cd42fecf #495. 2015-03-22 11:40:14 +04:00
Roman Syroeshko
18c54623b0 Fixed broken paragraph alignment for OpenXml. 2015-03-01 21:13:03 +04:00
Roman Syroeshko
17ee9e1bf8 Fixed broken paragraph alignment for OpenXml. 2015-03-01 21:02:49 +04:00
Roman Syroeshko
cb6ad0e9d3 Fixed broken paragraph alignment for OpenXml. 2015-02-21 20:11:57 +04:00
Roman Syroeshko
e0dea8e95c Fixed broken paragraph alignment for OpenXml. 2015-02-21 18:51:12 +04:00
Roman Syroeshko
fbdd5f15bb Minor refactoring. 2015-02-21 18:47:10 +04:00
Roman Syroeshko
25a5ba2b4c Minor refactoring. 2015-02-21 18:44:56 +04:00
Roman Syroeshko
2c040d2d33 Minor refactoring. 2015-02-21 18:41:15 +04:00
Roman Syroeshko
f902549614 Minor refactoring. 2015-02-21 18:34:36 +04:00
Roman Syroeshko
4eefb60362 #51 (updated tests, refactored a little). 2015-02-21 18:30:00 +04:00
Roman Syroeshko
cc305bcb11 Fixed broken paragraph alignment for OpenXml. 2015-02-21 17:43:46 +04:00
fergusean
00adf6de81 Skip inquiring PHP for temp directory when it's user defined 2015-02-13 00:12:13 -05:00
Roman Syroeshko
8bb4573534 #51 (updated tests, refactored a little). 2015-02-06 22:48:45 +04:00
Roman Syroeshko
2a5c66784b #51 (updated tests, refactored a little). 2015-02-06 22:28:31 +04:00
Progi1984
3f136501b3 Merge pull request #460 from PHPOffice/develop
v0.12.0
2015-01-03 10:42:48 +01:00
Progi1984
2b9111f8e9 Update CHANGELOG.md 2015-01-03 10:25:04 +01:00
Roman Syroeshko
81be513200 Changelog minor refactoring. 2015-01-01 21:10:31 +04:00
Roman Syroeshko
5d8a49949e Changelog minor refactoring. 2015-01-01 20:52:04 +04:00
Roman Syroeshko
5285f0034d #51 (updated changelog). 2015-01-01 20:46:30 +04:00
Roman Syroeshko
c116afbd02 #51 (updated samples). 2015-01-01 20:41:42 +04:00
Progi1984
d4d498d698 Merge pull request #458 from h6w/develop
Report enumerated style options available when style unknown.
2014-12-29 08:35:42 +01:00
h6w
7d2c0a6937 Update CHANGELOG.md 2014-12-29 18:20:39 +11:00
h6w
474f8ef2f7 Update AbstractStyle.php 2014-12-29 18:16:05 +11:00
h6w
277c2fb3e4 Merge pull request #1 from PHPOffice/develop
Develop update from upstream
2014-12-29 18:02:51 +11:00
Roman Syroeshko
c44bd37566 Minor refactoring. 2014-12-17 22:02:56 +04:00
Roman Syroeshko
42b878ec1d [CHANGED] "Sample_Header.php" (changed date default timezone to UTC). 2014-12-17 21:56:32 +04:00
Roman Syroeshko
20c4232454 [CHANGED] "Sample_Header.php" (added @return annotations where missed). 2014-12-17 21:53:32 +04:00
Roman Syroeshko
42c0b70a60 Replaced "phpversion()" function call with "PHP_VERSION" constant usage. 2014-12-17 21:47:06 +04:00
Roman Syroeshko
fbfde2e0ee #441 (added @since annotation). 2014-12-17 21:39:19 +04:00
Progi1984
56cd78440d UPDATED : travis.yml for support of PHP 5.3 2014-12-11 23:08:44 +01:00
Progi1984
6490b7e60d UPDATED : composer.lock 2014-12-11 22:33:55 +01:00
Progi1984
2cd4eeb5cf Merge branch 'chc88-master' into develop 2014-12-10 19:56:21 +01:00
Progi1984
9b58606696 Merge PR #441 2014-12-10 19:56:04 +01:00
Progi1984
2176232910 Merge PR #441 2014-12-10 19:55:07 +01:00
chc88
d330e57018 Update PageBreak.php
Update pdf-generation; check if we're generating a pdf
2014-12-10 15:49:40 +01:00
chc88
9e36c29a64 Update pdf-generation
Add new-page function for PDF generation. For multiple PDF-backends - @chc88 GH-426
2014-12-10 15:47:12 +01:00
Roman Syroeshko
41983e01f3 Merge pull request #356 from GMTA/develop 2014-12-09 21:52:17 +04:00
Roman Syroeshko
fa7f2cdc25 https://github.com/PHPOffice/PHPWord/issues/51 2014-12-09 21:46:19 +04:00
Roman Syroeshko
2cb124f5b1 https://github.com/PHPOffice/PHPWord/issues/51 2014-12-09 21:35:26 +04:00
Roman Syroeshko
f8ee230495 [FIXED] Typo. 2014-12-04 22:12:16 +04:00
Roman Syroeshko
455a4c4f29 #438 2014-12-04 21:58:51 +04:00
Progi1984
a15573b420 Merge pull request #438 from franzholz/patch-2
Update Table.php: Always close th as th
2014-12-03 17:06:17 +01:00
Franz Holzinger
ca664a53d7 Update Table.php
You must not open a <th> and close it as a </td>.
read http://www.w3schools.com/tags/tag_th.asp
2014-12-03 17:01:27 +01:00
Roman Syroeshko
8dcbc92df6 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 16:12:57 +04:00
Roman Syroeshko
b4d31cafd9 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 16:08:35 +04:00
Roman Syroeshko
d1993a4ab7 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 13:35:18 +04:00
Roman Syroeshko
07cec9c66a [CHANGED] "intro.rst". 2014-11-23 13:31:27 +04:00
Roman Syroeshko
b8ee099d96 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 13:22:34 +04:00
Roman Syroeshko
9a6c224e47 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 13:09:33 +04:00
Roman Syroeshko
41f6aec45f [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 13:07:30 +04:00
Roman Syroeshko
4a0da83f28 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 12:59:52 +04:00
Roman Syroeshko
beeaf89fd6 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 12:51:10 +04:00
Roman Syroeshko
34e6f50609 [CHANGED] "README.md". Added notice required about input escaping. 2014-11-23 12:48:23 +04:00
Roman Syroeshko
7b11002989 [CHANGED] "README.md". 2014-11-23 12:38:18 +04:00
Roman Syroeshko
f18e51a19f [CHANGED] "CONTRIBUTING.md". 2014-11-14 22:13:58 +04:00
chc88
37ca009769 Extend HTML output for pagebreaks for PDF generation
Make HTML output of pagebreak compatible for the different PDF writers by combining:
http://mpdf1.com/manual/index.php?tid=110 (tested and working)
and
https://code.google.com/p/dompdf/wiki/FAQ (tested and working)
and
http://chandeshparekh.com/css-to-create-new-page-in-php-tcpdf-pdf/
2014-11-14 17:26:23 +01:00
Roman Syroeshko
e7fdb7f50d Reverted #51. 2014-11-07 20:56:58 +04:00
Roman Syroeshko
c0e04fac51 Reverted #51. 2014-11-07 20:54:24 +04:00
Roman Syroeshko
f4b5eaaa29 [FIXED] https://github.com/PHPOffice/PHPWord/issues/401 2014-11-04 14:05:11 +04:00
Roman Syroeshko
89e722e6a1 [CHANGED] "CONTRIBUTING.md". 2014-11-03 20:00:38 +04:00
Roman Syroeshko
3a11daaded [CHANGED] "CONTRIBUTING.md". 2014-11-03 19:59:33 +04:00
Roman Syroeshko
53eaf47309 [CHANGED] "CONTRIBUTING.md". 2014-11-03 19:56:54 +04:00
Roman Syroeshko
b4be9c65bd https://github.com/PHPOffice/PHPWord/issues/310 2014-11-03 19:40:43 +04:00
Roman Syroeshko
b2286f8545 [FIXED] https://github.com/PHPOffice/PHPWord/issues/401 2014-10-22 19:53:50 +04:00
Progi1984
6784fb2531 Merge pull request #400 from pjt33/develop
Correct spelling of fldCharType separate
2014-10-20 11:41:40 +02:00
pjt33
b1acecb255 Correct spelling of fldCharType separate. See http://www.ecma-international.org/news/TC45_current_work/OfficeOpenXML-XMLSchema.zip , file wml.xsd, line 3977. 2014-10-20 11:27:57 +02:00
Roman Syroeshko
7b2ec5e85e Reverted #373. 2014-10-16 21:04:59 +04:00
Progi1984
d231641680 Update Documentation 2014-10-15 22:13:38 +02:00
Roman Syroeshko
fa575ef12c Minor refactoring. 2014-10-14 21:33:04 +04:00
Roman Syroeshko
06d6b715a3 [CHANGED] "tests/bootstrap.php". 2014-10-14 21:06:47 +04:00
Roman Syroeshko
2c81d5f38b Some phpdoc for https://github.com/PHPOffice/PHPWord/pull/390. 2014-10-10 21:20:52 +04:00
Roman Syroeshko
4445fd3258 Replaced array_key_exists with isset for better performance. 2014-10-10 21:10:29 +04:00
Progi1984
9d73173dce Merge pull request #390 from spikex/develop
Add missing setters for pageSizeW and pageSizeH
2014-10-03 09:15:58 +02:00
Spike Ilacqua
112712012e Update Changelog for setPageSizeW and setPageSizeH 2014-10-02 11:06:14 -06:00
Spike Ilacqua
cea15f3d23 Use page width and height default constants in tests 2014-10-02 10:50:50 -06:00
Spike Ilacqua
cf5625b643 Update pageSizeW and pageSizeH docs
Conflicts:
	docs/containers.rst
2014-10-02 10:48:15 -06:00
Spike Ilacqua
cf96ea0e18 Width/Height set/get tests 2014-10-02 10:44:46 -06:00
Spike Ilacqua
4e25283195 Add missing setters for pageSizeW and pageSizeH 2014-10-02 10:44:34 -06:00
Progi1984
5e68fd9bbd Merge pull request #389 from PHPOffice/revert-379-master
Revert "Add missing setters for pageSizeW and pageSizeH"
2014-10-02 17:21:27 +02:00
Progi1984
8ebe3b3738 Revert "Add missing setters for pageSizeW and pageSizeH" 2014-10-02 17:21:17 +02:00
Progi1984
1a783d1cbd Merge pull request #379 from spikex/master
Add missing setters for pageSizeW and pageSizeH
2014-10-02 17:21:07 +02:00
Spike Ilacqua
ecaeb96376 Update pageSizeW and pageSizeH docs 2014-10-02 09:04:45 -06:00
Spike Ilacqua
e5a3d01835 Width/Height set/get tests 2014-10-02 08:33:53 -06:00
Progi1984
439f013e09 Merge pull request #386 from PHPOffice/revert-385-patch-1
Revert "Fix page break sample code block"
2014-09-29 17:01:50 +02:00
Progi1984
57c3235365 Revert "Fix page break sample code block" 2014-09-29 17:01:43 +02:00
Progi1984
d39ba21a98 Merge pull request #385 from jaggyspaghetti/patch-1
Fix page break sample code block
2014-09-29 17:01:35 +02:00
Jaggy Gauran
7869912348 Fix page break sample code block 2014-09-29 03:07:54 +08:00
Spike Ilacqua
0a8635ece8 Add missing setters for pageSizeW and pageSizeH 2014-09-22 16:58:00 -06:00
Progi1984
6c3088ea07 Merge pull request #378 from franzholz/patch-4
Update Head.php
2014-09-22 16:11:57 +02:00
Progi1984
556a8b52c3 Merge pull request #377 from franzholz/patch-3
Update installing.rst
2014-09-22 16:11:27 +02:00
Franz Holzinger
27b0c69fd4 Update Head.php
The generated HTML and PDF tables are missing the border lines. Sample_07_TemplateCloneRow.docx shows the lines around the table and the table cells. However the generated HTML and PDF file are missing those lines. This patch fixes this issue.
2014-09-22 15:46:55 +02:00
Franz Holzinger
c8b6499332 Update installing.rst
Add the missing info how to setup Composer to fetch the latest Develop branch instead of the outdated Master branch.
2014-09-22 14:51:21 +02:00
Progi1984
b49f08bd91 Merge pull request #376 from franzholz/patch-3
Update CONTRIBUTING.md
2014-09-21 10:56:51 +02:00
Franz Holzinger
891278632e Update CONTRIBUTING.md
I have added a link to an important video. Without this video I was not able to synchronise my Fork with the Develop branch.
2014-09-20 19:21:36 +02:00
Progi1984
dbe160d794 Merge pull request #374 from franzholz/patch-3
Update installing.rst
2014-09-18 14:26:51 +02:00
Franz Holzinger
24d8cc7e64 Update installing.rst
Show the way how to install PHPWord using Git.
2014-09-18 09:39:27 +02:00
Roman Syroeshko
68422efcf9 Merge pull request #373 from franzholz/patch-3
Update CONTRIBUTING.md
2014-09-17 20:47:46 +04:00
Franz Holzinger
5cdf329919 Update CONTRIBUTING.md
The PHPUnit tests run into error messages if PHPWord has not been installed by Composer.
2014-09-16 21:59:14 +02:00
Progi1984
5b11071d4a Merge pull request #366 from franzholz/patch-1
Update CONTRIBUTING.md
2014-09-11 09:14:27 +02:00
Franz Holzinger
941d2c7a58 Update CONTRIBUTING.md 2014-09-10 17:05:38 +02:00
Roman Syroeshko
5adbae4f29 Merge pull request #356 from GMTA/develop 2014-09-07 19:07:39 +04:00
Roman Syroeshko
fdbd983d14 Merge pull request #356 from GMTA/develop
Set the right method name for addShape() for AbstractContainer
2014-09-07 18:52:29 +04:00
Roman Syroeshko
5811aac272 Merge pull request #302 from basjan/absolute-positioning 2014-09-07 18:21:24 +04:00
Roman Syroeshko
42955f17dd Merge pull request #302 from basjan/absolute-positioning 2014-09-07 18:19:10 +04:00
Roman Syroeshko
c4cbabeb36 Merge pull request #302 from basjan/absolute-positioning
For absolute positioning vPos and hPos need to be set to POS_ABSOLUTE
2014-09-07 18:01:53 +04:00
Jelle Raaijmakers
9b3b1aa7a0 Set the right method name for addShape() in PHPDoc @method for AbstractContainer. 2014-08-31 00:06:00 +02:00
Roman Syroeshko
d11b0deaf9 [FIXED] https://github.com/PHPOffice/PHPWord/issues/340 2014-08-23 20:25:41 +04:00
Roman Syroeshko
9757fbb033 [FIXED] https://github.com/PHPOffice/PHPWord/issues/340 2014-08-23 20:19:48 +04:00
Progi1984
48322ca89c Merge pull request #339 from franzholz/patch-2
Update CONTRIBUTING.md
2014-08-18 21:26:40 +02:00
Franz Holzinger
62c799172e Update CONTRIBUTING.md
misspelling
2014-08-18 20:36:13 +02:00
Roman Syroeshko
bf0136c156 https://github.com/PHPOffice/PHPWord/issues/216 2014-08-16 15:46:38 +04:00
Progi1984
d66e8559e6 #23 : Implement Word97 aka MsDoc Reader (Documentation ) 2014-08-16 13:28:27 +02:00
Progi1984
8da62eb7b2 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop 2014-08-16 13:25:58 +02:00
Progi1984
0151a21c0f #23 : Implement Word97 aka MsDoc Reader (Documentation ) 2014-08-16 13:25:38 +02:00
Roman Syroeshko
5a75d84f8f Merge remote-tracking branch 'origin/develop' into develop 2014-08-16 15:22:35 +04:00
Roman Syroeshko
ec25dd338b https://github.com/PHPOffice/PHPWord/issues/216 2014-08-16 15:21:58 +04:00
Progi1984
1a40f66a71 #23 : Implement Word97 aka MsDoc Reader (Changelog) 2014-08-16 13:10:39 +02:00
Progi1984
90d64bd347 #23 : Implement Word97 aka MsDoc Reader (PHPCS-PHPMD Fixes) 2014-08-16 12:44:12 +02:00
Progi1984
4ade9c3c6e #23 : Implement Word97 aka MsDoc Reader (PHPCS-PHPMD Fixes) 2014-08-16 12:33:37 +02:00
Progi1984
e561d54661 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into develop 2014-08-16 11:55:13 +02:00
Progi1984
ca69de3962 #23 : Implement Word97 aka MsDoc Reader 2014-08-15 19:26:23 +02:00
Progi1984
8d9e85b2ba #331 : Word2007 Writer : Support for RTL 2014-08-12 13:32:05 +02:00
Roman Syroeshko
6f2d444ba9 https://github.com/PHPOffice/PHPWord/issues/310 2014-08-11 22:30:46 +04:00
Roman Syroeshko
3d06c77fc1 Minor refactoring of "Shared\ZipArchive" class. 2014-08-10 21:01:46 +04:00
Roman Syroeshko
e31f080ea6 Removed unused comment. 2014-08-10 20:46:10 +04:00
Roman Syroeshko
e6d88a27e8 Refactored usages of "tempnam()" function. 2014-08-10 20:30:14 +04:00
Roman Syroeshko
56c3d8eda2 https://github.com/PHPOffice/PHPWord/issues/310 2014-08-10 20:00:19 +04:00
Progi1984
f25833c60d #327 : Fixes PHP-MD errors
@link : https://travis-ci.org/PHPOffice/PHPWord/jobs/31598319#L539
2014-08-04 11:17:05 +02:00
Progi1984
06005e335d Update CHANGELOG.md 2014-08-04 10:50:51 +02:00
Progi1984
9c66921a60 Merge pull request #327 from pscheit/bugfix-margin-border-develop
bugfix: specific borders were not written correctly in word2007
2014-08-04 10:50:11 +02:00
Philipp Scheit
07e03fc955 bugfix: specific borders were not written correctly in word2007 2014-08-04 10:40:36 +02:00
Progi1984
61406af166 FIXED : #292 : Update elements.rst 2014-07-09 08:51:18 +02:00
Progi1984
a23ff4de2f Merge pull request #305 from jonnsn/internal-links
Internal links
2014-07-06 22:12:21 +02:00
jogo
7202634573 fix wrong formatting 2014-07-04 15:54:20 +02:00
jogo
6c9cffd83b updated documentation for link-Element.
added documentation for bookmark-Element.
2014-07-04 15:40:48 +02:00
jogo
7c8ff2884b add sample
fix undefined Index
2014-07-04 15:31:48 +02:00
Roman Syroeshko
197c6ec0b3 [FIXED] Wrong use of passing by reference. 2014-07-04 16:52:39 +04:00
Roman Syroeshko
7bbe1ed620 [FIXED] Wrong use of passing by reference. 2014-07-04 16:49:01 +04:00
Roman Syroeshko
c4638df0d6 [FIXED] Wrong use of passing by reference. 2014-07-04 16:35:13 +04:00
Roman Syroeshko
fd209fc999 [FIXED] Wrong use of passing by reference. 2014-07-04 16:20:18 +04:00
jogo
87c3df5536 add missing file
apply formatting to CGL
2014-07-04 14:10:20 +02:00
Roman Syroeshko
f2c4329108 [FIXED] Wrong use of passing by reference. 2014-07-04 16:00:17 +04:00
jogo
4d060b3f07 sync with develop-branch 2014-07-04 13:32:47 +02:00
jogo
475c76dd79 convert tabs to spaces 2014-07-04 13:30:07 +02:00
jogo
fdeefb77d9 include minor changes from develop branch 2014-07-04 13:24:14 +02:00
jogo
d54a674b97 add element bookmark and allow links to internal bookmarks in Word2007 2014-07-04 13:07:08 +02:00
Roman Syroeshko
1b9b8d4f90 [FIXED] Wrong use of passing by reference. 2014-07-04 14:44:22 +04:00
Roman Syroeshko
47a17a33e8 Revert: [FIXED] Wrong use of passing by reference. 2014-07-04 13:02:28 +04:00
Roman Syroeshko
f2e9e3716b [FIXED] Wrong use of passing by reference. 2014-07-04 13:00:52 +04:00
Roman Syroeshko
2c5d13c88e [FIXED] Typo in Section->addHeaderFooter(). 2014-07-04 12:25:53 +04:00
Roman Syroeshko
4a02142d63 [FIXED] Wrong use of passing by reference. 2014-07-04 12:13:11 +04:00
Roman Syroeshko
8056b6926c [CHANGED] Docblock for pass-by-reference parameters. 2014-07-03 16:11:15 +04:00
Roman Syroeshko
d0a609bc95 [CHANGED] Added "@return" annotation where it as missed. 2014-07-03 15:40:24 +04:00
Roman Syroeshko
20d986b11d [CHANGED] Documentation on Zip API providers. 2014-07-03 11:44:10 +04:00
Bas-Jan 't Jong
52406daee1 For absolute positioning vPos and hPos need to be set to POS_ABSOLUTE 2014-07-02 22:13:54 +02:00
Roman Syroeshko
e1164f8989 [Changed] Refactored Template a little. 2014-07-02 17:49:53 +04:00
Roman Syroeshko
c446028acc [Changed] Refactored Template a little. 2014-07-02 17:44:26 +04:00
Roman Syroeshko
75c8e7e816 [NEW] Introduced CopyFileException. 2014-07-02 17:21:43 +04:00
Roman Syroeshko
369f55a71f [NEW] Introduced CreateTemporaryFileException. 2014-07-02 13:17:13 +04:00
Roman Syroeshko
dbc9737136 [NEW] Introduced CreateTemporaryFileException. 2014-07-02 12:58:55 +04:00
Roman Syroeshko
ea826ec0ce [NEW] Introduced CreateTemporaryFileException. 2014-07-02 12:49:18 +04:00
Roman Syroeshko
3c694ea572 [NEW] Introduced CreateTemporaryFileException. 2014-07-02 12:42:50 +04:00
Ivan Lanin
d8aef5c502 Bugfix #294: add<elementName> of container should be case insensitive 2014-07-01 09:52:24 +07:00
Ivan Lanin
40e41342ce Fix PHPCS 2014-06-29 21:14:10 +07:00
Ivan Lanin
415d9b95c4 Update tests 2014-06-29 14:10:49 +07:00
Ivan Lanin
33570f7cd4 #294: Support for paragraph with borders 2014-06-28 22:59:00 +07:00
Ivan Lanin
689a7371cd Fix Travis errors 2014-06-28 12:01:53 +07:00
Ivan Lanin
2d351c9522 Merge branch 'sdt' into develop 2014-06-28 11:49:11 +07:00
Ivan Lanin
b5a63c5b55 Elaborate SDT elements 2014-06-28 11:47:29 +07:00
Progi1984
a5c857f749 #289 : Update elements.rst 2014-06-24 10:36:58 +02:00
Progi1984
d8fbac6407 Merge pull request #289 from chrissharkman/patch-1
Update elements.rst
2014-06-24 10:30:46 +02:00
chrissharkman
f8389c5d35 Update elements.rst
it's not perfect, but better than nothing.
2014-06-24 09:27:18 +02:00
Ivan Lanin
b2daeed6cb Merge branch 'develop' into sdt 2014-06-24 00:15:39 +07:00
Ivan Lanin
6e175abfcd Revert phpunit to 3.7.* because 4.* is too slow sebastianbergmann/phpunit#1300 2014-06-22 12:26:32 +07:00
Ivan Lanin
ea6ec473d2 Update composer dependencies 2014-06-22 10:22:40 +07:00
Ivan Lanin
8efe80b5c1 QA: Use Composer for Travis test tools 2014-06-22 09:27:10 +07:00
Ivan Lanin
5be8414ef8 Settings: OOXML compatibility 2014-06-21 20:45:30 +07:00
Progi1984
df8de962a9 #23 : Implement Word97 aka MsDoc Reader 2014-06-21 09:21:30 +02:00
Progi1984
b527d06608 #23 : Implement Word97 aka MsDoc Reader 2014-06-21 09:18:57 +02:00
Ivan Lanin
cd547927ea New structured document tag (SDT) element 2014-06-21 02:06:49 +07:00
Roman Syroeshko
0ea2193906 [CHANGED] Replaced "assertEquals" with "assertCount" where it was necessary. 2014-06-20 09:34:49 +04:00
Roman Syroeshko
d35db836dc [CHANGED] Added annotations to StyleTest and performed minor refactoring. 2014-06-20 09:00:12 +04:00
Roman Syroeshko
c11df2e426 [CHANGED] Added annotations to StyleTest and performed minor refactoring. 2014-06-19 12:04:07 +04:00
Roman Syroeshko
eeca396704 [CHANGED] Added annotations to StyleTest and performed minor refactoring. 2014-06-19 11:59:57 +04:00
Progi1984
f193534058 FIXED : CI : Error with the generation of the PHPDoc
Deprecated: phpDocumentor2 should be run from the phpdoc file, not phpdoc.php in /home/travis/build/PHPOffice/PHPWord/vendor/phpdocumentor/phpdocumentor/bin/phpdoc.php on line 13

Refs : 395af1d42a/bin/phpdoc.php
2014-06-17 16:08:28 +02:00
Progi1984
71b4ac9c56 FIXED : #282 : problem converting docx to pdf
PHP Catchable fatal error: Argument 2 passed to DOMXPath::query() must be an instance of DOMNode, null given, called in /var/www/xxx/PhpWord/Reader/Word2007.php on line 145 and defined in /var/www/xxx/PhpWord/Shared/XMLReader.php on line 99, referer: XXX
2014-06-17 15:48:39 +02:00
Ivan Lanin
5c8e100d41 Bugfix #280: Table inside vertical border does not rendered properly 2014-06-16 16:23:41 +07:00
Ivan Lanin
384107e7cf Ability to define document protection and new Metadata subnamespace 2014-06-16 11:58:05 +07:00
Ivan Lanin
6a81691d45 #266: Ability to add textinput, checkbox, and dropdown form elements 2014-06-16 00:31:17 +07:00
Ivan Lanin
a13e5b20f9 #278: 3D charts and ability to set width and height 2014-06-15 20:48:26 +07:00
Ivan Lanin
0f085f71e0 Merge branch 'chart' into develop 2014-06-14 12:51:41 +07:00
Ivan Lanin
3fef19093c #278: Basic chart 2014-06-14 12:49:39 +07:00
Ivan Lanin
8c2b099dbc Merge Shared\Drawing and Shared\Font into Shared\Converter 2014-06-14 10:54:33 +07:00
Ivan Lanin
9a5f91afc6 Merge branch 'develop' into chart 2014-06-12 12:17:49 +07:00
Ivan Lanin
e9f8e889f8 #275: Recipe for adding a link within a title 2014-06-12 02:41:49 +07:00
Ivan Lanin
f54d9a1eb4 #274: Page breaks on titles and tables 2014-06-12 02:32:00 +07:00
Ivan Lanin
a93b686ca3 Chart improvements 2014-06-11 23:04:13 +07:00
Ivan Lanin
056ff5e676 Basic chart support 2014-06-11 02:03:04 +07:00
Ivan Lanin
8e93c91bb0 Update changelog for #270 2014-06-11 00:57:52 +07:00
Brandon Skrtich
d17a806305 Small fixes for addHtml.
Adding some HTML Entities to the test for addHTML
2014-06-09 16:32:12 -06:00
Ivan Lanin
4c04071fd5 Fix typo: ODT > ODText 2014-06-09 18:52:06 +07:00
Ivan Lanin
1ec0589c55 Update basic example 2014-06-08 22:38:50 +07:00
Ivan Lanin
6839ee41dd New PhpWord::save() method to encapsulate IOFactory 2014-06-08 22:05:50 +07:00
Ivan Lanin
e952fdefb5 Refactor PhpWord to reduce dependencies 2014-06-08 19:37:08 +07:00
Ivan Lanin
3197524343 Docs: Restructure documentation 2014-06-08 17:10:02 +07:00
Ivan Lanin
63d53ac910 Use section "style" instead of "settings" for consistency 2014-06-08 16:44:46 +07:00
Ivan Lanin
a9c9c21d3b Fix Travis test error 2014-06-08 03:38:53 +07:00
Ivan Lanin
893843969f Refactor elements to move set relation Id from container to element 2014-06-08 03:00:53 +07:00
Ivan Lanin
01853f7aac Update change log and adjust some coding standards for #261, #265, and #267 2014-06-07 17:52:48 +07:00
Ivan Lanin
0489533c5f Merge branch 'develop' of github.com:bskrtich/PHPWord into develop 2014-06-07 17:36:59 +07:00
Ivan Lanin
bc6b40dde5 Merge branch 'fix-rare-pclzip-temp-file-issue' of github.com:andrew-kzoo/PHPWord into develop 2014-06-07 17:36:37 +07:00
Ivan Lanin
7bbaab30b9 Merge branch 'fix-rare-pclzip-realpath-php-version-issue' of github.com:andrew-kzoo/PHPWord into develop 2014-06-07 17:33:58 +07:00
Brandon Skrtich
8b0472dd52 Autoloader Options
Add the ability to set the autoloader options.
2014-06-06 13:34:01 -06:00
Ivan Lanin
09a143fe71 QA: Type check fix for RTF section style and docblock comment fix for AbstractContainer 2014-06-06 18:56:09 +07:00
Ivan Lanin
a2ec62a79f Section: Ability to set paper size, e.g. A4, A3, and Legal 2014-06-06 18:31:01 +07:00
Ivan Lanin
49f4e6ba64 RTF Writer: Support for sections, margins, and borders #249 2014-06-06 12:53:01 +07:00
Andrew Collins
3d2cd163d3 Ensure temp file in pclzipAddFile() removed
Make pclzipAddFile() similar to pclzipAddFromString() in removing
temporary files.
2014-06-05 13:45:18 -04:00
Ivan Lanin
d97602fa98 Reduce duplications and fix some docblocks 2014-06-05 23:47:39 +07:00
Ivan Lanin
479713da55 Update changelog and unit test for #264 2014-06-05 22:41:58 +07:00
Ivan Lanin
00c6b76d68 Merge branch 'feature-paragraphBgColor' of github.com:lrobert/PHPWord-1 into develop 2014-06-05 22:28:44 +07:00
lrobert
f44ff4b7a6 Added shading to the paragraph style for full width shading 2014-06-05 10:47:53 -04:00
Ivan Lanin
1accec2ff0 Refactor styles: Inherit Image and Line from Frame 2014-06-05 15:48:58 +07:00
Ivan Lanin
2328e34e64 Refactor Word2007/Element to identify the same properties 2014-06-05 08:13:54 +07:00
Andrew Collins
d57606082d Fix rare PclZip/realpath/PHP version problem
In PHP 5.4.4 realpath() handles absolute paths correctly, but in PHP 5.3.8 returns false.
2014-06-04 13:27:18 -04:00
Ivan Lanin
a2294b4b1e Font: New scale, spacing, and kerning property of font style 2014-06-04 23:28:08 +07:00
Ivan Lanin
9c8620ecd7 Refactor IOFactory to remove duplication 2014-06-02 23:47:44 +07:00
Ivan Lanin
70302211f0 Merge remote-tracking branch 'upstream/develop' into develop 2014-06-02 23:34:04 +07:00
Ivan Lanin
e3dd4494f3 #238: Known issue about read/write permission on temp folder 2014-06-02 23:33:10 +07:00
Ivan Lanin
420cf2bce3 Merge pull request #258 from ivanlanin/develop
New drawing shapes (arc, curve, line, polyline, rect, oval) for #123
2014-06-02 22:58:19 +07:00
Ivan Lanin
61d8dbde49 QA: Small fixes for #258 based on Scrutinizer https://scrutinizer-ci.com/g/PHPOffice/PHPWord/inspections/54c74458-884d-4299-aed1-a7d2eb6a5654 2014-06-02 22:57:11 +07:00
Ivan Lanin
a66f93ccdc #123: New drawing shapes (arc, curve, line, polyline, rect, oval) 2014-06-02 21:55:44 +07:00
Ivan Lanin
b38dd82c87 Merge branch 'master' into develop 2014-06-02 18:35:02 +07:00
Ivan Lanin
38d3d7be20 Bugfix for #257: HTML Reader: <p> and header tags puts no output 2014-06-02 18:30:51 +07:00
Ivan Lanin
4dd85e28c6 Version and changelog for 0.12.0 2014-06-01 22:32:20 +07:00
Progi1984
39cf5d0b4a Merge pull request #256 from PHPOffice/develop
PR 0.11.0
2014-06-01 16:45:09 +02:00
Ivan Lanin
ce21e8d9e8 PR 0.11.0 #225 2014-06-01 21:00:02 +07:00
Ivan Lanin
e0d2c6584c Refactor IOFactory and AbstractContainer to allow more dynamic inclusion. 2014-06-01 01:08:06 +07:00
Ivan Lanin
9839222492 QA: Additional unit tests 2014-05-31 22:28:13 +07:00
Ivan Lanin
269def4b9d Merge remote-tracking branch 'upstream/develop' into develop 2014-05-31 13:37:00 +07:00
Ivan Lanin
2205377259 #245: Basic table support in RTF writer 2014-05-31 13:33:38 +07:00
Ivan Lanin
e7540c079e Add $nestedLevel to elements 2014-05-31 09:29:09 +07:00
Ivan Lanin
4fdc7b8e6e Merge pull request #254 from ivanlanin/develop
Basic HTML Reader
2014-05-31 06:20:01 +07:00
Ivan Lanin
022cdeb570 Documentation updates and test fix for #254 2014-05-31 03:28:58 +07:00
Ivan Lanin
ec85d7d641 #80: Basic HTML reader 2014-05-31 03:06:11 +07:00
Ivan Lanin
0164e37873 Decompose Shared\Html 2014-05-31 02:01:09 +07:00
Ivan Lanin
4f9399899a QA: Docblock improvements and -q parameter for phpdoc 2014-05-30 20:44:06 +07:00
Ivan Lanin
900a96addf Bugfix for #236 (OpenOffice crash when opening DOCX) and paragraph style refactoring 2014-05-30 19:59:57 +07:00
Ivan Lanin
d3ac5b1fa1 Merge branch '#193' into develop 2014-05-30 13:19:51 +07:00
Ivan Lanin
5c2c687efd #193: Heading numbering 2014-05-30 13:19:10 +07:00
Ivan Lanin
a57b28de8f Some adjustments for the new Line element #253 2014-05-30 01:05:55 +07:00
Bas-Jan 't Jong
748e16473d Final try to resolve Travis build errors 2014-05-29 18:07:01 +02:00
Bas-Jan 't Jong
0103787873 Second attempt to resolve Travis build errors 2014-05-29 17:44:14 +02:00
Bas-Jan 't Jong
54af93a20a Fixed some Travis build errors 2014-05-29 17:11:54 +02:00
Bas-Jan 't Jong
1580113d7b Added Line element 2014-05-29 16:44:00 +02:00
Ivan Lanin
0fcea8209f Merge pull request #252 from ivanlanin/rtf
Passed Travis. Merged.
2014-05-29 18:32:00 +07:00
Ivan Lanin
4bb3ffe5bd Apply #250 fix a minor typo in the text styles example 2014-05-29 18:13:57 +07:00
Ivan Lanin
7a42802b48 RTF reader: Unit tests and some improvements 2014-05-29 18:02:49 +07:00
Ivan Lanin
7c2ad59530 Merge branch 'develop' into rtf 2014-05-29 16:54:13 +07:00
Ivan Lanin
e81d92e265 Update changelog, docs, and unit tests for new Field element #251 2014-05-29 16:25:39 +07:00
Ivan Lanin
2d88ea22b4 RTF Reader: Split control parsers into functions 2014-05-29 15:09:02 +07:00
Bas-Jan 't Jong
8f74f26fd4 Travis build error fix 2014-05-28 20:35:24 +02:00
Bas-Jan 't Jong
079d08e94a Added Field Element 2014-05-28 17:59:44 +02:00
Bas-Jan 't Jong
9e99080777 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord.git into develop 2014-05-28 17:37:48 +02:00
Ivan Lanin
f9a1f34dcb Merge branch 'rtfreader' into rtf 2014-05-28 21:36:30 +07:00
Ivan Lanin
086ac9d363 Merge remote-tracking branch 'upstream/develop' into develop 2014-05-28 21:30:14 +07:00
Ivan Lanin
87f071d1b6 #72: Basic RTF Reader 2014-05-28 21:27:20 +07:00
Progi1984
8c7efde9be Merge pull request #250 from zacharyrankin/master
Fix a minor typo in the text styles example
2014-05-28 08:51:29 +02:00
Progi1984
eb32ff2e15 #244 : Fix typo in recipe sample 2014-05-28 08:50:09 +02:00
Zachary Rankin
8ab6f64add Fix a minor typo in the text styles example 2014-05-27 22:05:34 -07:00
Ivan Lanin
88f6518406 Init VERSION and improve requirement checking 2014-05-28 07:42:50 +07:00
Bas-Jan 't Jong
3085445081 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord.git into develop 2014-05-26 21:25:07 +02:00
Ivan Lanin
d7f3d25b2a #248 More flexible checking for float value 2014-05-27 01:08:54 +07:00
Ivan Lanin
d9a2c4c3ca Bugfix #248: Image: marginLeft and marginTop cannot accept float value 2014-05-27 00:46:18 +07:00
Bas-Jan 't Jong
36080c14ca Merge branch 'develop' of https://github.com/PHPOffice/PHPWord.git into develop 2014-05-25 22:57:01 +02:00
Ivan Lanin
92c7a24c38 QA: Additional unit tests and docblock fixes 2014-05-25 23:08:02 +07:00
Ivan Lanin
dc6c487cd0 Fix test error 2014-05-25 00:43:38 +07:00
Ivan Lanin
1e9a498ca2 QA: Reduce some complexities: https://scrutinizer-ci.com/g/PHPOffice/PHPWord/code-structure/develop?elementType=operation 2014-05-24 15:38:41 +07:00
Ivan Lanin
5ff47f44e9 QA: Misc. bugfixes and docblock improvements 2014-05-24 11:11:12 +07:00
Ivan Lanin
e24c16f14b Merge remote-tracking branch 'upstream/master' into develop 2014-05-24 10:59:01 +07:00
Ivan Lanin
248d82d3c3 Add two recipes 2014-05-24 10:53:09 +07:00
Ivan Lanin
f1eded7b33 Merge branch 'master' into develop 2014-05-24 10:40:54 +07:00
Ivan Lanin
991016a48b Additional writer test 2014-05-24 10:05:39 +07:00
Ivan Lanin
a65c3c3cf1 RTF Writer: Ability to write image 2014-05-23 19:22:40 +07:00
Ivan Lanin
e00b551aa2 Breakdown HTML Writer to head and body parts and more cyclomatic complexity reductions 2014-05-23 16:48:11 +07:00
Ivan Lanin
d79ca9ae31 Reduce cyclomatic complexity on DocumentProperties and Word2007 Document Writer. 2014-05-23 10:19:57 +07:00
Ivan Lanin
6351792140 Merge remote-tracking branch 'upstream/develop' into develop 2014-05-23 09:07:32 +07:00
Ivan Lanin
045cc87d2d Merge branch 'rtf' into develop 2014-05-23 09:06:15 +07:00
Ivan Lanin
e46fecffdd RTF Writer: Ability to write document properties 2014-05-23 09:05:10 +07:00
Roman Syroeshko
571e0841d4 [CHANGED] License has been split into two files as recommended here http://www.gnu.org/licenses/gpl-howto.en.html. 2014-05-22 21:43:19 +04:00
Roman Syroeshko
73bdd4f5a3 [CHANGED] License has been split into two files as recommended here http://www.gnu.org/licenses/gpl-howto.en.html. 2014-05-22 21:39:14 +04:00
Roman Syroeshko
23047c0bf7 [CHANGED] License has been split into two files as recommended here http://www.gnu.org/licenses/gpl-howto.en.html. 2014-05-22 20:49:56 +04:00
Roman Syroeshko
71a1db8650 [CHANGED] License has been split into two files as recommended here http://www.gnu.org/licenses/gpl-howto.en.html. 2014-05-22 20:36:16 +04:00
Ivan Lanin
2086e9e262 Refactor: Reduce cyclomatic complexity 2014-05-22 22:01:21 +07:00
Ivan Lanin
fbce1c8fc9 #244: Enable "image float left" 2014-05-22 00:37:50 +07:00
Progi1984
86369ad89b Merge pull request #247 from ivanlanin/master
PR 0.10.1
2014-05-21 19:13:01 +02:00
Ivan Lanin
3e0d37ec94 Update changelog 2014-05-22 00:05:12 +07:00
Brandon Skrtich
4e190b10cf Update composer requirements for php-zip
With PCLZip support added php-zip isn't a requirement any more.
2014-05-21 10:35:40 -06:00
Ivan Lanin
d764de018c Additional unit tests and @since documentation 2014-05-21 22:36:00 +07:00
Ivan Lanin
3569271277 Word2007 Writer: Enable the missing custom document properties writer 2014-05-21 19:20:13 +07:00
Bas-Jan 't Jong
343f378782 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord.git into develop 2014-05-20 22:29:26 +02:00
Bas-Jan 't Jong
5aac7f4782 From upstream 2014-05-20 22:28:34 +02:00
Ivan Lanin
5188b36f22 Merge remote-tracking branch 'upstream/develop' into develop 2014-05-21 00:29:39 +07:00
Ivan Lanin
e6931fa3ae Merge pull request #242 from bskrtich/develop
Update composer requirements for php-zip.
2014-05-21 00:27:59 +07:00
Ivan Lanin
721c5825a6 Small fixes for the last commit 2014-05-21 00:26:43 +07:00
Brandon Skrtich
197151002f Update composer requirements for php-zip. With PCLZip support added this isn't a requirement any more. 2014-05-20 11:04:14 -06:00
Ivan Lanin
61c6d51e5e Refactor Word2007 reader 2014-05-21 00:00:19 +07:00
Ivan Lanin
f536bd6fbd Merge branch 'develop' into reader 2014-05-20 23:25:56 +07:00
Ivan Lanin
ac23e90ef4 ODT Reader: Ability to read standard and custom document properties 2014-05-20 18:00:00 +07:00
Ivan Lanin
930d8de462 ODT Writer: Enable title element and custom document properties 2014-05-20 14:53:02 +07:00
Ivan Lanin
69a3a0f4f2 Refactor reader 2014-05-20 11:27:28 +07:00
Ivan Lanin
0360f8e290 Unit tests for TCPDF and mPDF 2014-05-19 23:21:17 +07:00
Ivan Lanin
f7bee23f65 Add TCPDF and mPDF as optional PDF renderer library 2014-05-19 18:06:42 +07:00
Ivan Lanin
553371f088 Type hinting and docblock update 2014-05-19 14:27:55 +07:00
Ivan Lanin
32f1f62b45 Change Settings constants 2014-05-18 23:10:10 +07:00
Ivan Lanin
d64fc98a51 Merge branch 'zip' into develop 2014-05-18 22:56:45 +07:00
Ivan Lanin
5c8bab8ce3 Fix Travis test 2014-05-18 22:38:14 +07:00
Ivan Lanin
39d4e8ee54 Bugfix #150: Page break adds new line in the beginning of the new page 2014-05-18 22:23:28 +07:00
Ivan Lanin
7d9bcd46d4 ODT: New Image and Table style writer 2014-05-18 21:15:35 +07:00
Ivan Lanin
b1e16e4386 Word2007: Reformat fonttable and theme parts 2014-05-18 17:49:47 +07:00
Ivan Lanin
970c6a24eb Bug fixes for last commit 2014-05-18 16:48:15 +07:00
Ivan Lanin
410ce4bffe ODT: Enable section and column 2014-05-18 16:29:56 +07:00
Ivan Lanin
b91e3209fa Refactor ODT writer to give enable some additional features 2014-05-18 14:43:11 +07:00
Ivan Lanin
f825ef50c0 Reorder code 2014-05-18 02:21:26 +07:00
Ivan Lanin
0a8c3d6cc2 Deactivate ZipArchive::close test 2014-05-18 01:48:14 +07:00
Ivan Lanin
3f61d1807c Test fixes 2014-05-18 00:40:29 +07:00
Ivan Lanin
5519131f3e Unify PHP ZipArchive and PCLZip features into PhpWord ZipArchive 2014-05-17 23:30:13 +07:00
Ivan Lanin
710e147668 Merge pull request #240 from ivanlanin/config
Close #200
2014-05-17 01:46:44 +07:00
Ivan Lanin
1c7e327694 Small change to test the new gh-pages branch 2014-05-16 16:55:14 +07:00
Ivan Lanin
7c12dfc735 Fixes for last commit 2014-05-16 16:00:40 +07:00
Ivan Lanin
048436cd04 Use INI instead of YML 2014-05-16 15:02:57 +07:00
Ivan Lanin
f380c29eef Add writeRaw annotation and disambiguate Settings 2014-05-16 01:22:34 +07:00
Ivan Lanin
5511378eca #200: Ability to use a config file to store various common settings 2014-05-16 00:59:38 +07:00
Ivan Lanin
f1b2243e15 Short tag fix 2014-05-15 15:52:17 +07:00
Ivan Lanin
4d9e4062c3 QA: Scrutinizer dedup 2014-05-15 14:41:08 +07:00
Ivan Lanin
1c3735fc08 Refactor table and font styles to reduce duplication 2014-05-15 11:46:28 +07:00
Ivan Lanin
abbf60a3be Increase minimum mass for php_sim and some test fixes 2014-05-15 10:24:20 +07:00
Ivan Lanin
27fa3ba233 Remove fontStyle parameter from ListItemRun and various small fixes 2014-05-15 01:13:22 +07:00
Ivan Lanin
e40b377fc8 Remove PHP 5.3.3 and 5.6 from Travis allowed failures and update composer.lock file. 2014-05-14 20:36:15 +07:00
Ivan Lanin
4edf8ed9b4 Fix unit tests 2014-05-14 20:18:35 +07:00
Ivan Lanin
f9123d2f2e Merge branch 'cleanup' into develop 2014-05-14 19:48:52 +07:00
Ivan Lanin
04a62f3255 QA: Code cleanup and some additional tests 2014-05-14 19:41:44 +07:00
Progi1984
e94e2738e3 QA : PHP CodeSniffer (PEAR to Composer) 2014-05-14 13:40:30 +02:00
Progi1984
7b673af176 QA : PHP CodeSniffer (PEAR to Composer) 2014-05-14 13:39:06 +02:00
Ivan Lanin
6ba6ed40fc Reactivate php_sim in Scrutinizer and fix some minor issues 2014-05-14 08:40:21 +07:00
Ivan Lanin
e03e121e85 #196: RTF link styling fixes 2014-05-14 00:42:05 +07:00
Ivan Lanin
1ee43da4de #196: RTF link styling 2014-05-13 23:41:16 +07:00
Ivan Lanin
7ae8c3cb81 Refactoring: Word2007 table and marginborder style writer 2014-05-13 14:57:04 +07:00
Ivan Lanin
8745c5ee30 Change behaviour of set... function of boolean properties; Some bug fixing based on Scrutinizer; New Row Word2007 style writer 2014-05-13 12:50:18 +07:00
Ivan Lanin
4b1a16006d #196: Ability to add links and page breaks in RTF 2014-05-13 02:48:44 +07:00
Ivan Lanin
f8f98cccab #237: Ability to define table width (in percent and twip) and position 2014-05-13 01:32:44 +07:00
Ivan Lanin
e589961e68 #158: Convert UTF8 text to Unicode before writing RTF (support UTF8 in RTF) 2014-05-12 23:12:07 +07:00
Ivan Lanin
55e715b5b1 Add variable type hints 2014-05-12 15:54:10 +07:00
Ivan Lanin
c9179d681f Refactor elements and containers 2014-05-12 01:36:28 +07:00
Ivan Lanin
c7e4ed0c18 Type check in element writers 2014-05-11 20:10:36 +07:00
Ivan Lanin
c243a11e57 Additional type checks in style writers 2014-05-11 19:06:36 +07:00
Ivan Lanin
7d5c62ab34 Merge branch 'nestedtable' into develop 2014-05-11 18:22:09 +07:00
Ivan Lanin
27d18fde98 Merge branch '#234-#235-basjan' into develop 2014-05-11 18:12:30 +07:00
Ivan Lanin
8c9e5116c4 Update changelog 2014-05-11 18:10:47 +07:00
Ivan Lanin
da77ba6a71 Merge branch 'ListItemRun' of github.com:basjan/PHPWord into #234-#235-basjan 2014-05-11 17:58:16 +07:00
Ivan Lanin
fc66030b82 Merge branch 'Fixed-conversion' of github.com:basjan/PHPWord into #234-#235-basjan 2014-05-11 17:57:01 +07:00
Ivan Lanin
ded651d947 #149: Ability to add table inside a cell (nested table) 2014-05-11 17:30:23 +07:00
Bas-Jan 't Jong
467f15a480 Added ListItemRun Element 2014-05-11 11:08:39 +02:00
Bas-Jan 't Jong
539a173dc2 Amended the corresponding test 2014-05-11 09:18:19 +02:00
Bas-Jan 't Jong
afc3d5cb64 Minor fix. If conversion factor from pointToPixel is 1.333333, then the
conversion factor for PixelTopoint should be 0.75
2014-05-11 09:16:36 +02:00
Ivan Lanin
17e2f02817 Type checks on style writers 2014-05-11 11:23:46 +07:00
Ivan Lanin
9567c6a972 Merge branch '#233-basjan' into develop 2014-05-11 10:41:26 +07:00
Ivan Lanin
967c8b273e Fix unit test for px2cm and cm2px conversion 2014-05-11 10:39:39 +07:00
Bas-Jan 't Jong
c524394f5f Fixed conversion factor Centimeters to Pixels and vice versa. 2014-05-10 23:52:10 +02:00
Ivan Lanin
516c13e032 Some unit tests for the new features 2014-05-10 23:40:34 +07:00
Ivan Lanin
9ea767ea91 Table inside textbox sample 2014-05-10 22:04:10 +07:00
Ivan Lanin
feff87e769 Fix Travis test errors 2014-05-10 21:56:06 +07:00
Ivan Lanin
c82f0ac1fc Merge branch '#231-basjan' into develop 2014-05-10 21:39:23 +07:00
Ivan Lanin
62ed725032 Some modifications for the new Html::addHtml feature 2014-05-10 21:38:44 +07:00
Ivan Lanin
a595e6d78c Merge branch 'AddHtml' of github.com:basjan/PHPWord 2014-05-10 20:13:33 +07:00
Bas-Jan 't Jong
07b4ae2c0f Added possiblity to add tables inside textbox 2014-05-10 14:04:15 +02:00
Bas-Jan 't Jong
aa151c4010 Added function to add elements via HTML 2014-05-10 14:03:16 +02:00
Ivan Lanin
530f8ee357 Writers refactoring fixes 2014-05-10 14:45:51 +07:00
Ivan Lanin
0b13b22e07 Refactor HTML & PDF writer with composite pattern 2014-05-10 14:23:22 +07:00
Ivan Lanin
8c9c0402d2 Merge branch '#229-basjan' into develop 2014-05-09 03:22:12 +07:00
Ivan Lanin
8457169047 Merge branch 'bug-textbox' of github.com:basjan/PHPWord 2014-05-09 03:19:18 +07:00
Ivan Lanin
246557e3be Reactivate PHPMD and fix some rules for textbox 2014-05-09 03:15:26 +07:00
Bas-Jan 't Jong
474d36040a Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'.
This is not the expected behaviour
2014-05-08 21:43:55 +02:00
Bas-Jan 't Jong
841bc2ac69 Revert "Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'. This is not the expected behaviour"
This reverts commit ade740b562793670155d2c081de97265410abdcc.
2014-05-08 21:41:30 +02:00
Bas-Jan 't Jong
ade740b562 Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'.
This is not the expected behaviour
2014-05-08 21:38:54 +02:00
Ivan Lanin
6f0579c78f Fix Travis build error 2014-05-09 00:34:08 +07:00
Ivan Lanin
8a1d07f71a Fix Travis test errors 2014-05-08 23:13:45 +07:00
Ivan Lanin
f7dd9dd07c Refactor writers and styles 2014-05-08 20:46:13 +07:00
Ivan Lanin
ea41b08a9a Refactor the new textbox element 2014-05-08 13:05:27 +07:00
Ivan Lanin
e12daacc0b Merge branch 'refactor' into develop 2014-05-08 12:17:14 +07:00
Ivan Lanin
e9c548ea17 Merge branch '#228-basjan-textbox' into develop 2014-05-08 11:43:00 +07:00
Ivan Lanin
6a0bfe3314 Move addTextBox to AbstractContainer and add sample for textbox 2014-05-08 10:58:19 +07:00
Ivan Lanin
c7a940cc4c Merge branch 'textbox' of github.com:basjan/PHPWord 2014-05-08 08:56:34 +07:00
Bas-Jan 't Jong
364131aa5d Added TextBox functionality 2014-05-07 21:27:51 +02:00
Ivan Lanin
88560de601 Refactor writers 2014-05-08 02:19:57 +07:00
Ivan Lanin
e0638f56bd Change Scrutinizer similarity analysis min mass 2014-05-07 01:44:51 +07:00
Ivan Lanin
51d69a44c6 Refactoring based on Scrutinizer recommendation 2014-05-07 01:11:56 +07:00
Ivan Lanin
0c1e47d7a7 Type checking 2014-05-06 23:37:14 +07:00
Ivan Lanin
c4e8fdac84 Refactoring for code quality improvement (based on Scrutinizer) 2014-05-06 22:08:39 +07:00
Ivan Lanin
1f5e58a317 Merge branch 'develop' of github.com:ivanlanin/PHPWord into develop 2014-05-06 21:22:48 +07:00
Ivan Lanin
c28f28ea25 Refactoring for code quality improvement (based on Scrutinizer) 2014-05-06 21:22:24 +07:00
Ivan Lanin
2ab5a42193 Split some functions for code quality improvement 2014-05-06 19:02:08 +07:00
Progi1984
b7374f8936 #186 : Add badges for license & stable version 2014-05-06 13:04:18 +02:00
Ivan Lanin
2432a853bf Show code quality and test code coverage badge on README 2014-05-06 17:48:10 +07:00
Ivan Lanin
232a30a1c4 Enable code coverage in Scrutinizer 2014-05-06 17:32:32 +07:00
Ivan Lanin
b3229c6a7b Fix Travis test and update Scrutinizer config 2014-05-06 17:13:16 +07:00
Ivan Lanin
37152cd459 Enable code coverage in Scrutinizer 2014-05-06 16:53:15 +07:00
Ivan Lanin
13c178d140 Refactor: Composite Word2007 & ODText writer parts 2014-05-06 16:38:16 +07:00
Ivan Lanin
5c6925334b Merge remote-tracking branch 'upstream/develop' into develop 2014-05-06 07:59:57 +07:00
Ivan Lanin
cb97979d57 Merge pull request #226 from basjan/image-test-unit
Thanks @basjan.
2014-05-06 07:58:11 +07:00
Bas-Jan 't Jong
15c38960f7 Improved Test Unit for Image Style in line with additions of #217 2014-05-05 23:38:31 +02:00
Ivan Lanin
4039304ba0 Word2007 Writer: Refactor writer parts using composite pattern 2014-05-06 01:45:13 +07:00
Ivan Lanin
704cc2fe04 Refactoring: Extends Endnotes from Footnotes & Heder from Footer 2014-05-05 23:30:15 +07:00
Ivan Lanin
b2a0e08db9 #154: Update documentation to include API docs and code coverage report 2014-05-05 22:31:29 +07:00
Ivan Lanin
febb9d072a Update changelog for #154 and #186 2014-05-05 20:21:56 +07:00
Ivan Lanin
061ba4bfb2 Including composer.lock to enable Scrutinizer test https://scrutinizer-ci.com/docs/tools/php/php-analyzer/guides/composer_dependencies 2014-05-05 19:26:21 +07:00
Ivan Lanin
5a2f4020fb QA: Additional unit testing and template scrutinizer config file 2014-05-05 18:57:54 +07:00
Roman Syroeshko
2add5541ce [CHANGED] https://github.com/PHPOffice/PHPWord/pull/179 - copyright notice has been added. 2014-05-05 13:06:53 +04:00
Roman Syroeshko
dcf8faed5b Merge remote-tracking branch 'origin/develop' into develop 2014-05-05 12:39:17 +04:00
Roman Syroeshko
89f94b793d [CHANGED] https://github.com/PHPOffice/PHPWord/pull/179 - copyright info has been changed. 2014-05-05 12:38:32 +04:00
Progi1984
ec0de298d9 #154 : Change template for PHPDocumentor 2014-05-05 10:35:21 +02:00
Progi1984
105e53b1cd #154 : Ignore PCLZip in PHPDocumentor 2014-05-05 09:49:15 +02:00
Roman Syroeshko
8c9890fe0d [FIXED] License in "composer.json". 2014-05-05 10:37:34 +04:00
Roman Syroeshko
4194dd46c0 [CHANGED] References to ISO/IEC 29500 spec were documented. 2014-05-05 10:18:08 +04:00
Roman Syroeshko
61b5f6800c [CHANGED] References to ISO/IEC 29500 spec were documented. 2014-05-05 10:14:33 +04:00
Ivan Lanin
6dd51c54ea Update changelog and add sample for bug fix #222 2014-05-05 09:08:15 +07:00
Ivan Lanin
d11376e387 Merge branch 'second-header-bug' of github.com:basjan/PHPWord into develop 2014-05-05 09:03:13 +07:00
Bas-Jan 't Jong
11b3941103 Fixed a bug, that when a second header was added to a section, all
images added to the second header were assigned to the first header,
resulting in at least a corrupted DOCX.
2014-05-04 22:48:17 +02:00
Bas-Jan 't Jong
aba15481c8 Corrected typo to 'const POSITION_HORIZONTAL_CENTER = 'center';' and
added examples to Sample_13
2014-05-04 22:34:37 +02:00
Ivan Lanin
ce85cc5497 Merge branch 'footer' of github.com:basjan/PHPWord into develop 2014-05-05 00:58:35 +07:00
Ivan Lanin
acd25a4db4 Merge pull request #220 from ivanlanin/nonstatic
Remove static classes #206; Reactivate PHPCPD and PHPMD
2014-05-05 00:46:53 +07:00
Ivan Lanin
fd4fa11390 Merge remote-tracking branch 'upstream/develop' into nonstatic 2014-05-05 00:26:02 +07:00
Roman Syroeshko
6c3d1e721d License version has been added. 2014-05-04 21:03:29 +04:00
Ivan Lanin
dd01ed1aaa Fix .travis.yml 2014-05-04 23:36:28 +07:00
Ivan Lanin
d1022a9e3c QA: PHPMD fixes for tests; Some adjustment for Travis build 2014-05-04 23:17:40 +07:00
Bas-Jan 't Jong
250562ddd6 Added firstPage function and evenPage function to bring Footer Element
in conformity with Header Element
2014-05-04 17:59:58 +02:00
Ivan Lanin
3d19256c9c Merge branch 'develop' into nonstatic 2014-05-04 22:30:06 +07:00
Ivan Lanin
4824985fac Merge branch '#217-basjan' into develop 2014-05-04 21:45:24 +07:00
Ivan Lanin
f7b454261f Merge remote-tracking branch 'upstream/develop' into develop 2014-05-04 21:44:12 +07:00
Ivan Lanin
42c712e334 Refactor new image styles and create Word2007/Style/Image class 2014-05-04 21:36:52 +07:00
Progi1984
06462fbac5 #154 : PHPDocumentor on GH-Pages 2014-05-04 16:00:37 +02:00
Progi1984
9aec52168f #154 : PHPDocumentor on GH-Pages 2014-05-04 13:46:31 +02:00
Progi1984
cbf0c07a74 #154 : PHPDocumentor on GH-Pages 2014-05-04 13:24:53 +02:00
Ivan Lanin
6898ada0e0 Merge branch 'develop' of github.com:basjan/PHPWord into #217-basjan 2014-05-04 18:16:33 +07:00
Ivan Lanin
2ae47e738b Merge branch 'develop' of github.com:PHPOffice/PHPWord into develop 2014-05-04 17:58:57 +07:00
Ivan Lanin
35d06cc2ce Change PHPWord license to LGPL 3 as per #211 2014-05-04 17:55:54 +07:00
Progi1984
de2b7d897c #154 : PHPDocumentor on GH-Pages 2014-05-04 12:34:35 +02:00
Progi1984
a5287ac705 #154 : PHPDocumentor on GH-Pages 2014-05-04 12:22:55 +02:00
Progi1984
a62a58afc3 #154 : PHPDocumentor on GH-Pages 2014-05-04 12:21:19 +02:00
Ivan Lanin
7c21e540b0 0.10 release date: 4 May 2014 2014-05-04 17:06:24 +07:00
Ivan Lanin
c21e28f974 More refactoring for PHPMD compliance 2014-05-04 16:57:39 +07:00
Bas-Jan 't Jong
1a544cb2fa Fixed bug in header / footer, in which media elements were all assigned
to the first header element. This resulted in a corrupted DOCX, when a
media element was assigned to a second header in the same section.
2014-05-04 10:36:13 +02:00
Bas-Jan 't Jong
15dcb384c6 Messed up something. Resetting 2014-05-04 10:34:40 +02:00
Bas-Jan 't Jong
2187954b56 Fixed bug in header, wherein all images were assigned to the first
header in a section. This resulted in a corrupt DOCX
2014-05-04 10:16:28 +02:00
Ivan Lanin
f6f52afa68 Fix Travis build error 2014-05-04 14:15:44 +07:00
Ivan Lanin
725162bc6b Deprecate static classes Footnotes, Endnotes, and TOC (#206); Reactivate phpcpd and phpmd on Travis 2014-05-04 03:40:54 +07:00
Bas-Jan 't Jong
9c11067720 Added Image relative and absolute positioning 2014-05-03 10:08:39 +02:00
652 changed files with 64391 additions and 25136 deletions

21
.gitattributes vendored Normal file
View File

@ -0,0 +1,21 @@
# build config
/.scrutinizer.yml export-ignore
/.github export-ignore
/php_cs.dist export-ignore
/phpmd.xml.dist export-ignore
/phpstan.neon export-ignore
/composer.lock export-ignore
# git files
/.gitignore export-ignore
/.gitattributes export-ignore
# project directories
/build export-ignore
/docs export-ignore
/samples export-ignore
# tests
/phpunit.xml.dist export-ignore
/tests export-ignore

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help improve PHPWord
labels: Bug Report
---
### Describe the Bug
A clear and concise description of what the bug is.
### Steps to Reproduce
Please provide a code sample that reproduces the issue.
```php
<?php
require __DIR__ . '/vendor/autoload.php';
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->...
```
### Expected Behavior
A clear and concise description of what you expected to happen.
### Current Behavior
What is the current behavior?
### Context
Please fill in your environment information:
- PHP Version:
- PHPWord Version:

View File

@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
labels: Change Request
---
### Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
### Additional context
Add any other context or screenshots about the feature request here.

14
.github/ISSUE_TEMPLATE/how-to-use.md vendored Normal file
View File

@ -0,0 +1,14 @@
---
name: How to Use PHPWord
about: Find out how to use PHPWord
labels: WontFix
---
***Please do not use the issue tracker to ask how to use PHPWord.***
Documentation is available on [Read the Docs](https://phpword.readthedocs.io/en/latest/).
Sample code is in the [`/samples/` directory](https://github.com/PHPOffice/PHPWord/tree/master/samples).
Usage questions belong on [Stack Overflow](https://stackoverflow.com/questions/tagged/phpword).

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,11 @@
### Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Fixes # (issue)
### Checklist:
- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
- [ ] I have updated the documentation to describe the changes

8
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
time: "11:00"
open-pull-requests-limit: 10

15
.github/support.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# Label used to mark issues as support requests
supportLabel: Question
# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
supportComment: >
This looks like a support question. Please ask your support questions on
[StackOverflow](http://stackoverflow.com/questions/tagged/phpword),
or [Gitter](https://gitter.im/PHPOffice/PHPWord).
Thank you for your contributions.
# Whether to close issues marked as support requests
close: true
# Whether to lock issues marked as support requests
lock: false

119
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,119 @@
name: CI
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
name: PHP ${{ matrix.php-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1
- name: Test with PHPUnit
run: ./vendor/bin/phpunit --no-coverage
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Code style with PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: pcov
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Coverage
run: |
./vendor/bin/phpunit --coverage-clover coverage-clover.xml
curl -LO https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml

29
.github/workflows/github-pages.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: GithHub Pages
on:
push:
tags:
- '*'
jobs:
github-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none # remove xdebug
- name: Build API documentation
run: |
curl -LO https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0/phpDocumentor.phar
php phpDocumentor.phar --directory src/ --target docs/api
- name: Deploy to GithHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/api

View File

@ -0,0 +1,8 @@
user=PHPOffice
project=PHPWord
since-tag=0.18.1
future-release=0.18.2
issues=false
pulls=true

21
.gitignore vendored
View File

@ -4,12 +4,21 @@
.Trashes
Thumbs.db
Desktop.ini
.idea
_build
/build
phpunit.xml
composer.lock
composer.phar
phpunit.xml
/.buildpath
/.idea
/.project
/.settings
vendor
/report
/build
/vendor
/samples/results
/.settings
phpword.ini
/.buildpath
/.scannerwork
/.project
/nbproject
/.php_cs.cache
/.phpunit.result.cache

227
.php-cs-fixer.dist.php Normal file
View File

@ -0,0 +1,227 @@
<?php
$finder = PhpCsFixer\Finder::create()
->notName('pclzip.lib.php')
->notName('OLERead.php')
->in('samples')
->in('src')
->in('tests');
$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setFinder($finder)
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
->setRules([
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => true,
'braces' => true,
'cast_spaces' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const
'class_definition' => false,
'class_keyword_remove' => false, // ::class keyword gives us better support in IDE
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'combine_nested_dirname' => true,
'comment_to_phpdoc' => false, // interferes with annotations
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'constant_case' => true,
'date_time_immutable' => false, // Break our unit tests
'declare_equal_normalize' => true,
'declare_strict_types' => false, // Too early to adopt strict types
'dir_constant' => true,
'doctrine_annotation_array_assignment' => true,
'doctrine_annotation_braces' => true,
'doctrine_annotation_indentation' => true,
'doctrine_annotation_spaces' => true,
'elseif' => true,
'encoding' => true,
'ereg_to_preg' => true,
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
'final_class' => false, // We need non-final classes
'final_internal_class' => true,
'final_public_method_for_abstract_class' => false, // We need non-final methods
'fopen_flag_order' => true,
'fopen_flags' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => true,
'function_declaration' => true,
'function_to_constant' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']],
'global_namespace_import' => true,
'header_comment' => false, // We don't use common header in all our files
'heredoc_indentation' => false, // Requires PHP >= 7.3
'heredoc_to_nowdoc' => false, // Not sure about this one
'implode_call' => true,
'include' => true,
'increment_style' => true,
'indentation_type' => true,
'is_null' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'logical_operators' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false, // No, too dangerous to change that
'method_argument_space' => true,
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
'native_constant_invocation' => false, // Micro optimization that look messy
'native_function_casing' => true,
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
'no_break_comment' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'echo_tag_syntax' => ['format' => 'long'],
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => false, // Might be risky on a huge code base
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
'not_operator_with_successor_space' => false, // idem
'nullable_type_declaration_for_default_null_value' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => false, // We prefer to keep some freedom
'ordered_imports' => true,
'ordered_interfaces' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_expectation' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_internal_class' => false, // Because tests are excluded from package
'php_unit_method_casing' => true,
'php_unit_mock' => true,
'php_unit_mock_short_will_return' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'phpdoc_order_by_value' => ['annotations' => ['covers']],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_size_class' => false, // That seems extra work to maintain for little benefits
'php_unit_strict' => false, // We sometime actually need assertEquals
'php_unit_test_annotation' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage
'phpdoc_add_missing_param_annotation' => false, // Don't add things that bring no value
'phpdoc_align' => false, // Waste of time
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
//'phpdoc_inline_tag' => true,
'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => false, // interferes with annotations
'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use
'phpdoc_to_return_type' => false, // idem
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => true,
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'psr_autoloading' => true,
'random_api_migration' => true,
'return_assignment' => false, // Sometimes useful for clarity or debug
'return_type_declaration' => true,
'self_accessor' => true,
'self_static_accessor' => true,
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => true,
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
'strict_comparison' => false, // No, too dangerous to change that
'strict_param' => false, // No, too dangerous to change that
'string_line_ending' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => ['elements' => ['property', 'method']], // not const
'void_return' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
]);
return $config;

35
.scrutinizer.yml Normal file
View File

@ -0,0 +1,35 @@
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]
environment:
php:
version: '7.4'
pecl_extensions:
- zip
filter:
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]
before_commands:
- "composer install --prefer-source --dev"
tools:
php_code_sniffer:
enabled: true
config:
standard: PSR2
php_mess_detector:
enabled: true
config:
ruleset: phpmd.xml.dist
external_code_coverage:
enabled: false
timeout: 1200
php_cpd: true
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
# min_mass: 40
php_pdepend: true
php_analyzer: true
sensiolabs_security_checker: true

View File

@ -1,50 +0,0 @@
language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
matrix:
allow_failures:
- php: 5.3.3
- php: 5.6
- php: hhvm
before_script:
## Composer
# - curl -s http://getcomposer.org/installer | php
# - php composer.phar install --prefer-source
- composer self-update
- composer require dompdf/dompdf:0.6.*
- composer install --prefer-source
## PHP_CodeSniffer
- pyrus install pear/PHP_CodeSniffer
- phpenv rehash
## PHP Copy/Paste Detector
#- curl -o phpcpd.phar https://phar.phpunit.de/phpcpd.phar
## PHP Mess Detector
#- pear config-set preferred_state beta
#- printf "\n" | pecl install imagick
#- pear channel-discover pear.phpmd.org
#- pear channel-discover pear.pdepend.org
#- pear install --alldeps phpmd/PHP_PMD
#- phpenv rehash
## PHPLOC
#- curl -o phploc.phar https://phar.phpunit.de/phploc.phar
script:
## PHP_CodeSniffer
- phpcs --standard=PSR2 -n src/ --ignore=src/PhpWord/Shared/PCLZip
- phpcs --standard=PSR2 -n tests/
## PHP Copy/Paste Detector
#- php phpcpd.phar --verbose src/
## PHP Mess Detector
#- phpmd src/ text unusedcode,naming,design
## PHPLOC
#- php phploc.phar src/
## PHPUnit
- phpunit -c ./ --coverage-text

View File

@ -1,58 +1,596 @@
# Changelog
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This is the changelog between releases of PHPWord. Releases are listed in reverse chronological order with the latest version listed on top, while additions/changes in each release are listed in chronological order. Changes in each release are divided into three parts: added or change features, bugfixes, and miscellaneous improvements. Each line contains short information about the change made, the person who made it, and the related issue number(s) in GitHub.
## [1.0.0](https://github.com/PHPOffice/PHPWord/tree/1.0.0) (2022-11-15)
## 0.10.0 - Not yet released
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.3...1.0.0)
### BREAKING CHANGE
Most deprecated things were dropped. See details in
https://github.com/PHPOffice/PHPWord/commit/b9f1151bc6f90c276153c3c9dca10a5fc7f355fb.
#### Dropped classes:
- `PhpOffice\PhpWord\Template`
#### Dropped constants:
- `PhpOffice\PhpWord\Style\Font::UNDERLINE_DOTHASH`
- `PhpOffice\PhpWord\Style\Font::UNDERLINE_DOTHASHHEAVY`
- `PhpOffice\PhpWord\Style\Cell::VALIGN_TOP`
- `PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER`
- `PhpOffice\PhpWord\Style\Cell::VALIGN_BOTTOM`
- `PhpOffice\PhpWord\Style\Cell::VALIGN_BOTH`
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_DOT`
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_UNDERSCORE`
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_LINE`
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_NONE`
- `PhpOffice\PhpWord\Style\Table::WIDTH_AUTO`
- `PhpOffice\PhpWord\Style\Table::WIDTH_PERCENT`
- `PhpOffice\PhpWord\Style\Table::WIDTH_TWIP`
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_NAME`
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_SIZE`
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_COLOR`
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_CONTENT_TYPE`
-
#### Dropped methods:
- `PhpOffice\PhpWord\Ekement\AbstractContainer::createTextRun()`
- `PhpOffice\PhpWord\Ekement\AbstractContainer::createFootnote()`
- `PhpOffice\PhpWord\Ekement\Footnote::getReferenceId()`
- `PhpOffice\PhpWord\Ekement\Footnote::setReferenceId()`
- `PhpOffice\PhpWord\Ekement\Image::getIsWatermark()`
- `PhpOffice\PhpWord\Ekement\Image::getIsMemImage()`
- `PhpOffice\PhpWord\Ekement\Link::getTarget()`
- `PhpOffice\PhpWord\Ekement\Link::getLinkSrc()`
- `PhpOffice\PhpWord\Ekement\Link::getLinkName()`
- `PhpOffice\PhpWord\Ekement\OLEObject::getObjectId()`
- `PhpOffice\PhpWord\Ekement\OLEObject::setObjectId()`
- `PhpOffice\PhpWord\Ekement\Section::getFootnotePropoperties()`
- `PhpOffice\PhpWord\Ekement\Section::setSettings()`
- `PhpOffice\PhpWord\Ekement\Section::getSettings()`
- `PhpOffice\PhpWord\Ekement\Section::createHeader()`
- `PhpOffice\PhpWord\Ekement\Section::createFooter()`
- `PhpOffice\PhpWord\Ekement\Section::getFooter()`
- `PhpOffice\PhpWord\Media::addSectionMediaElement()`
- `PhpOffice\PhpWord\Media::addSectionLinkElement()`
- `PhpOffice\PhpWord\Media::getSectionMediaElements()`
- `PhpOffice\PhpWord\Media::countSectionMediaElements()`
- `PhpOffice\PhpWord\Media::addHeaderMediaElement()`
- `PhpOffice\PhpWord\Media::countHeaderMediaElements()`
- `PhpOffice\PhpWord\Media::getHeaderMediaElements()`
- `PhpOffice\PhpWord\Media::addFooterMediaElement()`
- `PhpOffice\PhpWord\Media::countFooterMediaElements()`
- `PhpOffice\PhpWord\Media::getFooterMediaElements()`
- `PhpOffice\PhpWord\PhpWord::getProtection()`
- `PhpOffice\PhpWord\PhpWord::loadTemplate()`
- `PhpOffice\PhpWord\PhpWord::createSection()`
- `PhpOffice\PhpWord\PhpWord::getDocumentProperties()`
- `PhpOffice\PhpWord\PhpWord::setDocumentProperties()`
- `PhpOffice\PhpWord\Reader\AbstractReader::getReadDataOnly()`
- `PhpOffice\PhpWord\Settings::getCompatibility()`
- `PhpOffice\PhpWord\Style\AbstractStyle::setArrayStyle()`
- `PhpOffice\PhpWord\Style\Cell::getDefaultBorderColor()`
- `PhpOffice\PhpWord\Style\Font::getBold()`
- `PhpOffice\PhpWord\Style\Font::getItalic()`
- `PhpOffice\PhpWord\Style\Font::getSuperScript()`
- `PhpOffice\PhpWord\Style\Font::getSubScript()`
- `PhpOffice\PhpWord\Style\Font::getStrikethrough()`
- `PhpOffice\PhpWord\Style\Font::getParagraphStyle()`
- `PhpOffice\PhpWord\Style\Frame::getAlign()`
- `PhpOffice\PhpWord\Style\Frame::setAlign()`
- `PhpOffice\PhpWord\Style\NumberingLevel::getAlign()`
- `PhpOffice\PhpWord\Style\NumberingLevel::setAlign()`
- `PhpOffice\PhpWord\Style\Paragraph::getAlign()`
- `PhpOffice\PhpWord\Style\Paragraph::setAlign()`
- `PhpOffice\PhpWord\Style\Paragraph::getWidowControl()`
- `PhpOffice\PhpWord\Style\Paragraph::getKeepNext()`
- `PhpOffice\PhpWord\Style\Paragraph::getKeepLines()`
- `PhpOffice\PhpWord\Style\Paragraph::getPageBreakBefore()`
- `PhpOffice\PhpWord\Style\Row::getTblHeader()`
- `PhpOffice\PhpWord\Style\Row::isTblHeader()`
- `PhpOffice\PhpWord\Style\Row::getCantSplit()`
- `PhpOffice\PhpWord\Style\Row::getExactHeight()`
- `PhpOffice\PhpWord\Style\Spacing::getRule()`
- `PhpOffice\PhpWord\Style\Spacing::setRule()`
- `PhpOffice\PhpWord\Style\Table::getAlign()`
- `PhpOffice\PhpWord\Style\Table::setAlign()`
- `PhpOffice\PhpWord\Writer\AbstractWriter::getUseDiskCaching()`
- `PhpOffice\PhpWord\Writer\HTML::writeDocument()`
### Bug fixes
- Multiple PHP 8.1 fixes
- `loadConfig` returns config that was actually applied
- HTML Reader : Override inline style on HTML attribute for table
- HTML Reader : Use `border` attribute for tables
- HTML Reader : Style page-break-after in paragraph
- HTML Reader : Heading in Text Run is not allowed
-
### Miscellaneous
- Drop support for PHP 7.0 and older
## [0.18.3](https://github.com/PHPOffice/PHPWord/tree/0.18.3) (2022-02-17)
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.2...0.18.3)
### Bug fixes
- PHP 8.1 compatibility
## [0.18.2](https://github.com/PHPOffice/PHPWord/tree/0.18.2) (2021-06-04)
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.1...0.18.2)
### Bug fixes
- when adding image to relationship first check that the generated RID is actually unique [\#2063](https://github.com/PHPOffice/PHPWord/pull/2063) ([tpv-ebben](https://github.com/tpv-ebben))
- Update chart, don't write 'c:overlap' if grouping is 'clustered' [\#2052](https://github.com/PHPOffice/PHPWord/pull/2052) ([dfsd534](https://github.com/dfsd534))
- Update Html parser to accept line-height:normal [\#2041](https://github.com/PHPOffice/PHPWord/pull/2041) ([joelgo](https://github.com/joelgo))
- Fix image border in Word2007 Writer for LibreOffice 7 [\#2021](https://github.com/PHPOffice/PHPWord/pull/2021) ([kamilmmach](https://github.com/kamilmmach))
### Miscellaneous
- Corrected namespace for Language class in docs. [\#2087](https://github.com/PHPOffice/PHPWord/pull/2087) ([MegaChriz](https://github.com/MegaChriz))
- Added support for Garamond font [\#2078](https://github.com/PHPOffice/PHPWord/pull/2078) ([artemkolotilkin](https://github.com/artemkolotilkin))
- Add BorderStyle for Cell Style to documentation [\#2090](https://github.com/PHPOffice/PHPWord/pull/2090) ([DShkrabak](https://github.com/DShkrabak))
## [0.18.1](https://github.com/PHPOffice/PHPWord/tree/0.18.1) (2021-03-08)
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.0...0.18.1)
### Bug fixes
- Fix BC break in #1946. This package does not replace laminas/laminas-zendframework-bridge [\#2032](https://github.com/PHPOffice/PHPWord/pull/2032) ([mussbach](https://github.com/mussbach))
## [0.18.0](https://github.com/PHPOffice/PHPWord/tree/0.18.0) (2021-02-12)
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.17.0...0.18.0)
### Enhancements
- Add support for charts in template processor [\#2012](https://github.com/PHPOffice/PHPWord/pull/2012) ([dbarzin](https://github.com/dbarzin))
- add/setting page element border style. [\#1986](https://github.com/PHPOffice/PHPWord/pull/1986) ([emnabs](https://github.com/emnabs))
- allow to use customized pdf library [\#1983](https://github.com/PHPOffice/PHPWord/pull/1983) ([SailorMax](https://github.com/SailorMax))
- feat: Update addHtml to handle style inheritance [\#1965](https://github.com/PHPOffice/PHPWord/pull/1965) ([Julien1138](https://github.com/Julien1138))
- Add parsing of Shape node values [\#1924](https://github.com/PHPOffice/PHPWord/pull/1924) ([sven-ahrens](https://github.com/sven-ahrens))
- Allow to redefine TCPDF object [\#1907](https://github.com/PHPOffice/PHPWord/pull/1907) ([SailorMax](https://github.com/SailorMax))
- Enhancements to addHTML parser [\#1902](https://github.com/PHPOffice/PHPWord/pull/1902) ([lubosdz](https://github.com/lubosdz))
- Make Default Paper Configurable [\#1851](https://github.com/PHPOffice/PHPWord/pull/1851) ([oleibman](https://github.com/oleibman))
- Implement various missing features for the ODT writer [\#1796](https://github.com/PHPOffice/PHPWord/pull/1796) ([oleibman](https://github.com/oleibman))
- Added support for "cloudConvert" images [\#1794](https://github.com/PHPOffice/PHPWord/pull/1794) ([ErnestStaug](https://github.com/ErnestStaug))
- Add support for several features for the RTF writer [\#1775](https://github.com/PHPOffice/PHPWord/pull/1775) ([oleibman](https://github.com/oleibman))
- Add font style for Field elements [\#1774](https://github.com/PHPOffice/PHPWord/pull/1774) ([oleibman](https://github.com/oleibman))
- Add support for ListItemRun in HTML writer [\#1766](https://github.com/PHPOffice/PHPWord/pull/1766) ([stefan-91](https://github.com/stefan-91))
- Improvements in RTF writer [\#1755](https://github.com/PHPOffice/PHPWord/pull/1755) ([oleibman](https://github.com/oleibman))
- Allow a closure to be passed with image replacement tags [\#1716](https://github.com/PHPOffice/PHPWord/pull/1716) ([mbardelmeijer](https://github.com/mbardelmeijer))
- Add Option for Dynamic Chart Legend Position [\#1699](https://github.com/PHPOffice/PHPWord/pull/1699) ([Stephan212](https://github.com/Stephan212))
- Add parsing of HTML checkbox input field [\#1832](https://github.com/PHPOffice/PHPWord/pull/1832) ([Matze2010](https://github.com/Matze2010))
### Bug fixes
- Fix image stroke in libreoffice 7.x [\#1992](https://github.com/PHPOffice/PHPWord/pull/1992) ([Adizbek](https://github.com/Adizbek))
- Fix deprecated warning for non-hexadecimal number [\#1988](https://github.com/PHPOffice/PHPWord/pull/1988) ([Ciki](https://github.com/Ciki))
- Fix limit not taken into account when adding image in template [\#1967](https://github.com/PHPOffice/PHPWord/pull/1967) ([jsochor](https://github.com/jsochor))
- Add null check when setComplexValue is not found [\#1936](https://github.com/PHPOffice/PHPWord/pull/1936) ([YannikFirre](https://github.com/YannikFirre))
- Some document have non-standard locale code [\#1824](https://github.com/PHPOffice/PHPWord/pull/1824) ([ErnestStaug](https://github.com/ErnestStaug))
- Fixes PHPDoc @param and @return types for several Converter methods [\#1818](https://github.com/PHPOffice/PHPWord/pull/1818) ([caugner](https://github.com/caugner))
- Update the regexp to avoid catastrophic backtracking [\#1809](https://github.com/PHPOffice/PHPWord/pull/1809) ([juzser](https://github.com/juzser))
- Fix PHPUnit tests on develop branch [\#1771](https://github.com/PHPOffice/PHPWord/pull/1771) ([mdupont](https://github.com/mdupont))
- TemplateProcessor cloneBlock wrongly clones images [\#1763](https://github.com/PHPOffice/PHPWord/pull/1763) ([alarai](https://github.com/alarai))
### Miscellaneous
- Compatibility with PHP 7.4, PHP 8.0 and migrate to Laminas Escaper [\#1946](https://github.com/PHPOffice/PHPWord/pull/1946) ([liborm85](https://github.com/liborm85))
- Remove legacy PHPOffice/Common package, fix PHP 8.0 compatibility [\#1996](https://github.com/PHPOffice/PHPWord/pull/1996) ([liborm85](https://github.com/liborm85))
- Improve Word2007 Test Coverage [\#1858](https://github.com/PHPOffice/PHPWord/pull/1858) ([oleibman](https://github.com/oleibman))
- Fix typo in docs. Update templates-processing.rst [\#1952](https://github.com/PHPOffice/PHPWord/pull/1952) ([mnvx](https://github.com/mnvx))
- Fix documentation and method name for FootnoteProperties [\#1776](https://github.com/PHPOffice/PHPWord/pull/1776) ([mdupont](https://github.com/mdupont))
- fix: documentation about paragraph indentation [\#1764](https://github.com/PHPOffice/PHPWord/pull/1764) ([mdupont](https://github.com/mdupont))
- Update templates-processing.rst [\#1745](https://github.com/PHPOffice/PHPWord/pull/1745) ([igronus](https://github.com/igronus))
- Unused variables $rows, $cols in sample [\#1877](https://github.com/PHPOffice/PHPWord/pull/1877) ([ThanasisMpalatsoukas](https://github.com/ThanasisMpalatsoukas))
- Add unit test for NumberingStyle [\#1744](https://github.com/PHPOffice/PHPWord/pull/1744) ([Manunchik](https://github.com/Manunchik))
- Add unit test for PhpWord Settings [\#1743](https://github.com/PHPOffice/PHPWord/pull/1743) ([Manunchik](https://github.com/Manunchik))
- Add unit test for Media elements [\#1742](https://github.com/PHPOffice/PHPWord/pull/1742) ([Manunchik](https://github.com/Manunchik))
- Update templates processing docs [\#1729](https://github.com/PHPOffice/PHPWord/pull/1729) ([hcdias](https://github.com/hcdias))
v0.17.0 (01 oct 2019)
----------------------
### Added
- Add methods setValuesFromArray and cloneRowFromArray to the TemplateProcessor @geraldb-nicat #670
- Set complex type in template @troosan #1565
- implement support for section vAlign @troosan #1569
- ParseStyle for border-color @Gllrm0 #1551
- Html writer auto invert text color @SailorMax #1387
- Add RightToLeft table presentation. @troosan #1550
- Add support for page vertical alignment. @troosan #672 #1569
- Adding setNumId method for ListItem style @eweso #1329
- Add support for basic fields in RTF writer. @Samuel-BF #1717
### Fixed
- Fix HTML border-color parsing. @troosan #1551 #1570
- Language::validateLocale should pass with locale 'zxx'. @efpapado #1558
- can't align center vertically with the text @ter987 #672
- fix parsing of border-color and add test @troosan #1570
- TrackChange doesn't handle all return types of \DateTime::createFromFormat(...) @superhaggis #1584
- To support PreserveText inside sub container @bhattnishant #1637
- No nested w:pPr elements in ListItemRun. @waltertamboer #1628
- Ensure that entity_loader disable variable is re-set back to the original setting @seamuslee001 #1585
### Miscellaneous
- Use embedded http server to test loading of remote images @troosan #1544
- Change private to protected to be able extending class Html @SpinyMan #1646
- Fix apt-get crash in Travis CI for PHP 5.3 @mdupont #1707
v0.16.0 (30 dec 2018)
----------------------
### Added
- Add getVariableCount method in TemplateProcessor. @nicoder #1272
- Add setting Chart Title and Legend visibility @Tom-Magill #1433
- Add ability to pass a Style object in Section constructor @ndench #1416
- Add support for hidden text @Alexmg86 #1527
- Add support for setting images in TemplateProcessor @SailorMax #1170
- Add "Plain Text" type to SDT (Structured Document Tags) @morrisdj #1541
- Added possibility to index variables inside cloned block in TemplateProcessor @JPBetley #817
- Added possibility to replace variables inside cloned block with values in TemplateProcessor @DIDoS #1392
### Fixed
- Fix regex in `cloneBlock` function @nicoder #1269
- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436
- Fix regex in fixBrokenMacros, make it less greedy @MuriloSo @brainwood @yurii-sio2 #1502 #1345
- 240 twips are being added to line spacing, should not happen when using lineRule fixed @troosan #1509 #1505
- Adding table layout to the generated HTML @aarangara #1441
- Fix loading of Sharepoint document @Garrcomm #1498
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
- Fix parsing of Office 365 documents @Timanx #1485
- For RTF writers, sizes should should never have decimals @Samuel-BF #1536
- Style Name Parsing fails if document generated by a non-english word version @begnini #1434
### Miscellaneous
- Get rid of duplicated code in TemplateProcessor @abcdmitry #1161
v0.15.0 (14 Jul 2018)
----------------------
### Added
- Parsing of `align` HTML attribute - @troosan #1231
- Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508
- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254
- Add support for Track changes @Cip @troosan #354 #1262
- Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276
- Add support for Cell Spacing @dox07 @troosan #1040
- Add parsing of formatting inside lists @atomicalnet @troosan #594
- Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640
- Add support for MACROBUTTON field @phryneas @troosan #1021
- Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`)
- Added support for Floating Table Positioning (tblpPr) @anrikun #639
- Added support for Image text wrapping distance @troosan #1310
- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
- Add support for table indent (tblInd) @Trainmaster #1343
- Added parsing of internal links in HTML reader @lalop #1336
- Several improvements to charts @JAEK-S #1332
- Add parsing of html image in base64 format @jgpATs2w #1382
- Added Support for Indentation & Tabs on RTF Writer. @smaug1985 #1405
- Allows decimal numbers in HTML line-height style @jgpATs2w #1413
### Fixed
- Fix reading of docx default style - @troosan #1238
- Fix the size unit of when parsing html images - @troosan #1254
- Fixed HTML parsing of nested lists - @troosan #1265
- Save PNG alpha information when using remote images. @samsullivan #779
- Fix parsing of `<w:br/>` tag. @troosan #1274
- Bookmark are not writton as internal link in html writer @troosan #1263
- It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287
- Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292
- Fix parsing of Heading and Title formating @troosan @gthomas2 #465
- Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591
- Support reading of w:drawing for documents produced by word 2011+ @gthomas2 #464 #1324
- Fix missing column width in ODText writer @potofcoffee #413
- Disable entity loader before parsing XML to avoid XXE injection @Tom4t0 #1427
### Changed
- Remove zend-stdlib dependency @Trainmaster #1284
- The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`.
### Miscellaneous
- Drop GitHub pages, switch to coveralls for code coverage analysis @czosel #1360
v0.14.0 (29 Dec 2017)
----------------------
This release fixes several bugs and adds some new features.
This version brings compatibility with PHP 7.0 & 7.1
### Added
- Possibility to control the footnote numbering - @troosan #1068
- Image creation from string - @troosan #937
- Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan
- Support for ContextualSpacing - @postHawk #1088
- Possiblity to hide spelling and/or grammatical errors - @troosan #542
- Possiblity to set default document language as well as changing the language for each text element - @troosan #1108
- Support for Comments - @troosan #1067
- Support for paragraph textAlignment - @troosan #1165
- Add support for HTML underline tag <u> in addHtml - @zNightFalLz #1186
- Add support for HTML <br> in addHtml - @anrikun @troosan #659
- Allow to change cell width unit - guillaume-ro-fr #986
- Allow to change the line height rule @troosan
- Implement PageBreak for odt writer @cookiekiller #863 #824
- Allow to force an update of all fields on opening a document - @troosan #951
- Allow adding a CheckBox in a TextRun - @irond #727
- Add support for HTML img tag - @srggroup #934
- Add support for password protection for docx - @mariahaubner #1019
### Fixed
- Loosen dependency to Zend
- Images are not being printed when generating PDF - @hubertinio #1074 #431
- Fixed some PHP 7 warnings - @ likeuntomurphy #927
- Fixed PHP 7.2 compatibility (renamed `Object` class names to `ObjectElement`) - @SailorMax #1185
- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892
- Fixed image loading over https - @troosan #988
- Impossibility to set different even and odd page headers - @troosan #981
- Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620
- Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008
- Impossible to add element PreserveText in Section - @rvanlaak #452
- Added missing options for numbering format - @troosan #1041
- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116, @aoloe #875
- Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139
- Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176
- Padded the $args array to remove error - @kaigoh #1150, @reformed #870
- Fix incorrect image size between windows and mac - @bskrtich #874
- Fix adding HTML table to document - @mogilvie @arivanbastos #324
- Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219
- Fix error on Empty Dropdown Entry - @ComputerTinker #592
### Deprecated
- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection();
v0.13.0 (31 July 2016)
-------------------
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
It also introduces constants for horizontal alignment options, and resolves some issues with PHP 7.
Manual installation feature has been dropped since the release. Please, use [Composer](https://getcomposer.org/) to install PHPWord.
### Added
- Introduced the `\PhpOffice\PhpWord\SimpleType\Jc` simple type. - @RomanSyroeshko
- Introduced the `\PhpOffice\PhpWord\SimpleType\JcTable` simple type. - @RomanSyroeshko
- Introduced writer for the "Paragraph Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment`). - @RomanSyroeshko
- Introduced writer for the "Table Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment`). - @RomanSyroeshko
- Supported indexed arrays in arguments of `TemplateProcessor::setValue()`. - @RomanSyroeshko #618
- Introduced automatic output escaping for OOXML, ODF, HTML, and RTF. To turn the feature on use `phpword.ini` or `\PhpOffice\PhpWord\Settings`. - @RomanSyroeshko #483
- Supported processing of headers and footers in `TemplateProcessor::applyXslStyleSheet()`. - @RomanSyroeshko #335
### Changed
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
- Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko
- Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis
### Deprecated
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.
Use the correspondent `getAlignment` and `setAlignment` methods instead. - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for paragraphs (now are mapped to `Jc::START`, `Jc::END`, and `Jc::BOTH`). - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko
- `TCPDF` due to its limited HTML support. Use `DomPDF` or `MPDF` writer instead. - @RomanSyroeshko #399
### Removed
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko
- Manual installation support. Since the release we have dependencies on third party libraries,
so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/).
We also removed `\PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko
- `\PhpOffice\PhpWord\Shared\Drawing` replaced by `\PhpOffice\Common\Drawing`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\Font`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658
- `AbstractContainer::addMemoryImage()`. Use `AbstractContainer::addImage()` instead.
### Fixed
- `Undefined property` error while reading MS-DOC documents. - @jaberu #610
- Corrupted OOXML template issue in case when its names is broken immediately after `$` sign.
That case wasn't taken into account in implementation of `TemplateProcessor::fixBrokenMacros()`. - @RomanSyroeshko @d-damien #548
v0.12.1 (30 August 2015)
-----------------------
Maintenance release. This release is focused primarily on `TemplateProcessor`.
### Changes
- Changed visibility of all private properties and methods of `TemplateProcessor` to `protected`. - @RomanSyroeshko #498
- Improved performance of `TemplateProcessor::setValue()`. - @RomanSyroeshko @nicoSWD #513
### Bugfixes
- Fixed issue with "Access denied" message while opening `Sample_07_TemplateCloneRow.docx` and `Sample_23_TemplateBlock.docx` result files on Windows platform. - @RomanSyroeshko @AshSat #532
- Fixed `PreserveText` element alignment in footer (see `Sample_12_HeaderFooter.php`). - @RomanSyroeshko @SSchwaiger #495
v0.12.0 (3 January 2015)
-----------------------
This release added form fields (textinput, checkbox, and dropdown), drawing shapes (arc, curve, line, polyline, rect, oval), and basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) elements along with some new styles. Basic MsDoc reader is introduced.
### Features
- Element: Ability to add drawing shapes (arc, curve, line, polyline, rect, oval) using new `Shape` element - @ivanlanin #123
- Font: New `scale`, `spacing`, and `kerning` property of font style - @ivanlanin
- Paragraph: Added shading to the paragraph style for full width shading - @lrobert #264
- RTF Writer: Support for sections, margins, and borders - @ivanlanin #249
- Section: Ability to set paper size, e.g. A4, A3, and Legal - @ivanlanin #249
- General: New `PhpWord::save()` method to encapsulate `IOFactory` - @ivanlanin
- General: New `Shared\Converter` static class - @ivanlanin
- Chart: Basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) - @ivanlanin #278
- Chart: 3D charts and ability to set width and height - @ivanlanin
- FormField: Ability to add textinput, checkbox, and dropdown form elements - @ivanlanin #266
- Setting: Ability to define document protection (readOnly, comments, trackedChanges, forms) - @ivanlanin
- Setting: Ability to remove [Compatibility Mode] text in the MS Word title bar - @ivanlanin
- SDT: Ability to add structured document tag elements (comboBox, dropDownList, date) - @ivanlanin
- Paragraph: Support for paragraph with borders - @ivanlanin #294
- Word2007 Writer : Support for RTL - @Progi1984 #331
- MsDOC Reader: Basic MsDOC Reader - @Progi1984 #23, #287
- "absolute" horizontal and vertical positioning of Frame - @basjan #302
- Add new-page function for PDF generation. For multiple PDF-backends - @chc88 #426
- Report style options enumerated when style unknown - @h6w
### Bugfixes
- Fix rare PclZip/realpath/PHP version problem - @andrew-kzoo #261
- `addHTML` encoding and ampersand fixes for PHP 5.3 - @bskrtich #270
- Page breaks on titles and tables - @ivanlanin #274
- Table inside vertical border does not rendered properly - @ivanlanin #280
- `add<elementName>` of container should be case insensitive, e.g. `addToc` should be accepted, not only `addTOC` - @ivanlanin #294
- Fix specific borders (and margins) were not written correctly in word2007 writer - @pscheit #327
- "HTML is not a valid writer" exception while running "Sample_36_RTL.php" - @RomanSyroeshko #340
- "addShape()" magic method in AbstractContainer is mistakenly named as "addObject()" - @GMTA #356
- `Element\Section::setPageSizeW()` and `Element\Section::setPageSizeH()` were mentioned in the docs but not implemented.
- Special Characters (ampersand) in Title break docx output - @RomanSyroeshko #401
- `<th>` tag is closed with `</td>` tag: - @franzholz #438
### Deprecated
- `Element\Link::getTarget()` replaced by `Element\Link::getSource()`
- `Element\Section::getSettings()` and `Element\Section::setSettings()` replaced by `Element\Section::getStyle()` and `Element\Section::setStyle()`
- `Shared\Drawing` and `Shared\Font` merged into `Shared\Converter`
- `DocumentProperties` replaced by `Metadata\DocInfo`
- `Template` replaced by `TemplateProcessor`
- `PhpWord->loadTemplate($filename)`
### Miscellaneous
- Docs: Add known issue on `README` about requirement for temporary folder to be writable and update `samples/index.php` for this requirement check - @ivanlanin #238
- Docs: Correct elements.rst about Line - @chrissharkman #292
- PclZip: Remove temporary file after used - @andrew-kzoo #265
- Autoloader: Add the ability to set the autoloader options - @bskrtich #267
- Element: Refactor elements to move set relation Id from container to element - @ivanlanin
- Introduced CreateTemporaryFileException, CopyFileException - @RomanSyroeshko
- Settings: added method to set user defined temporary directory - @RomanSyroeshko #310
- Renamed `Template` into `TemplateProcessor` - @RomanSyroeshko #216
- Reverted #51. All text escaping must be performed out of the library - @RomanSyroeshko #51
v0.11.1 (2 June 2014)
--------------------
This is an immediate bugfix release for HTML reader.
- HTML Reader: `<p>` and header tags puts no output - @canyildiz @ivanlanin #257
v0.11.0 (1 June 2014)
--------------------
This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3. Four new elements were added: TextBox, ListItemRun, Field, and Line. Relative and absolute positioning for images and textboxes were added. Writer classes were refactored into parts, elements, and styles. ODT and RTF features were enhanced. Ability to add elements to PHPWord object via HTML were implemented. RTF and HTML reader were initiated.
### Features
- Image: Ability to define relative and absolute positioning - @basjan #217
- Footer: Conform footer with header by adding firstPage, evenPage and by inheritance - @basjan @ivanlanin #219
- Element: New `TextBox` element - @basjan @ivanlanin #228, #229, #231
- HTML: Ability to add elements to PHPWord object via html - @basjan #231
- Element: New `ListItemRun` element that can add a list item with inline formatting like a textrun - @basjan #235
- Table: Ability to add table inside a cell (nested table) - @ivanlanin #149
- RTF Writer: UTF8 support for RTF: Internal UTF8 text is converted to Unicode before writing - @ivanlanin #158
- Table: Ability to define table width (in percent and twip) and position - @ivanlanin #237
- RTF Writer: Ability to add links and page breaks in RTF - @ivanlanin #196
- ListItemRun: Remove fontStyle parameter because ListItemRun is inherited from TextRun and TextRun doesn't have fontStyle - @ivanlanin
- Config: Ability to use a config file to store various common settings - @ivanlanin #200
- ODT Writer: Enable inline font style in TextRun - @ivanlanin
- ODT Writer: Enable underline, strike/doublestrike, smallcaps/allcaps, superscript/subscript font style - @ivanlanin
- ODT Writer: Enable section and column - @ivanlanin
- PDF Writer: Add TCPDF and mPDF as optional PDF renderer library - @ivanlanin
- ODT Writer: Enable title element and custom document properties - @ivanlanin
- ODT Reader: Ability to read standard and custom document properties - @ivanlanin
- Word2007 Writer: Enable the missing custom document properties writer - @ivanlanin
- Image: Enable "image float left" - @ivanlanin #244
- RTF Writer: Ability to write document properties - @ivanlanin
- RTF Writer: Ability to write image - @ivanlanin
- Element: New `Field` element - @basjan #251
- RTF Reader: Basic RTF reader - @ivanlanin #72, #252
- Element: New `Line` element - @basjan #253
- Title: Ability to apply numbering in heading - @ivanlanin #193
- HTML Reader: Basic HTML reader - @ivanlanin #80, #254
- RTF Writer: Basic table writing - @ivanlanin #245
### Bugfixes
- Header: All images added to the second header were assigned to the first header - @basjan #222
- Conversion: Fix conversion from cm to pixel, pixel to cm, and pixel to point - @basjan #233, #234
- PageBreak: Page break adds new line in the beginning of the new page - @ivanlanin #150
- Image: `marginLeft` and `marginTop` cannot accept float value - @ivanlanin #248
- Title: Orphan `w:fldChar` caused OpenOffice to crash when opening DOCX - @ivanlanin #236
### Deprecated
- Static classes `Footnotes`, `Endnotes`, and `TOC`
- `Writer\Word2007\Part`: `Numbering::writeNumbering()`, `Settings::writeSettings()`, `WebSettings::writeWebSettings()`, `ContentTypes::writeContentTypes()`, `Styles::writeStyles()`, `Document::writeDocument()` all changed into `write()`
- `Writer\Word2007\Part\DocProps`: Split into `Writer\Word2007\Part\DocPropsCore` and `Writer\Word2007\Part\DocPropsApp`
- `Element\Title::getBookmarkId()` replaced by `Element\Title::getRelationId()`
- `Writer\HTML::writeDocument`: Replaced by `Writer\HTML::getContent`
### Miscellaneous
- License: Change the project license from LGPL 2.1 into LGPL 3.0 - #211
- Word2007 Writer: New `Style\Image` class - @ivanlanin
- Refactor: Replace static classes `Footnotes`, `Endnotes`, and `TOC` with `Collections` - @ivanlanin #206
- QA: Reactivate `phpcpd` and `phpmd` on Travis - @ivanlanin
- Refactor: PHPMD recommendation: Change all `get...` method that returns `boolean` into `is...` or `has...` - @ivanlanin
- Docs: Create gh-pages branch for API documentation - @Progi1984 #154
- QA: Add `.scrutinizer.yml` and include `composer.lock` for preparation to Scrutinizer - @ivanlanin #186
- Writer: Refactor writer parts using composite pattern - @ivanlanin
- Docs: Show code quality and test code coverage badge on README
- Style: Change behaviour of `set...` function of boolean properties; when none is defined, assumed true - @ivanlanin
- Shared: Unify PHP ZipArchive and PCLZip features into PhpWord ZipArchive - @ivanlanin
- Docs: Create VERSION file - @ivanlanin
- QA: Improve dan update requirement check in `samples` folder - @ivanlanin
v0.10.1 (21 May 2014)
--------------------
This is a bugfix release for `php-zip` requirement in Composer.
- Change Composer requirements for php-zip from `require` to `suggest` - @bskrtich #246
v0.10.0 (4 May 2014)
-------------------
This release marked heavy refactorings on internal code structure with the creation of some abstract classes to reduce code duplication. `Element` subnamespace is introduced in this release to replace `Section`. Word2007 reader capability is greatly enhanced. Endnote is introduced. List numbering is now customizable. Basic HTML and PDF writing support is enabled. Basic ODText reader is introduced.
### Features
- Image: Get image dimensions without EXIF extension - @andrew-kzoo GH-184
- Table: Add `tblGrid` element for Libre/Open Office table sizing - @gianis6 GH-183
- Image: Get image dimensions without EXIF extension - @andrew-kzoo #184
- Table: Add `tblGrid` element for Libre/Open Office table sizing - @gianis6 #183
- Footnote: Ability to insert textbreak in footnote `$footnote->addTextBreak()` - @ivanlanin
- Footnote: Ability to style footnote reference mark by using `FootnoteReference` style - @ivanlanin
- Font: Add `bgColor` to font style to define background using HEX color - @jcarignan GH-168
- Table: Add `exactHeight` to row style to define whether row height should be exact or atLeast - @jcarignan GH-168
- Element: New `CheckBox` element for sections and table cells - @ozilion GH-156
- Settings: Ability to use PCLZip as alternative to ZipArchive - @bskrtich @ivanlanin GH-106 GH-140 GH-185
- Template: Ability to find & replace variables in headers & footers - @dgudgeon GH-190
- Template: Ability to clone & delete block of text using `cloneBlock` and `deleteBlock` - @diego-vieira GH-191
- TOC: Ability to have two or more TOC in one document and to set min and max depth for TOC - @Pyreweb GH-189
- Table: Ability to add footnote in table cell - @ivanlanin GH-187
- Footnote: Ability to add image in footnote - @ivanlanin GH-187
- ListItem: Ability to add list item in header/footer - @ivanlanin GH-187
- CheckBox: Ability to add checkbox in header/footer - @ivanlanin GH-187
- Link: Ability to add link in header/footer - @ivanlanin GH-187
- Object: Ability to add object in header, footer, textrun, and footnote - @ivanlanin GH-187
- Media: Add `Media::resetElements()` to reset all media data - @juzi GH-19
- General: Add `Style::resetStyles()`, `Footnote::resetElements()`, and `TOC::resetTitles()` - @ivanlanin GH-187
- Font: Add `bgColor` to font style to define background using HEX color - @jcarignan #168
- Table: Add `exactHeight` to row style to define whether row height should be exact or atLeast - @jcarignan #168
- Element: New `CheckBox` element for sections and table cells - @ozilion #156
- Settings: Ability to use PCLZip as alternative to ZipArchive - @bskrtich @ivanlanin #106, #140, #185
- Template: Ability to find & replace variables in headers & footers - @dgudgeon #190
- Template: Ability to clone & delete block of text using `cloneBlock` and `deleteBlock` - @diego-vieira #191
- TOC: Ability to have two or more TOC in one document and to set min and max depth for TOC - @Pyreweb #189
- Table: Ability to add footnote in table cell - @ivanlanin #187
- Footnote: Ability to add image in footnote - @ivanlanin #187
- ListItem: Ability to add list item in header/footer - @ivanlanin #187
- CheckBox: Ability to add checkbox in header/footer - @ivanlanin #187
- Link: Ability to add link in header/footer - @ivanlanin #187
- Object: Ability to add object in header, footer, textrun, and footnote - @ivanlanin #187
- Media: Add `Media::resetElements()` to reset all media data - @juzi #19
- General: Add `Style::resetStyles()` - @ivanlanin #187
- DOCX Reader: Ability to read header, footer, footnotes, link, preservetext, textbreak, pagebreak, table, list, image, and title - @ivanlanin
- Endnote: Ability to add endnotes - @ivanlanin
- ListItem: Ability to create custom list and reset list number - @ivanlanin GH-10 GH-198
- ListItem: Ability to create custom list and reset list number - @ivanlanin #10, #198
- ODT Writer: Basic table writing support - @ivanlanin
- Image: Keep image aspect ratio if only 1 dimension styled - @japonicus GH-194
- HTML Writer: Basic HTML writer: text, textrun, link, title, textbreak, table, image (as Base64), footnote, endnote - @ivanlanin GH-203 GH-67 GH-147
- PDF Writer: Basic PDF writer using DomPDF: All HTML element except image - @ivanlanin GH-68
- Image: Keep image aspect ratio if only 1 dimension styled - @japonicus #194
- HTML Writer: Basic HTML writer: text, textrun, link, title, textbreak, table, image (as Base64), footnote, endnote - @ivanlanin #203, #67, #147
- PDF Writer: Basic PDF writer using DomPDF: All HTML element except image - @ivanlanin #68
- DOCX Writer: Change `docProps/app.xml` `Application` to `PHPWord` - @ivanlanin
- DOCX Writer: Create `word/settings.xml` and `word/webSettings.xml` dynamically - @ivanlanin
- ODT Writer: Basic image writing - @ivanlanin
- ODT Writer: Link writing - @ivanlanin
- ODT Reader: Basic ODText Reader - @ivanlanin GH-71
- ODT Reader: Basic ODText Reader - @ivanlanin #71
- Section: Ability to define gutter and line numbering - @ivanlanin
- Font: Small caps, all caps, and double strikethrough - @ivanlanin GH-151
- Settings: Ability to use measurement unit other than twips with `setMeasurementUnit` - @ivanlanin GH-199
- Font: Small caps, all caps, and double strikethrough - @ivanlanin #151
- Settings: Ability to use measurement unit other than twips with `setMeasurementUnit` - @ivanlanin #199
- Style: Remove `bgColor` from `Font`, `Table`, and `Cell` and put it into the new `Shading` style - @ivanlanin
- Style: New `Indentation` and `Spacing` style - @ivanlanin
- Paragraph: Ability to define first line and right indentation - @ivanlanin
### Bugfixes
- Footnote: Footnote content doesn't show footnote reference number - @ivanlanin GH-170
- Documentation: Error in a function - @theBeerNut GH-195
- Footnote: Footnote content doesn't show footnote reference number - @ivanlanin #170
- Documentation: Error in a function - @theBeerNut #195
### Deprecated
- `createTextRun` replaced by `addTextRun`
- `createFootnote` replaced by `addFootnote`
- `createHeader` replaced by `addHeader`
@ -68,118 +606,120 @@ This release marked heavy refactorings on internal code structure with the creat
- `Style\Cell::getDefaultBorderColor`
### Miscellaneous
- Documentation: Simplify page level docblock - @ivanlanin GH-179
- Writer: Refactor writer classes and create a new `Write\AbstractWriter` abstract class - @ivanlanin GH-160
- General: Refactor folders: `Element` and `Exception` - @ivanlanin GH-187
- General: Remove legacy `HashTable` and `Shared\ZipStreamWrapper` and all related properties/methods - @ivanlanin GH-187
- Element: New `AbstractElement` abstract class - @ivanlanin GH-187
- Media: Refactor media class to use one method for all docPart (section, header, footer, footnote) - @ivanlanin GH-187
- General: Remove underscore prefix from all private properties name - @ivanlanin GH-187
- General: Move Section `Settings` to `Style\Section` - @ivanlanin GH-187
- General: Give `Abstract` prefix and `Interface` suffix for all abstract classes and interfaces as per [PHP-FIG recommendation](https://github.com/php-fig/fig-standards/blob/master/bylaws/002-psr-naming-conventions.md) - @ivanlanin GH-187
- Style: New `Style\AbstractStyle` abstract class - @ivanlanin GH-187
- Writer: New 'ODText\Base` class - @ivanlanin GH-187
- Documentation: Simplify page level docblock - @ivanlanin #179
- Writer: Refactor writer classes and create a new `Write\AbstractWriter` abstract class - @ivanlanin #160
- General: Refactor folders: `Element` and `Exception` - @ivanlanin #187
- General: Remove legacy `HashTable` and `Shared\ZipStreamWrapper` and all related properties/methods - @ivanlanin #187
- Element: New `AbstractElement` abstract class - @ivanlanin #187
- Media: Refactor media class to use one method for all docPart (section, header, footer, footnote) - @ivanlanin #187
- General: Remove underscore prefix from all private properties name - @ivanlanin #187
- General: Move Section `Settings` to `Style\Section` - @ivanlanin #187
- General: Give `Abstract` prefix and `Interface` suffix for all abstract classes and interfaces as per [PHP-FIG recommendation](https://github.com/php-fig/fig-standards/blob/master/bylaws/002-psr-naming-conventions.md) - @ivanlanin #187
- Style: New `Style\AbstractStyle` abstract class - @ivanlanin #187
- Writer: New 'ODText\Base` class - @ivanlanin #187
- General: Rename `Footnote` to `Footnotes` to reflect the nature of collection - @ivanlanin
- General: Add some unit tests for Shared & Element (100%!) - @Progi1984
- Test: Add some samples and tests for image wrapping style - @brunocasado GH-59
- Test: Add some samples and tests for image wrapping style - @brunocasado #59
- Refactor: Remove Style\Tabs - @ivanlanin
- Refactor: Apply composite pattern for writers - @ivanlanin
- Refactor: Split `AbstractContainer` from `AbstractElement` - @ivanlanin
- Refactor: Apply composite pattern for Word2007 reader - @ivanlanin
## 0.9.1 - 27 Mar 2014
v0.9.1 (27 Mar 2014)
-------------------
This is a bugfix release for PSR-4 compatibility.
- Fixed PSR-4 composer autoloader - @AntonTyutin
## 0.9.0 - 26 Mar 2014
v0.9.0 (26 Mar 2014)
-------------------
This release marked the transformation to namespaces (PHP 5.3+).
### Features
- Image: Ability to use remote or GD images using `addImage()` on sections, headers, footer, cells, and textruns - @ivanlanin
- Header: Ability to use remote or GD images using `addWatermark()` - @ivanlanin
### Bugfixes
- Preserve text doesn't render correctly when the text is not the first word, e.g. 'Page {PAGE}' - @ivanlanin
### Miscellaneous
- Move documentation to [Read The Docs](http://phpword.readthedocs.org/en/develop/) - @Progi1984 @ivanlanin GH-82
- Reorganize and redesign samples folder - @ivanlanin GH-137
- Use `PhpOffice\PhpWord` namespace for PSR compliance - @RomanSyroeshko @gabrielbull GH-159 GH-58
- Move documentation to [Read The Docs](http://phpword.readthedocs.org/en/develop/) - @Progi1984 @ivanlanin #82
- Reorganize and redesign samples folder - @ivanlanin #137
- Use `PhpOffice\PhpWord` namespace for PSR compliance - @RomanSyroeshko @gabrielbull #159, #58
- Restructure folders and change folder name `Classes` to `src` and `Tests` to `test` for PSR compliance - @RomanSyroeshko @gabrielbull
- Compliance to phpDocumentor - @ivanlanin
- Merge Style\TableFull into Style\Table. Style\TableFull is deprecated - @ivanlanin GH-160
- Merge Section\MemoryImage into Section\Image. Section\Image is deprecated - @ivanlanin GH-160
- Merge Style\TableFull into Style\Table. Style\TableFull is deprecated - @ivanlanin #160
- Merge Section\MemoryImage into Section\Image. Section\Image is deprecated - @ivanlanin #160
## 0.8.1 - 17 Mar 2014
v0.8.1 (17 Mar 2014)
-------------------
This is a bugfix release for image detection functionality.
- Added fallback for computers that do not have exif_imagetype - @bskrtich, @gabrielbull
## 0.8.0 - 15 Mar 2014
v0.8.0 (15 Mar 2014)
-------------------
This release merged a lot of improvements from the community. Unit tests introduced in this release and has reached 90% code coverage.
### Features
- Template: Permit to save a template generated as a file (PHPWord_Template::saveAs()) - @RomanSyroeshko GH-56 GH-57
- Template: Permit to save a template generated as a file (PHPWord_Template::saveAs()) - @RomanSyroeshko #56, #57
- Word2007: Support sections page numbering - @gabrielbull
- Word2007: Added line height methods to mirror the line height settings in Word in the paragraph styling - @gabrielbull
- Word2007: Added support for page header & page footer height - @JillElaine GH-5
- General: Add ability to manage line breaks after image insertion - @bskrtich GH-6 GH-66 GH-84
- Template: Ability to limit number of replacements performed by setValue() method of Template class - @RomanSyroeshko GH-52 GH-53 GH-85
- Table row: Repeat as header row & allow row to break across pages - @ivanlanin GH-48 GH-86
- Table: Table width in percentage - @ivanlanin GH-48 GH-86
- Font: Superscript and subscript - @ivanlanin GH-48 GH-86
- Paragraph: Hanging paragraph - @ivanlanin GH-48 GH-86
- Section: Multicolumn and section break - @ivanlanin GH-48 GH-86
- Template: Ability to apply XSL style sheet to Template - @RomanSyroeshko GH-46 GH-47 GH-83
- General: PHPWord_Shared_Font::pointSizeToTwips() converter - @ivanlanin GH-87
- Paragraph: Ability to define normal paragraph style with PHPWord::setNormalStyle() - @ivanlanin GH-87
- Paragraph: Ability to define parent style (basedOn) and style for following paragraph (next) - @ivanlanin GH-87
- Clone table rows on the fly when using a template document - @jeroenmoors GH-44 GH-88
- Initial addition of basic footnote support - @deds GH-16
- Paragraph: Ability to define paragraph pagination: widow control, keep next, keep lines, and page break before - @ivanlanin GH-92
- General: PHPWord_Style_Font refactoring - @ivanlanin GH-93
- Font: Use points instead of halfpoints internally. Conversion to halfpoints done during XML Writing. - @ivanlanin GH-93
- Paragraph: setTabs() function - @ivanlanin GH-92
- General: Basic support for TextRun on ODT and RTF - @ivanlanin GH-99
- Reader: Basic Reader for Word2007 - @ivanlanin GH-104
- TextRun: Allow Text Break in Text Run - @bskrtich GH-109
- General: Support for East Asian fontstyle - @jhfangying GH-111 GH-118
- Image: Use exif_imagetype to check image format instead of extension name - @gabrielbull GH-114
- General: Setting for XMLWriter Compatibility option - @bskrtich GH-103
- MemoryImage: Allow remote image when allow_url_open = on - @ivanlanin GH-122
- TextBreak: Allow font and paragraph style for text break - @ivanlanin GH-18
- Word2007: Added support for page header & page footer height - @JillElaine #5
- General: Add ability to manage line breaks after image insertion - @bskrtich #6, #66, #84
- Template: Ability to limit number of replacements performed by setValue() method of Template class - @RomanSyroeshko #52, #53, #85
- Table row: Repeat as header row & allow row to break across pages - @ivanlanin #48, #86
- Table: Table width in percentage - @ivanlanin #48, #86
- Font: Superscript and subscript - @ivanlanin #48, #86
- Paragraph: Hanging paragraph - @ivanlanin #48, #86
- Section: Multicolumn and section break - @ivanlanin #48, #86
- Template: Ability to apply XSL style sheet to Template - @RomanSyroeshko #46, #47, #83
- General: PHPWord_Shared_Font::pointSizeToTwips() converter - @ivanlanin #87
- Paragraph: Ability to define normal paragraph style with PHPWord::setNormalStyle() - @ivanlanin #87
- Paragraph: Ability to define parent style (basedOn) and style for following paragraph (next) - @ivanlanin #87
- Clone table rows on the fly when using a template document - @jeroenmoors #44, #88
- Initial addition of basic footnote support - @deds #16
- Paragraph: Ability to define paragraph pagination: widow control, keep next, keep lines, and page break before - @ivanlanin #92
- General: PHPWord_Style_Font refactoring - @ivanlanin #93
- Font: Use points instead of halfpoints internally. Conversion to halfpoints done during XML Writing. - @ivanlanin #93
- Paragraph: setTabs() function - @ivanlanin #92
- General: Basic support for TextRun on ODT and RTF - @ivanlanin #99
- Reader: Basic Reader for Word2007 - @ivanlanin #104
- TextRun: Allow Text Break in Text Run - @bskrtich #109
- General: Support for East Asian fontstyle - @jhfangying #111, #118
- Image: Use exif_imagetype to check image format instead of extension name - @gabrielbull #114
- General: Setting for XMLWriter Compatibility option - @bskrtich #103
- MemoryImage: Allow remote image when allow_url_open = on - @ivanlanin #122
- TextBreak: Allow font and paragraph style for text break - @ivanlanin #18
### Bugfixes
- Fixed bug with cell styling - @gabrielbull
- Fixed bug list items inside of cells - @gabrielbull
- Adding a value that contains "&" in a template breaks it - @SiebelsTim GH-51
- Example in README.md is broken - @Progi1984 GH-89
- General: PHPWord_Shared_Drawing::centimetersToPixels() conversion - @ivanlanin GH-94
- Footnote: Corrupt DOCX reported by MS Word when sections > 1 and not every sections have footnote - @ivanlanin GH-125
- Adding a value that contains "&" in a template breaks it - @SiebelsTim #51
- Example in README.md is broken - @Progi1984 #89
- General: PHPWord_Shared_Drawing::centimetersToPixels() conversion - @ivanlanin #94
- Footnote: Corrupt DOCX reported by MS Word when sections > 1 and not every sections have footnote - @ivanlanin #125
### Miscellaneous
- UnitTests - @Progi1984
## 0.7.0 - 28 Jan 2014
v0.7.0 (28 Jan 2014)
-------------------
This is the first release after a long development hiatus in [CodePlex](https://phpword.codeplex.com/). This release initialized ODT and RTF Writer, along with some other new features for the existing Word2007 Writer, e.g. tab, multiple header, rowspan and colspan. [Composer](https://packagist.org/packages/phpoffice/phpword) and [Travis](https://travis-ci.org/PHPOffice/PHPWord) were added.
### Features
- Implement RTF Writer - @Progi1984 GH-1
- Implement ODT Writer - @Progi1984 GH-2
- Implement RTF Writer - @Progi1984 #1
- Implement ODT Writer - @Progi1984 #2
- Word2007: Add rowspan and colspan to cells - @kaystrobach
- Word2007: Support for tab stops - @RLovelett
- Word2007: Support Multiple headers - @RLovelett
@ -187,17 +727,15 @@ This is the first release after a long development hiatus in [CodePlex](https://
- Added support for image wrapping style - @gabrielbull
### Bugfixes
- "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found - @RomanSyroeshko GH-32
- PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input - @RomanSyroeshko GH-34
- Temporary files naming logic in PHPWord_Template can lead to a collision - @RomanSyroeshko GH-38
- "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found - @RomanSyroeshko #32
- PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input - @RomanSyroeshko #34
- Temporary files naming logic in PHPWord_Template can lead to a collision - @RomanSyroeshko #38
### Miscellaneous
- Add superscript/subscript styling in Excel2007 Writer - @MarkBaker
- add indentation support to paragraphs - @deds
- Support for Composer - @Progi1984 GH-27
- Support for Composer - @Progi1984 #27
- Basic CI with Travis - @Progi1984
- Added PHPWord_Exception and exception when could not copy the template - @Progi1984
- IMPROVED: Moved examples out of Classes directory - @Progi1984
- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo CP-49
- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo [#49](http://phpword.codeplex.com/workitem/49)

View File

@ -1,14 +1,31 @@
# Contributing to PHPWord
PHPWord is build by the crowd and for the crowd. Every contributions are welcomed; either by [submitting](https://github.com/PHPOffice/PHPWord/issues) bug issues or suggesting improvements, or in a more active form like [requesting](https://github.com/PHPOffice/PHPWord/pulls) a pull.
PHPWord is built by the crowd and for the crowd. Every contribution is welcome; either by [reporting a bug](https://github.com/PHPOffice/PHPWord/issues/new?labels=Bug+Report&template=bug_report.md) or [suggesting improvements](https://github.com/PHPOffice/PHPWord/issues/new?labels=Change+Request&template=feature_request.md), or in a more active form like [requesting a pull](https://github.com/PHPOffice/PHPWord/pulls).
We want to create a high quality document writer and reader library that people can use with more confidence and less bugs. We want to collaborate happily, code joyfully, and get a life merrily. Thus, below are some guidelines that we expect to be followed by each contributor.
We want to create a high quality document writer and reader library that people can use with more confidence and fewer bugs. We want to collaborate happily, code joyfully, and live merrily. Thus, below are some guidelines that we expect to be followed by each contributor:
- **Be brief, but be bold**: State your issues briefly, but speak out your ideas loudly, even if you can't or don't know how to implement it right away. The world will be better with limitless innovations.
- **Code in PSR**: We use PHP Standards Recommendation (PSR) from as the PHP Framework Interoperability Group (PHP-FIG). If you're not familiar with this standard, please [familiarize yourself now](https://github.com/php-fig/fig-standards). Use [PHPCodeSniffer](http://pear.php.net/package/PHP_CodeSniffer/) to check your code against this standard.
- **Test your code**: Nobody else knows your code better than you. So, please, test your own code before submitting your pull request. PHPWord uses [PHPUnit](http://phpunit.de/) as our testing framework.
- **Request pull in separate branch**: Do not submit your request to the master branch, but create a separate branch named specifically for the issue that you addressed. Read [GitHub manual](https://help.github.com/articles/using-pull-requests) to find out more about this. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get you familiar with forks and how git works in general.
- **Be brief, but be bold**. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement them right away. The world will be better with limitless innovations.
- **Follow PHP-FIG standards**. We follow PHP Standards Recommendations (PSRs) by [PHP Framework Interoperability Group](http://www.php-fig.org/). If you're not familiar with these standards, [familiarize yourself now](https://github.com/php-fig/fig-standards). Also, please run `composer fix` to automatically fix your code to match these recommendations.
- **Test your code**. No one knows your code better than you, so we depend on you to test the changes you make before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and request that you use this tool too. Tests can be ran with `composer test`. [Documentation for writing tests with PHPUnit is available on Read the Docs.](https://phpunit.readthedocs.io)
- **Use best practices when submitting pull requests**. Create a separate branch named specifically for the issue that you are addressing. Read the [GitHub manual](https://help.github.com/articles/about-pull-requests) to learn more about pull requests and GitHub. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get yourself familiar with forks and how git works in general. [This video](http://www.youtube.com/watch?v=-zvHQXnBO6c) explains how to synchronize your fork on GitHub with the upstream branch from PHPWord.
## Getting Started
1. [Clone](https://help.github.com/en/articles/cloning-a-repository) [PHPWord](https://github.com/PHPOffice/PHPWord/)
2. [Install Composer](https://getcomposer.org/download/) if you don't already have it
3. Open your terminal and:
1. Switch to the directory PHPWord was cloned to (e.g., `cd ~/Projects/PHPWord/`)
2. Run `composer install` to install the dependencies
You're ready to start working on PHPWord! Tests belong in the `/tests/PhpWord/` directory, the source code is in `/src/PhpWord/`, and any documentation should go in `/docs/`. Familiarize yourself with the codebase and try your hand at fixing [one of our outstanding issues](https://github.com/PHPOffice/PHPWord/issues). Before you get started, check the [existing pull requests](https://github.com/PHPOffice/PHPWord/pulls) to make sure no one else is already working on it.
Once you have an issue you want to start working on, you'll need to write tests for it, and then you can start implementing the changes necessary to pass the new tests. To run the tests, you can run one of the following commands in your terminal:
- `composer test-no-coverage` to run all of the tests
- `composer test` to run all of the tests and generate test coverage reports
When you're ready to submit your new (and fully tested) feature, ensure `composer check` passes and [submit a pull request to PHPWord](https://github.com/PHPOffice/PHPWord/issues/new).
That's it. Thank you for your interest in PHPWord, and welcome!
May the Force be with you.
May the Force be with you.

674
COPYING Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

165
COPYING.LESSER Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

15
LICENSE Normal file
View File

@ -0,0 +1,15 @@
PHPWord, a pure PHP library for reading and writing word processing documents.
Copyright (c) 2010-2016 PHPWord.
PHPWord is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3 as published by
the Free Software Foundation.
PHPWord is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
You should have received a copy of the GNU Lesser General Public License version 3
along with PHPWord. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,345 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

191
README.md
View File

@ -1,112 +1,163 @@
# ![PHPWord](https://rawgit.com/PHPOffice/PHPWord/develop/docs/images/phpword.svg "PHPWord")
[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPWord)
[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword)
[![CI](https://github.com/PHPOffice/PHPWord/actions/workflows/ci.yml/badge.svg)](https://github.com/PHPOffice/PHPWord/actions/workflows/ci.yml)
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
[![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads.png)](https://packagist.org/packages/phpoffice/phpword)
[![Latest Unstable Version](https://poser.pugx.org/phpoffice/phpword/v/unstable.png)](https://packagist.org/packages/phpoffice/phpword)
[![License](https://poser.pugx.org/phpoffice/phpword/license.png)](https://packagist.org/packages/phpoffice/phpword)
[![Join the chat at https://gitter.im/PHPOffice/PHPWord](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPWord)
PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF.
PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), and [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF).
PHPWord is an open source project licensed under the terms of [LGPL version 3](COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://github.com/PHPOffice/PHPWord/actions) and unit testing. You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/).
With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your PHP 5.3+ scripts. Below are some of the things that you can do with PHPWord library:
If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)
* Set document properties, e.g. title, subject, and creator.
* Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
* Create header and footer for each sections
* Set default font type, font size, and paragraph style
* Use UTF-8 and East Asia fonts/characters
* Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text
* Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
* Insert titles (headers) and table of contents
* Insert text breaks and page breaks
* Insert and format images, either local, remote, or as page watermarks
* Insert binary OLE Objects such as Excel or Visio
* Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
* Insert list items as bulleted, numbered, or multilevel
* Insert hyperlinks
* Insert footnotes and endnotes
* Create document from templates
* Use XSL 1.0 style sheets to transform main document part of OOXML template
* ... and many more features on progress
Read more about PHPWord:
__Want to contribute?__ [Fork us](https://github.com/PHPOffice/PHPWord/fork) or [submit](https://github.com/PHPOffice/PHPWord/issues) your bug reports or feature requests to us.
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting started](#getting-started)
- [Contributing](#contributing)
- [Developers' Documentation](http://phpword.readthedocs.org/)
## Features
With PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP scripts. Below are some of the things that you can do with PHPWord library:
- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text
- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Insert drawing shapes (arc, curve, line, polyline, rect, oval)
- Insert charts (pie, doughnut, bar, line, area, scatter, radar)
- Insert form fields (textinput, checkbox, and dropdown)
- Create document from templates
- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template
- ... and many more features on progress
## Requirements
* PHP 5.3+
* PHP [Zip](http://php.net/manual/en/book.zip.php) extension
* PHP [XML Parser](http://www.php.net/manual/en/xml.installation.php) extension
### Optional PHP extensions
* PHP [GD](http://php.net/manual/en/book.image.php) extension
* PHP [XMLWriter](http://php.net/manual/en/book.xmlwriter.php) extension
* PHP [XSL](http://php.net/manual/en/book.xsl.php) extension
PHPWord requires the following:
- PHP 7.1+
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [Laminas Escaper component](https://docs.laminas.dev/laminas-escaper/intro/)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)
## Installation
It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add
the following lines to your ``composer.json``.
PHPWord is installed via [Composer](https://getcomposer.org/).
To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to PHPWord in your project, either
```json
{
"require": {
"phpoffice/phpword": "dev-master"
}
}
Run the following to use the latest stable version
```sh
composer require phpoffice/phpword
```
or if you want the latest unreleased version
```sh
composer require phpoffice/phpword:dev-master
```
Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPWord/releases).
In this case, you will have to register the autoloader.
## Getting started
The following is a basic usage example of the PHPWord library.
```php
require_once 'path/to/PhpWord/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
```
<?php
require_once 'bootstrap.php';
## Basic usage
The following is a basic example of the PHPWord library. More examples are provided in the [samples folder](samples/).
```php
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Every element you want to append to the word document is placed in a section.
// To create a basic section:
/* Note: any element you append to a document must reside inside of a Section. */
// Adding an empty Section to the document...
$section = $phpWord->addSection();
// Adding Text element to the Section having font styled by default...
$section->addText(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
);
// After creating a section, you can append elements:
$section->addText('Hello world!');
/*
* Note: it's possible to customize font style of the Text element you add in three ways:
* - inline;
* - using named font style (new font style object will be implicitly created);
* - using explicitly created font style object.
*/
// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.',
array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
// Adding Text element with font customized inline...
$section->addText(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)',
array('name' => 'Tahoma', 'size' => 10)
);
// If you often need the same style again you can create a user defined style
// to the word document and give the addText function the name of the style:
$phpWord->addFontStyle('myOwnStyle',
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style',
'myOwnStyle');
// Adding Text element with font customized using named font style...
$fontStyleName = 'oneUserDefinedStyle';
$phpWord->addFontStyle(
$fontStyleName,
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
);
$section->addText(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)',
$fontStyleName
);
// You can also put the appended element to local object like this:
// Adding Text element with font customized using explicitly created font style object...
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Verdana');
$fontStyle->setSize(22);
$myTextElement = $section->addText('Hello World!');
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
$myTextElement->setFontStyle($fontStyle);
// Finally, write the document:
// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');
// Saving the document as ODF file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('helloWorld.odt');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
$objWriter->save('helloWorld.rtf');
// Saving the document as HTML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('helloWorld.html');
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
```
## Documentation
More examples are provided in the [samples folder](samples/). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http://localhost:8000](http://localhost:8000) to view the samples.
You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) for more detail.
__Want to know more?__ Read the full documentation of PHPWord on [Read The Docs](http://phpword.readthedocs.org/).
## Contributing
We welcome everyone to contribute to PHPWord. Below are some of the things that you can do to contribute.
- Read [our contributing guide](CONTRIBUTING.md).
- [Fork us](https://github.com/PHPOffice/PHPWord/fork) and [request a pull](https://github.com/PHPOffice/PHPWord/pulls) to the [master](https://github.com/PHPOffice/PHPWord/tree/master) branch.
- Submit [bug reports or feature requests](https://github.com/PHPOffice/PHPWord/issues) to GitHub.
- Follow [@PHPWord](https://twitter.com/PHPWord) and [@PHPOffice](https://twitter.com/PHPOffice) on Twitter.

28
bootstrap.php Normal file
View File

@ -0,0 +1,28 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
*
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2018 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
$vendorDirPath = realpath(__DIR__ . '/vendor');
if (file_exists($vendorDirPath . '/autoload.php')) {
require $vendorDirPath . '/autoload.php';
} else {
throw new Exception(
sprintf(
'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
$vendorDirPath . '/autoload.php'
)
);
}

View File

@ -1,14 +1,14 @@
{
"name": "phpoffice/phpword",
"description": "PHPWord - Read, Create, and Write DOCX, ODT, and RTF documents in PHP",
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
"keywords": [
"PHP", "PhpOffice", "office", "PhpWord", "word", "template", "reader", "writer",
"PHP", "PHPOffice", "office", "PHPWord", "word", "template", "template processor", "reader", "writer",
"docx", "OOXML", "OpenXML", "Office Open XML", "ISO IEC 29500", "WordprocessingML",
"RTF", "Rich Text Format", "doc", "odt", "OpenDocument"
"RTF", "Rich Text Format", "doc", "odt", "ODF", "OpenDocument", "PDF", "HTML"
],
"homepage": "http://phpoffice.github.io",
"homepage": "https://phpword.readthedocs.io/",
"type": "library",
"license": "LGPL-2.1+",
"license": "LGPL-3.0",
"authors": [
{
"name": "Mark Baker"
@ -20,7 +20,7 @@
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
"homepage": "https://rootslabs.net/blog/"
},
{
"name": "Ivan Lanin",
@ -29,25 +29,68 @@
{
"name": "Roman Syroeshko",
"homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
},
{
"name": "Antoine de Troostembergh"
}
],
"scripts": {
"test": [
"phpunit --color=always"
],
"test-no-coverage": [
"phpunit --color=always --no-coverage"
],
"check": [
"php-cs-fixer fix --ansi --dry-run --diff",
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"@test-no-coverage"
],
"fix": [
"php-cs-fixer fix --ansi"
]
},
"scripts-descriptions": {
"test": "Runs all unit tests",
"test-no-coverage": "Runs all unit tests, without code coverage",
"check": "Runs PHP CheckStyle and PHP Mess detector",
"fix": "Fixes issues found by PHP-CS"
},
"require": {
"php": ">=5.3.3",
"php": "^7.1|^8.0",
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*",
"ext-zip": "*"
"laminas/laminas-escaper": ">=2.6"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"ext-zip": "*",
"ext-gd": "*",
"ext-libxml": "*",
"dompdf/dompdf": "^2.0",
"mpdf/mpdf": "^8.1",
"phpmd/phpmd": "^2.13",
"phpunit/phpunit": ">=7.0",
"tecnickcom/tcpdf": "^6.5",
"symfony/process": "^4.4",
"friendsofphp/php-cs-fixer": "^3.3"
},
"suggest": {
"ext-gd2": "Required to add images",
"ext-xmlwriter": "Required to write DOCX and ODT",
"ext-xsl": "Required to apply XSL style sheet to template part",
"dompdf/dompdf": "Required to write PDF"
"ext-zip": "Allows writing OOXML and ODF",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing OOXML and ODF",
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"dompdf/dompdf": "Allows writing PDF"
},
"autoload": {
"psr-4": {
"PhpOffice\\PhpWord\\": "src/PhpWord"
}
},
"autoload-dev": {
"psr-4": {
"PhpOffice\\PhpWordTests\\": "tests/PhpWordTests"
}
}
}

View File

@ -77,17 +77,17 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PhpWord.qhcp"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PHPWord.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PhpWord.qhc"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PHPWord.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PhpWord"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PhpWord"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PHPWord"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PHPWord"
@echo "# devhelp"
epub:

View File

@ -40,15 +40,15 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'PhpWord'
copyright = u'2014, Progi1984'
project = u'PHPWord'
copyright = u'2014-2021, PHPWord Contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.9.0'
version = '0.18.2'
# The full version, including alpha/beta/rc tags.
release = version
@ -120,7 +120,7 @@ html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
@ -164,7 +164,7 @@ html_static_path = ['_static']
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'PhpWorddoc'
htmlhelp_basename = 'PHPWorddoc'
# -- Options for LaTeX output --------------------------------------------------
@ -183,8 +183,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'PhpWord.tex', u'PhpWord Documentation',
u'The PhpWord Team', 'manual'),
('index', 'PHPWord.tex', u'PHPWord Documentation',
u'The PHPWord Team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -213,8 +213,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'PhpWord', u'PhpWord Documentation',
[u'The PhpWord Team'], 1)
('index', 'PHPWord', u'PHPWord Documentation',
[u'The PHPWord Team'], 1)
]
# If true, show URL addresses after external links.
@ -227,8 +227,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'PhpWord', u'PhpWord Documentation',
u'The PhpWord Team', 'PhpWord', 'One line description of project.',
('index', 'PHPWord', u'PHPWord Documentation',
u'The PHPWord Team', 'PHPWord', 'One line description of project.',
'Miscellaneous'),
]
@ -244,9 +244,9 @@ texinfo_documents = [
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'PhpWord'
epub_author = u'The PhpWord Team'
epub_publisher = u'The PhpWord Team'
epub_title = u'PHPWord'
epub_author = u'The PHPWord Team'
epub_publisher = u'The PHPWord Team'
epub_copyright = copyright
# The language of the text. It defaults to the language option

View File

@ -16,57 +16,24 @@ section, use the following code:
.. code-block:: php
$section = $phpWord->addSection($sectionSettings);
$section = $phpWord->addSection($sectionStyle);
The ``$sectionSettings`` is an optional associative array that sets the
The ``$sectionStyle`` is an optional associative array that sets the
section. Example:
.. code-block:: php
$sectionSettings = array(
$sectionStyle = array(
'orientation' => 'landscape',
'marginTop' => 600,
'colsNum' => 2,
);
Section settings
~~~~~~~~~~~~~~~~
Below are the available settings for section:
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
'landscape'
- ``marginTop`` Page margin top in twips
- ``marginLeft`` Page margin left in twips
- ``marginRight`` Page margin right in twips
- ``marginBottom`` Page margin bottom in twips
- ``borderTopSize`` Border top size in twips
- ``borderTopColor`` Border top color
- ``borderLeftSize`` Border left size in twips
- ``borderLeftColor`` Border left color
- ``borderRightSize`` Border right size in twips
- ``borderRightColor`` Border right color
- ``borderBottomSize`` Border bottom size in twips
- ``borderBottomColor`` Border bottom color
- ``headerHeight`` Spacing to top of header
- ``footerHeight`` Spacing to bottom of footer
- ``gutter`` Page gutter spacing
- ``colsNum`` Number of columns
- ``colsSpace`` Spacing between columns
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
evenPage, oddPage)
The following two settings are automatically set by the use of the
``orientation`` setting. You can alter them but that's not recommended.
- ``pageSizeW`` Page width in twips
- ``pageSizeH`` Page height in twips
Page number
~~~~~~~~~~~
You can change a section page number by using the ``pageNumberingStart``
property of the section.
style of the section.
.. code-block:: php
@ -75,13 +42,13 @@ property of the section.
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setPageNumberingStart(1);
$section->getStyle()->setPageNumberingStart(1);
Multicolumn
~~~~~~~~~~~
You can change a section layout to multicolumn (like in a newspaper) by
using the ``breakType`` and ``colsNum`` property of the section.
using the ``breakType`` and ``colsNum`` style of the section.
.. code-block:: php
@ -90,14 +57,14 @@ using the ``breakType`` and ``colsNum`` property of the section.
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setBreakType('continuous');
$section->getSettings()->setColsNum(2);
$section->getStyle()->setBreakType('continuous');
$section->getStyle()->setColsNum(2);
### Line numbering
Line numbering
~~~~~~~~~~~~~~
You can apply line numbering to a section by using the ``lineNumbering``
property of the section.
style of the section.
.. code-block:: php
@ -106,14 +73,15 @@ property of the section.
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setLineNumbering(array());
$section->getStyle()->setLineNumbering(array());
Below are the properties of the line numbering style.
- ``start`` Line numbering starting value
- ``increment`` Line number increments
- ``distance`` Distance between text and line numbering in twip
- ``restart`` Line numbering restart setting continuous|newPage|newSection
- ``distance`` Distance between text and line numbering in *twip*
- ``restart`` Line numbering restart setting
continuous\|newPage\|newSection
Headers
-------
@ -130,6 +98,18 @@ that are available for the footer. See "Footer" section for detail.
Additionally, only inside of the header reference you can add watermarks
or background pictures. See "Watermarks" section.
You can pass an optional parameter to specify where the header/footer should be applied, it can be
- ``Footer::AUTO`` default, all pages except if overridden by first or even
- ``Footer::FIRST`` each first page of the section
- ``Footer::EVEN`` each even page of the section. Will only be applied if the evenAndOddHeaders is set to true in phpWord->settings
To change the evenAndOddHeaders use the ``getSettings`` method to return the Settings object, and then call the ``setEvenAndOddHeaders`` method:
.. code-block:: php
$phpWord->getSettings()->setEvenAndOddHeaders(true);
Footers
-------

View File

@ -17,7 +17,7 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 4 | Title | v | ? | ? | ? | ? | ? |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 5 | Preserve Text | ? | v | v | v\* | ? | ? |
| 5 | Preserve Text | ? | v | v | v\* | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 6 | Text Break | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
@ -25,13 +25,13 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 8 | List | v | v | v | v | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 9 | Table | v | v | v | ? | - | - |
| 9 | Table | v | v | v | v | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 10 | Image | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 11 | Watermark | - | v | - | - | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 12 | Object | v | v | v | v | v | v |
| 12 | OLEObject | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 13 | TOC | v | - | - | - | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
@ -39,120 +39,69 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 15 | Endnote | v | - | - | v\*\* | v\*\* | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 16 | CheckBox | v | v | v | v | ? | ? |
| 16 | CheckBox | v | v | v | v | v | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 17 | TextBox | v | v | v | v | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 18 | Field | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 19 | Line | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 20 | Chart | v | | | v | | |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
Legend:
- ``v`` Available
- ``v*`` Available only when inside header/footer
- ``v**`` Available only when inside section
- ``-`` Not available
- ``?`` Should be available
- ``v``. Available.
- ``v*``. Available only when inside header/footer.
- ``v**``. Available only when inside section.
- ``-``. Not available.
- ``?``. Should be available.
Texts
-----
Text can be added by using ``addText`` and ``addTextRun`` method.
``addText`` is used for creating simple paragraphs that only contain
texts with the same style. ``addTextRun`` is used for creating complex
paragraphs that contain text with different style (some bold, other
italics, etc) or other elements, e.g. images or links. The syntaxes are
as follow:
Text can be added by using ``addText`` and ``addTextRun`` methods.
``addText`` is used for creating simple paragraphs that only contain texts with the same style.
``addTextRun`` is used for creating complex paragraphs that contain text with different style (some bold, other
italics, etc) or other elements, e.g. images or links. The syntaxes are as follow:
.. code-block:: php
$section->addText($text, [$fontStyle], [$paragraphStyle]);
$textrun = $section->addTextRun([$paragraphStyle]);
Text styles
~~~~~~~~~~~
- ``$text``. Text to be displayed in the document.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
define text formatting. There are 2 options to style the inserted text
elements, i.e. inline style by using array or defined style by adding
style definition.
For available styling options see :ref:`font-style` and :ref:`paragraph-style`.
Inline style examples:
If you want to enable track changes on added text you can mark it as INSERTED or DELETED by a specific user at a given time:
.. code-block:: php
$fontStyle = array('name' => 'Times New Roman', 'size' => 9);
$paragraphStyle = array('align' => 'both');
$section->addText('I am simple paragraph', $fontStyle, $paragraphStyle);
$textrun = $section->addTextRun();
$textrun->addText('I am bold', array('bold' => true));
$textrun->addText('I am italic', array('italic' => true));
$textrun->addText('I am colored, array('color' => 'AACC00'));
Defined style examples:
.. code-block:: php
$fontStyle = array('color' => '006699', 'size' => 18, 'bold' => true);
$phpWord->addFontStyle('fStyle', $fontStyle);
$text = $section->addText('Hello world!', 'fStyle');
$paragraphStyle = array('align' => 'center');
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
$text = $section->addText('Hello world!', 'pStyle');
Font style
^^^^^^^^^^
Available font styles:
- ``name`` Font name, e.g. *Arial*
- ``size`` Font size, e.g. *20*, *22*,
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
- ``bold`` Bold, *true* or *false*
- ``italic`` Italic, *true* or *false*
- ``superScript`` Superscript, *true* or *false*
- ``subScript`` Subscript, *true* or *false*
- ``underline`` Underline, *dash*, *dotted*, etc.
- ``strikethrough`` Strikethrough, *true* or *false*
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
- ``color`` Font color, e.g. *FF0000*
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
- ``bgColor`` Font background color, e.g. *FF0000*
- ``smallCaps`` Small caps, *true* or *false*
- ``allCaps`` All caps, *true* or *false*
Paragraph style
^^^^^^^^^^^^^^^
Available paragraph styles:
- ``align`` Paragraph alignment, *left*, *right* or *center*
- ``spaceBefore`` Space before paragraph
- ``spaceAfter`` Space after paragraph
- ``indent`` Indent by how much
- ``hanging`` Hanging by how much
- ``basedOn`` Parent style
- ``next`` Style for next paragraph
- ``widowControl`` Allow first/last line to display on a separate page,
*true* or *false*
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
- ``keepLines`` Keep all lines on one page, *true* or *false*
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
- ``tabs`` Set of custom tab stops
$text = $section->addText('Hello World!');
$text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime()));
Titles
~~~~~~
If you want to structure your document or build table of contents, you
need titles or headings. To add a title to the document, use the
``addTitleStyle`` and ``addTitle`` method.
If you want to structure your document or build table of contents, you need titles or headings.
To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` method.
If `depth` is 0, a Title will be inserted, otherwise a Heading1, Heading2, ...
.. code-block:: php
$phpWord->addTitleStyle($depth, [$fontStyle], [$paragraphStyle]);
$section->addTitle($text, [$depth]);
Its necessary to add a title style to your document because otherwise
the title won't be detected as a real title.
- ``depth``.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
- ``$text``. Text to be displayed in the document. This can be `string` or a `\PhpOffice\PhpWord\Element\TextRun`
It's necessary to add a title style to your document because otherwise the title won't be detected as a real title.
Links
~~~~~
@ -163,16 +112,15 @@ You can add Hyperlinks to the document by using the function addLink:
$section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle]);
- ``$linkSrc`` The URL of the link.
- ``$linkName`` Placeholder of the URL that appears in the document.
- ``$fontStyle`` See "Font style" section.
- ``$paragraphStyle`` See "Paragraph style" section.
- ``$linkSrc``. The URL of the link.
- ``$linkName``. Placeholder of the URL that appears in the document.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
Preserve texts
~~~~~~~~~~~~~~
The ``addPreserveText`` method is used to add a page number or page
count to headers or footers.
The ``addPreserveText`` method is used to add a page number or page count to headers or footers.
.. code-block:: php
@ -184,90 +132,80 @@ Breaks
Text breaks
~~~~~~~~~~~
Text breaks are empty new lines. To add text breaks, use the following
syntax. All paramaters are optional.
Text breaks are empty new lines. To add text breaks, use the following syntax. All parameters are optional.
.. code-block:: php
$section->addTextBreak([$breakCount], [$fontStyle], [$paragraphStyle]);
- ``$breakCount`` How many lines
- ``$fontStyle`` See "Font style" section.
- ``$paragraphStyle`` See "Paragraph style" section.
- ``$breakCount``. How many lines.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
Page breaks
~~~~~~~~~~~
There are two ways to insert a page breaks, using the ``addPageBreak``
There are two ways to insert a page break, using the ``addPageBreak``
method or using the ``pageBreakBefore`` style of paragraph.
:: code-block:: php
.. code-block:: php
\\$section->addPageBreak();
$section->addPageBreak();
Lists
-----
To add a list item use the function ``addListItem``.
Lists can be added by using ``addListItem`` and ``addListItemRun`` methods.
``addListItem`` is used for creating lists that only contain plain text.
``addListItemRun`` is used for creating complex list items that contains texts
with different style (some bold, other italics, etc) or other elements, e.g.
images or links. The syntaxes are as follow:
Basic usage:
.. code-block:: php
$section->addListItem($text, [$depth], [$fontStyle], [$listStyle], [$paragraphStyle]);
$listItemRun = $section->addListItemRun([$depth], [$listStyle], [$paragraphStyle])
Parameters:
- ``$text`` Text that appears in the document.
- ``$depth`` Depth of list item.
- ``$fontStyle`` See "Font style" section.
- ``$listStyle`` List style of the current element TYPE\_NUMBER,
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in
PHPWord\_Style\_ListItem.
- ``$paragraphStyle`` See "Paragraph style" section.
- ``$text``. Text that appears in the document.
- ``$depth``. Depth of list item.
- ``$fontStyle``. See :ref:`font-style`.
- ``$listStyle``. List style of the current element TYPE\_NUMBER,
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
See ``Sample_09_Tables.php`` for more code sample.
Advanced usage:
You can also create your own numbering style by changing the
``$listStyle`` parameter with the name of your numbering style.
You can also create your own numbering style by changing the ``$listStyle`` parameter with the name of your numbering style.
.. code-block:: php
$phpWord->addNumberingStyle(
'multilevel',
array('type' => 'multilevel', 'levels' => array(
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
array(
'type' => 'multilevel',
'levels' => array(
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
)
)
)
);
$section->addListItem('List Item I', 0, null, 'multilevel');
$section->addListItem('List Item I.a', 1, null, 'multilevel');
$section->addListItem('List Item I.b', 1, null, 'multilevel');
$section->addListItem('List Item II', 0, null, 'multilevel');
Level styles:
- ``start`` Starting value
- ``format`` Numbering format
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
- ``restart`` Restart numbering level symbol
- ``suffix`` Content between numbering symbol and paragraph text
tab\|space\|nothing
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
character
- ``align`` Numbering symbol align left\|center\|right\|both
- ``left`` See paragraph style
- ``hanging`` See paragraph style
- ``tabPos`` See paragraph style
- ``font`` Font name
- ``hint`` See font style
For available styling options see :ref:`numbering-level-style`.
Tables
------
To add tables, rows, and cells, use the ``addTable``, ``addRow``, and
``addCell`` methods:
To add tables, rows, and cells, use the ``addTable``, ``addRow``, and ``addCell`` methods:
.. code-block:: php
@ -281,46 +219,19 @@ Table style can be defined with ``addTableStyle``:
$tableStyle = array(
'borderColor' => '006699',
'borderSize' => 6,
'cellMargin' => 50
'borderSize' => 6,
'cellMargin' => 50
);
$firstRowStyle = array('bgColor' => '66BBFF');
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
$table = $section->addTable('myTable');
Table, row, and cell styles
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Table styles:
- ``width`` Table width in percent
- ``bgColor`` Background color, e.g. '9966CC'
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
Row styles:
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
- ``exactHeight`` Row height is exact or at least
Cell styles:
- ``width`` Cell width in twips
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
- ``textDirection`` Direction of text
- ``bgColor`` Background color, e.g. '9966CC'
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
- ``gridSpan`` Number of columns spanned
- ``vMerge`` *restart* or *continue*
For available styling options see :ref:`table-style`.
Cell span
~~~~~~~~~
You can span a cell on multiple columns by using ``gridSpan`` or
multiple rows by using ``vMerge``.
You can span a cell on multiple columns by using ``gridSpan`` or multiple rows by using ``vMerge``.
.. code-block:: php
@ -332,15 +243,14 @@ See ``Sample_09_Tables.php`` for more code sample.
Images
------
To add an image, use the ``addImage`` method to sections, headers,
footers, textruns, or table cells.
To add an image, use the ``addImage`` method to sections, headers, footers, textruns, or table cells.
.. code-block:: php
$section->addImage($src, [$style]);
- source String path to a local image or URL of a remote image
- styles Array fo styles for the image. See below.
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. Warning: Do not pass user-generated strings here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing file paths or URLs instead of image data.
- ``$style``. See :ref:`image-style`.
Examples:
@ -350,10 +260,10 @@ Examples:
$section->addImage(
'mars.jpg',
array(
'width' => 100,
'height' => 100,
'marginTop' => -1,
'marginLeft' => -1,
'width' => 100,
'height' => 100,
'marginTop' => -1,
'marginLeft' => -1,
'wrappingStyle' => 'behind'
)
);
@ -361,19 +271,8 @@ Examples:
$footer->addImage('http://example.com/image.php');
$textrun = $section->addTextRun();
$textrun->addImage('http://php.net/logo.jpg');
Image styles
~~~~~~~~~~~~
Available image styles:
- ``width`` Width in pixels
- ``height`` Height in pixels
- ``align`` Image alignment, *left*, *right*, or *center*
- ``marginTop`` Top margin in inches, can be negative
- ``marginLeft`` Left margin in inches, can be negative
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
*behind*, or *infront*
$source = file_get_contents('/path/to/my/images/earth.jpg');
$textrun->addImage($source);
Watermarks
~~~~~~~~~~
@ -392,35 +291,32 @@ Objects
-------
You can add OLE embeddings, such as Excel spreadsheets or PowerPoint
presentations to the document by using ``addObject`` method.
presentations to the document by using ``addOLEObject`` method.
.. code-block:: php
$section->addObject($src, [$style]);
$section->addOLEObject($src, [$style]);
Table of contents
-----------------
To add a table of contents (TOC), you can use the ``addTOC`` method.
Your TOC can only be generated if you have add at least one title (See
"Titles").
Your TOC can only be generated if you have add at least one title (See "Titles").
.. code-block:: php
$section->addTOC([$fontStyle], [$tocStyle], [$minDepth], [$maxDepth]);
- ``$fontStyle``: See font style section
- ``$tocStyle``: See available options below
- ``$minDepth``: Minimum depth of header to be shown. Default 1
- ``$maxDepth``: Maximum depth of header to be shown. Default 9
- ``$fontStyle``. See font style section.
- ``$tocStyle``. See available options below.
- ``$minDepth``. Minimum depth of header to be shown. Default 1.
- ``$maxDepth``. Maximum depth of header to be shown. Default 9.
Options for ``$tocStyle``:
- ``tabLeader`` Fill type between the title text and the page number.
Use the defined constants in PHPWord\_Style\_TOC.
- ``tabPos`` The position of the tab where the page number appears in
twips.
- ``indent`` The indent factor of the titles in twips.
- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``.
- ``tabPos``. The position of the tab where the page number appears in *twip*.
- ``indent``. The indent factor of the titles in *twip*.
Footnotes & endnotes
--------------------
@ -428,7 +324,7 @@ Footnotes & endnotes
You can create footnotes with ``addFootnote`` and endnotes with
``addEndnote`` in texts or textruns, but it's recommended to use textrun
to have better layout. You can use ``addText``, ``addLink``,
``addTextBreak``, ``addImage``, ``addObject`` on footnotes and endnotes.
``addTextBreak``, ``addImage``, ``addOLEObject`` on footnotes and endnotes.
On textrun:
@ -454,22 +350,163 @@ On text:
$footnote = $section->addFootnote();
$footnote->addText('Footnote text.');
The footnote reference number will be displayed with decimal number
starting from 1. This number use ``FooterReference`` style which you can
redefine by ``addFontStyle`` method. Default value for this style is
By default the footnote reference number will be displayed with decimal number
starting from 1. This number uses the ``FooterReference`` style which you can
redefine with the ``addFontStyle`` method. Default value for this style is
``array('superScript' => true)``;
The footnote numbering can be controlled by setting the FootnoteProperties on the Section.
.. code-block:: php
$fp = new \PhpOffice\PhpWord\ComplexType\FootnoteProperties();
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
$fp->setPos(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::POSITION_BENEATH_TEXT);
//set the number format to use (decimal (default), upperRoman, upperLetter, ...)
$fp->setNumFmt(\PhpOffice\PhpWord\SimpleType\NumberFormat::LOWER_ROMAN);
//force starting at other than 1
$fp->setNumStart(2);
//when to restart counting (continuous (default), eachSect, eachPage)
$fp->setNumRestart(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
//And finaly, set it on the Section
$section->setFootnoteProperties($fp);
Checkboxes
----------
Checkbox elements can be added to sections or table cells by using
``addCheckBox``.
Checkbox elements can be added to sections or table cells by using ``addCheckBox``.
.. code-block:: php
$section->addCheckBox($name, $text, [$fontStyle], [$paragraphStyle])
- ``$name`` Name of the check box.
- ``$text`` Text following the check box
- ``$fontStyle`` See "Font style" section.
- ``$paragraphStyle`` See "Paragraph style" section.
- ``$name``. Name of the check box.
- ``$text``. Text to be displayed in the document.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
Textboxes
---------
To be completed
Fields
------
Currently the following fields are supported:
- PAGE
- NUMPAGES
- DATE
- XE
- INDEX
.. code-block:: php
$section->addField($fieldType, [$properties], [$options], [$fieldText], [$fontStyle])
- ``$fontStyle``. See :ref:`font-style`.
See ``\PhpOffice\PhpWord\Element\Field`` for list of properties and options available for each field type.
Options which are not specifically defined can be added. Those must start with a ``\``.
For instance for the INDEX field, you can do the following (See `Index Field for list of available options <https://support.office.com/en-us/article/Field-codes-Index-field-adafcf4a-cb30-43f6-85c7-743da1635d9e?ui=en-US&rs=en-US&ad=US>`_ ):
.. code-block:: php
//the $fieldText can be either a simple string
$fieldText = 'The index value';
//or a 'TextRun', to be able to format the text you want in the index
$fieldText = new TextRun();
$fieldText->addText('My ');
$fieldText->addText('bold index', ['bold' => true]);
$fieldText->addText(' entry');
$section->addField('XE', array(), array(), $fieldText);
//this actually adds the index
$section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), 'right click to update index');
Line
----
Line elements can be added to sections by using ``addLine``.
.. code-block:: php
$lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552);
$section->addLine($lineStyle);
Available line style attributes:
- ``weight``. Line width in *twip*.
- ``color``. Defines the color of stroke.
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
- ``endArrow``. End type of arrow: block, open, classic, diamond, oval.
- ``width``. Line-object width in *pt*.
- ``height``. Line-object height in *pt*.
- ``flip``. Flip the line element: true, false.
Chart
-----
Charts can be added using
.. code-block:: php
$categories = array('A', 'B', 'C', 'D', 'E');
$series = array(1, 3, 2, 5, 4);
$chart = $section->addChart('line', $categories, $series, $style);
For available styling options see :ref:`chart-style`.
check out the Sample_32_Chart.php for more options and styling.
Comments
--------
Comments can be added to a document by using ``addComment``.
The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``.
.. code-block:: php
// first create a comment
$comment= new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
$comment->addText('Test', array('bold' => true));
// add it to the document
$phpWord->addComment($comment);
$textrun = $section->addTextRun();
$textrun->addText('This ');
$text = $textrun->addText('is');
// link the comment to the text you just created
$text->setCommentStart($comment);
If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on.
Track Changes
-------------
Track changes can be set on text elements. There are 2 ways to set the change information on an element.
Either by calling the `setChangeInfo()`, or by setting the `TrackChange` instance on the element with `setTrackChange()`.
.. code-block:: php
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section
$section = $phpWord->addSection();
$textRun = $section->addTextRun();
$text = $textRun->addText('Hello World! Time to ');
$text = $textRun->addText('wake ', array('bold' => true));
$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);
$text = $textRun->addText('up');
$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));
$text = $textRun->addText('go to sleep');
$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));

View File

@ -3,18 +3,6 @@
Frequently asked questions
==========================
Is this the same with PHPWord that I found in CodePlex?
-------------------------------------------------------
No. This one is much better with tons of new features that you cant
find in PHPWord 0.6.3. The development in CodePlex is halted and
switched to GitHub to allow more participation from the crowd. The more
the merrier, right?
Ive been running PHPWord from CodePlex flawlessly, but I cant use the latest PHPWord from GitHub. Why?
--------------------------------------------------------------------------------------------------------
PHPWord requires PHP 5.3+ since 0.8, while PHPWord 0.6.3 from CodePlex
can run with PHP 5.2. Theres a lot of new features that we can get from
PHP 5.3 and its been around since 2009! You should upgrade your PHP
version to use PHPWord 0.8+.
How contribute to PHPWord?
--------------------------
- Improve the documentation (`Sphinx Format <http://documentation-style-guide-sphinx.readthedocs.org/en/latest/index.html>`__)

View File

@ -12,49 +12,76 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
.. code-block:: php
require_once 'src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
<?php
require_once 'bootstrap.php';
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Every element you want to append to the word document is placed in a section.
// To create a basic section:
/* Note: any element you append to a document must reside inside of a Section. */
// Adding an empty Section to the document...
$section = $phpWord->addSection();
// Adding Text element to the Section having font styled by default...
$section->addText(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
);
// After creating a section, you can append elements:
$section->addText('Hello world!');
/*
* Note: it's possible to customize font style of the Text element you add in three ways:
* - inline;
* - using named font style (new font style object will be implicitly created);
* - using explicitly created font style object.
*/
// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.',
array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
// Adding Text element with font customized inline...
$section->addText(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)',
array('name' => 'Tahoma', 'size' => 10)
);
// If you often need the same style again you can create a user defined style
// to the word document and give the addText function the name of the style:
$phpWord->addFontStyle('myOwnStyle',
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style',
'myOwnStyle');
// Adding Text element with font customized using named font style...
$fontStyleName = 'oneUserDefinedStyle';
$phpWord->addFontStyle(
$fontStyleName,
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
);
$section->addText(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)',
$fontStyleName
);
// You can also put the appended element to local object like this:
// Adding Text element with font customized using explicitly created font style object...
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Verdana');
$fontStyle->setSize(22);
$myTextElement = $section->addText('Hello World!');
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
$myTextElement->setFontStyle($fontStyle);
// Finally, write the document:
// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');
// Saving the document as ODF file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('helloWorld.odt');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
$objWriter->save('helloWorld.rtf');
// Saving the document as HTML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('helloWorld.html');
Settings
--------
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
PHPWord Settings
----------------
The ``PhpOffice\PhpWord\Settings`` class provides some options that will
affect the behavior of PHPWord. Below are the options.
@ -79,19 +106,42 @@ during development to make the resulting XML file easier to read.
Zip class
~~~~~~~~~
By default, PHPWord uses PHP
`ZipArchive <http://php.net/manual/en/book.zip.php>`__ to read or write
ZIP compressed archive and the files inside them. If you can't have
ZipArchive installed on your server, you can use pure PHP library
alternative, `PCLZip <http://www.phpconcept.net/pclzip/>`__, which
included with PHPWord.
By default, PHPWord uses `Zip extension <http://php.net/manual/en/book.zip.php>`__
to deal with ZIP compressed archives and files inside them. If you can't have
Zip extension installed on your server, you can use pure PHP library
alternative, `PclZip <http://www.phpconcept.net/pclzip/>`__, which is
included in PHPWord.
.. code-block:: php
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);
Output escaping
~~~~~~~~~~~~~~~
Writing documents of some formats, especially XML-based, requires correct output escaping.
Without it your document may become broken when you put special characters like ampersand, quotes, and others in it.
Escaping can be performed in two ways: outside of the library by a software developer and inside of the library by built-in mechanism.
By default, the built-in mechanism is disabled for backward compatibility with versions prior to v0.13.0.
To turn it on set ``outputEscapingEnabled`` option to ``true`` in your PHPWord configuration file or use the following instruction at runtime:
.. code-block:: php
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
Default Paper
~~~~~~~~~~~~~
By default, all sections of the document will print on A4 paper.
You can alter the default paper by using the following function:
.. code-block:: php
\PhpOffice\PhpWord\Settings::setDefaultPaper('Letter');
Default font
------------
~~~~~~~~~~~~
By default, every text appears in Arial 10 point. You can alter the
default font by using the following two functions:
@ -101,15 +151,102 @@ default font by using the following two functions:
$phpWord->setDefaultFontName('Times New Roman');
$phpWord->setDefaultFontSize(12);
Document properties
-------------------
Document settings
-----------------
Settings for the generated document can be set using ``$phpWord->getSettings()``
You can set the document properties such as title, creator, and company
Magnification Setting
~~~~~~~~~~~~~~~~~~~~~
The default zoom value is 100 percent. This can be changed either to another percentage
.. code-block:: php
$phpWord->getSettings()->setZoom(75);
Or to predefined values ``fullPage``, ``bestFit``, ``textFit``
.. code-block:: php
$phpWord->getSettings()->setZoom(Zoom::BEST_FIT);
Mirroring the Page Margins
~~~~~~~~~~~~~~~~~~~~~~~~~~
Use mirror margins to set up facing pages for double-sided documents, such as books or magazines.
.. code-block:: php
$phpWord->getSettings()->setMirrorMargins(true);
Spelling and grammatical checks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default spelling and grammatical errors are shown as soon as you open a word document.
For big documents this can slow down the opening of the document. You can hide the spelling and/or grammatical errors with:
.. code-block:: php
$phpWord->getSettings()->setHideGrammaticalErrors(true);
$phpWord->getSettings()->setHideSpellingErrors(true);
You can also specify the status of the spell and grammar checks, marking spelling or grammar as dirty will force a re-check when opening the document.
.. code-block:: php
$proofState = new \PhpOffice\PhpWord\ComplexType\ProofState();
$proofState->setGrammar(\PhpOffice\PhpWord\ComplexType\ProofState::CLEAN);
$proofState->setSpelling(\PhpOffice\PhpWord\ComplexType\ProofState::DIRTY);
$phpWord->getSettings()->setProofState($proofState);
Track Revisions
~~~~~~~~~~~~~~~
Track changes can be activated using ``setTrackRevisions``, you can furture specify
- Not to use move syntax, instead moved items will be seen as deleted in one place and added in another
- Not track formatting revisions
.. code-block:: php
$phpWord->getSettings()->setTrackRevisions(true);
$phpWord->getSettings()->setDoNotTrackMoves(true);
$phpWord->getSettings()->setDoNotTrackFormatting(true);
Decimal Symbol
~~~~~~~~~~~~~~
The default symbol to represent a decimal figure is the ``.`` in english. In french you might want to change it to ``,`` for instance.
.. code-block:: php
$phpWord->getSettings()->setDecimalSymbol(',');
Document Language
~~~~~~~~~~~~~~~~~
The default language of the document can be change with the following.
.. code-block:: php
$phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE));
``Language`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages.
A couple of language codes are provided in the ``PhpOffice\PhpWord\Style\Language`` class but any valid code/ID can be used.
In case you are generating an RTF document the language need to be set differently.
.. code-block:: php
$lang = new Language();
$lang->setLangId(Language::EN_GB_ID);
$phpWord->getSettings()->setThemeFontLang($lang);
Document information
--------------------
You can set the document information such as title, creator, and company
name. Use the following functions:
.. code-block:: php
$properties = $phpWord->getDocumentProperties();
$properties = $phpWord->getDocInfo();
$properties->setCreator('My name');
$properties->setCompany('My factory');
$properties->setTitle('My title');
@ -128,19 +265,80 @@ The base length unit in Open Office XML is twip. Twip means "TWentieth
of an Inch Point", i.e. 1 twip = 1/1440 inch.
You can use PHPWord helper functions to convert inches, centimeters, or
points to twips.
points to twip.
.. code-block:: php
// Paragraph with 6 points space after
$phpWord->addParagraphStyle('My Style', array(
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
'spaceAfter' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(6))
);
$section = $phpWord->addSection();
$sectionStyle = $section->getSettings();
$sectionStyle = $section->getStyle();
// half inch left margin
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5));
// 2 cm right margin
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2));
Document protection
-------------------
The document (or parts of it) can be password protected.
.. code-block:: php
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(DocProtect::READ_ONLY);
$documentProtection->setPassword('myPassword');
Automatically Recalculate Fields on Open
----------------------------------------
To force an update of the fields present in the document, set updateFields to true
.. code-block:: php
$phpWord->getSettings()->setUpdateFields(true);
Hyphenation
-----------
Hyphenation describes the process of breaking words with hyphens. There are several options to control hyphenation.
Auto hyphenation
~~~~~~~~~~~~~~~~
To automatically hyphenate text set ``autoHyphenation`` to ``true``.
.. code-block:: php
$phpWord->getSettings()->setAutoHyphenation(true);
Consecutive Hyphen Limit
~~~~~~~~~~~~~~~~~~~~~~~~
The maximum number of consecutive lines of text ending with a hyphen can be controlled by the ``consecutiveHyphenLimit`` option.
There is no limit if the option is not set or the provided value is ``0``.
.. code-block:: php
$phpWord->getSettings()->setConsecutiveHyphenLimit(2);
Hyphenation Zone
~~~~~~~~~~~~~~~~
The hyphenation zone (in *twip*) is the allowed amount of whitespace before hyphenation is applied.
The smaller the hyphenation zone the more words are hyphenated. Or in other words, the wider the hyphenation zone the less words are hyphenated.
.. code-block:: php
$phpWord->getSettings()->setHyphenationZone(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1));
Hyphenate Caps
~~~~~~~~~~~~~~
To control whether or not words in all capital letters shall be hyphenated use the `doNotHyphenateCaps` option.
.. code-block:: php
$phpWord->getSettings()->setDoNotHyphenateCaps(true);

View File

@ -18,11 +18,12 @@ Format (RTF).
:maxdepth: 2
intro
setup
installing
general
containers
elements
templates
styles
templates-processing
writersreaders
recipes
faq

48
docs/installing.rst Normal file
View File

@ -0,0 +1,48 @@
.. _setup:
Installing/configuring
======================
Requirements
------------
Mandatory:
- composer
- PHP 7.1+
- `XML Parser <http://www.php.net/manual/en/xml.installation.php>`__ extension
Optional:
- `Zip <http://php.net/manual/en/book.zip.php>`__ extension
- `GD <http://php.net/manual/en/book.image.php>`__ extension
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__ extension
- `XSL <http://php.net/manual/en/book.xsl.php>`__ extension
- `dompdf <https://github.com/dompdf/dompdf>`__ library
Installation
------------
PHPWord is installed via `Composer <https://getcomposer.org/>`__.
You just need to `add dependency <https://getcomposer.org/doc/04-schema.md#package-links>`__ on PHPWord into your package.
Example:
.. code-block:: bash
composer require phpoffice/phpword
If you are a developer or if you want to help us with testing then fetch the latest branch for developers.
Notice: all contributions must be done against the developer branch.
Example:
.. code-block:: bash
composer require phpoffice/phpword:dev-master
Using samples
-------------
More examples are provided in the ``samples`` directory.
For an easy access to those samples launch ``php -S localhost:8000`` in the samples directory then browse to http://localhost:8000 to view the samples.

View File

@ -12,47 +12,44 @@ Applications <http://en.wikipedia.org/wiki/OpenDocument>`__
(OpenDocument or ODF), and `Rich Text
Format <http://en.wikipedia.org/wiki/Rich_Text_Format>`__ (RTF).
No Windows operating system is needed for usage because the resulting
DOCX, ODT, or RTF files can be opened by all major `word processing
softwares <http://en.wikipedia.org/wiki/List_of_word_processors>`__.
PHPWord is an open source project licensed under LGPL. PHPWord is `unit
tested <https://travis-ci.org/PHPOffice/PHPWord>`__ to make sure that
the released versions are stable.
**Want to contribute?** `Fork
us <https://github.com/PHPOffice/PHPWord/fork>`__ or
`submit <https://github.com/PHPOffice/PHPWord/issues>`__ your bug
reports or feature requests to us.
PHPWord is an open source project licensed under the terms of `LGPL
version 3 <https://github.com/PHPOffice/PHPWord/blob/master/COPYING.LESSER>`__.
PHPWord is aimed to be a high quality software product.
You can learn more about PHPWord by reading this Developers'
Documentation.
Features
--------
- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g.
portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- Define custom font styles (e.g. bold, italic, color) and paragraph
styles (e.g. centered, multicolumns, spacing) either as named style
or inline in text
- Insert paragraphs, either as a simple text or complex one (a text
run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows
(e.g. repeat as header row) and cells (e.g. background color,
rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Create document from templates
- Use XSL 1.0 style sheets to transform main document part of OOXML
template
- ... and many more features on progress
- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g.
portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- Define custom font styles (e.g. bold, italic, color) and paragraph
styles (e.g. centered, multicolumns, spacing) either as named style
or inline in text
- Insert paragraphs, either as a simple text or complex one (a text
run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert right-to-left text
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows
(e.g. repeat as header row) and cells (e.g. background color,
rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Insert drawing shapes (arc, curve, line, polyline, rect, oval)
- Insert charts (pie, doughnut, bar, line, area, scatter, radar)
- Insert form fields (textinput, checkbox, and dropdown)
- Insert comments
- Create document from templates
- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template
- ... and many more features on progress
File formats
------------
@ -63,33 +60,31 @@ Writers
~~~~~~~
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| Features | | DOCX | ODT | RTF | HTML | PDF |
| Features | | OOXML | ODF | RTF | HTML | PDF |
+===========================+======================+========+=======+=======+========+=======+
| **Document Properties** | Standard | ✓ | | | | |
| **Document Properties** | Standard | ✓ | ✓ | ✓ | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Extended | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | UserDefined | ✓ | | | | |
| | Custom | ✓ | ✓ | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| **Element Type** | Text | ✓ | ✓ | ✓ | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Text Run | ✓ | ✓ | ✓ | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Title | ✓ | | | ✓ | ✓ |
| | Title | ✓ | | | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Link | ✓ | ✓ | | ✓ | ✓ |
| | Link | ✓ | ✓ | | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Preserve Text | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Text Break | ✓ | ✓ | ✓ | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Page Break | ✓ | | | | |
| | Page Break | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | List | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Table | ✓ | ✓ | | ✓ | ✓ |
| | Table | ✓ | ✓ | | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Image | ✓ | ✓ | | ✓ | |
| | Image | ✓ | ✓ | | ✓ | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Object | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
@ -105,11 +100,13 @@ Writers
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | Endnote | ✓ | | | ✓ | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| **Graphs** | 2D basic graphs | | | | | |
| | Comments | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| **Graphs** | 2D basic graphs | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | 2D advanced graphs | | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| | 3D graphs | | | | | |
| | 3D graphs | | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
| **Math** | OMML support | | | | | |
+---------------------------+----------------------+--------+-------+-------+--------+-------+
@ -123,60 +120,77 @@ Writers
Readers
~~~~~~~
+---------------------------+----------------------+--------+-------+-------+
| Features | | DOCX | ODT | RTF |
+===========================+======================+========+=======+=======+
| **Document Properties** | Standard | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Extended | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | UserDefined | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| **Element Type** | Text | ✓ | ✓ | |
+---------------------------+----------------------+--------+-------+-------+
| | Text Run | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Title | ✓ | ✓ | |
+---------------------------+----------------------+--------+-------+-------+
| | Link | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Preserve Text | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Text Break | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Page Break | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | List | ✓ | ✓ | |
+---------------------------+----------------------+--------+-------+-------+
| | Table | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Image | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Object | | | |
+---------------------------+----------------------+--------+-------+-------+
| | Watermark | | | |
+---------------------------+----------------------+--------+-------+-------+
| | Table of Contents | | | |
+---------------------------+----------------------+--------+-------+-------+
| | Header | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Footer | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Footnote | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| | Endnote | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+
| **Graphs** | 2D basic graphs | | | |
+---------------------------+----------------------+--------+-------+-------+
| | 2D advanced graphs | | | |
+---------------------------+----------------------+--------+-------+-------+
| | 3D graphs | | | |
+---------------------------+----------------------+--------+-------+-------+
| **Math** | OMML support | | | |
+---------------------------+----------------------+--------+-------+-------+
| | MathML support | | | |
+---------------------------+----------------------+--------+-------+-------+
| **Bonus** | Encryption | | | |
+---------------------------+----------------------+--------+-------+-------+
| | Protection | | | |
+---------------------------+----------------------+--------+-------+-------+
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| Features | | OOXML | DOC | ODF | RTF | HTML |
+===========================+======================+========+=======+=======+=======+=======+
| **Document Properties** | Standard | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Custom | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Element Type** | Text | ✓ | ✓ | ✓ | ✓ | ✓ |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Text Run | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Title | ✓ | | ✓ | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Link | ✓ | ✓ | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Preserve Text | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Text Break | ✓ | ✓ | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Page Break | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | List | ✓ | | ✓ | | ✓ |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Table | ✓ | | | | ✓ |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Image | ✓ | ✓ | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Object | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Watermark | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Table of Contents | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Header | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Footer | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Footnote | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Endnote | ✓ | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Comments | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Graphs** | 2D basic graphs | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | 2D advanced graphs | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | 3D graphs | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Math** | OMML support | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | MathML support | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| **Bonus** | Encryption | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
| | Protection | | | | | |
+---------------------------+----------------------+--------+-------+-------+-------+-------+
Contributing
------------
We welcome everyone to contribute to PHPWord. Below are some of the
things that you can do to contribute.
- Read `our contributing
guide <https://github.com/PHPOffice/PHPWord/blob/master/CONTRIBUTING.md>`__.
- `Fork us <https://github.com/PHPOffice/PHPWord/fork>`__ and `request
a pull <https://github.com/PHPOffice/PHPWord/pulls>`__ to the
`master <https://github.com/PHPOffice/PHPWord/tree/master>`__
branch.
- Submit `bug reports or feature
requests <https://github.com/PHPOffice/PHPWord/issues>`__ to GitHub.
- Follow `@PHPWord <https://twitter.com/PHPWord>`__ and
`@PHPOffice <https://twitter.com/PHPOffice>`__ on Twitter.

View File

@ -2,3 +2,96 @@
Recipes
=======
Create float left image
-----------------------
Use absolute positioning relative to margin horizontally and to line vertically.
.. code-block:: php
$imageStyle = array(
'width' => 40,
'height' => 40,
'wrappingStyle' => 'square',
'positioning' => 'absolute',
'posHorizontalRel' => 'margin',
'posVerticalRel' => 'line',
);
$textrun->addImage('resources/_earth.jpg', $imageStyle);
$textrun->addText($lipsumText);
Download the produced file automatically
----------------------------------------
Use ``php://output`` as the filename.
.. code-block:: php
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText('Hello World!');
$file = 'HelloWorld.docx';
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save("php://output");
Create numbered headings
------------------------
Define a numbering style and title styles, and match the two styles (with ``pStyle`` and ``numStyle``) like below.
.. code-block:: php
$phpWord->addNumberingStyle(
'hNum',
array('type' => 'multilevel', 'levels' => array(
array('pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'),
array('pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'),
array('pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'),
)
)
);
$phpWord->addTitleStyle(1, array('size' => 16), array('numStyle' => 'hNum', 'numLevel' => 0));
$phpWord->addTitleStyle(2, array('size' => 14), array('numStyle' => 'hNum', 'numLevel' => 1));
$phpWord->addTitleStyle(3, array('size' => 12), array('numStyle' => 'hNum', 'numLevel' => 2));
$section->addTitle('Heading 1', 1);
$section->addTitle('Heading 2', 2);
$section->addTitle('Heading 3', 3);
Add a link within a title
-------------------------
Apply 'HeadingN' paragraph style to TextRun or Link. Sample code:
.. code-block:: php
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addTitleStyle(1, array('size' => 16, 'bold' => true));
$phpWord->addTitleStyle(2, array('size' => 14, 'bold' => true));
$phpWord->addFontStyle('Link', array('color' => '0000FF', 'underline' => 'single'));
$section = $phpWord->addSection();
// Textrun
$textrun = $section->addTextRun('Heading1');
$textrun->addText('The ');
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord', 'Link');
// Link
$section->addLink('https://github.com/', 'GitHub', 'Link', 'Heading2');
Remove [Compatibility Mode] text in the MS Word title bar
---------------------------------------------------------
Use the ``Metadata\Compatibility\setOoxmlVersion(n)`` method with ``n`` is the version of Office (14 = Office 2010, 15 = Office 2013).
.. code-block:: php
$phpWord->getCompatibility()->setOoxmlVersion(15);

View File

@ -3,18 +3,26 @@
References
==========
ISO/IEC 29500, Third edition, 2012-09-01
----------------------------------------
- `Part 1: Fundamentals and Markup Language Reference
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061750_ISO_IEC_29500-1_2012.zip>`__
- `Part 2: Open Packaging Conventions
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061796_ISO_IEC_29500-2_2012.zip>`__
- `Part 3: Markup Compatibility and Extensibility
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061797_ISO_IEC_29500-3_2012.zip>`__
- `Part 4: Transitional Migration Features
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061798_ISO_IEC_29500-4_2012.zip>`__
Formal specifications
---------------------
- `Office Open XML (OOXML) (ECMA-376)
Schema <http://www.schemacentral.com/sc/ooxml/ss.html>`__
- `Oasis OpenDocument Standard Version
1.2 <http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html>`__
- `Rich Text Format (RTF) Specification, version
1.9.1 <http://www.microsoft.com/en-us/download/details.aspx?id=10725>`__
- `Oasis OpenDocument Standard Version 1.2 <http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html>`__
- `Rich Text Format (RTF) Specification, version 1.9.1 <http://www.microsoft.com/en-us/download/details.aspx?id=10725>`__
Other resources
---------------
- `DocumentFormat.OpenXml.Wordprocessing Namespace on
MSDN <http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx>`__
- `DocumentFormat.OpenXml.Wordprocessing Namespace on
MSDN <http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx>`__

View File

@ -1,64 +0,0 @@
.. _setup:
Installing/configuring
======================
Requirements
------------
Mandatory:
- PHP 5.3+
- PHP `Zip <http://php.net/manual/en/book.zip.php>`__ extension
- PHP `XML
Parser <http://www.php.net/manual/en/xml.installation.php>`__
extension
Optional PHP extensions:
- `GD <http://php.net/manual/en/book.image.php>`__
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__
- `XSL <http://php.net/manual/en/book.xsl.php>`__
Installation
------------
There are two ways to install PHPWord, i.e. via
`Composer <http://getcomposer.org/>`__ or manually by downloading the
library.
Using Composer
~~~~~~~~~~~~~~
To install via Composer, add the following lines to your
``composer.json``:
.. code-block:: json
{
"require": {
"phpoffice/phpword": "dev-master"
}
}
Manual install
~~~~~~~~~~~~~~
To install manually, `download PHPWord package from
github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
Extract the package and put the contents to your machine. To use the
library, include ``src/PhpWord/Autoloader.php`` in your script and
invoke ``Autoloader::register``.
.. code-block:: php
require_once '/path/to/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
Using samples
-------------
After installation, you can browse and use the samples that we've
provided, either by command line or using browser. If you can access
your PHPWord library folder using browser, point your browser to the
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.

View File

@ -1,950 +0,0 @@
<!---
Markdown source for rst files since it's easier to write in md format.
This source file will be converted to rst using pandoc or any other converter.
Don't forget to change `code::` directive to `code-block::` in the resulting rst.
-->
# Contents
- [Introduction](#introduction)
- [Features](#features)
- [File formats](#file-formats)
- [Installing/configuring](#installing-configuring)
- [Requirements](#requirements)
- [Installation](#installation)
- [Using samples](#using-samples)
- [General usage](#general-usage)
- [Basic example](#basic-example)
- [Settings](#settings)
- [Default font](#default-font)
- [Document properties](#document-properties)
- [Measurement units](#measurement-units)
- [Containers](#containers)
- [Sections](#sections)
- [Headers](#headers)
- [Footers](#footers)
- [Other containers](#other-containers)
- [Elements](#elements)
- [Texts](#texts)
- [Breaks](#breaks)
- [Lists](#lists)
- [Tables](#tables)
- [Images](#images)
- [Objects](#objects)
- [Table of contents](#table-of-contents)
- [Footnotes & endnotes](#footnotes-endnotes)
- [Checkboxes](#checkboxes)
- [Templates](#templates)
- [Writers & readers](#writers-readers)
- [OOXML](#ooxml)
- [OpenDocument](#opendocument)
- [RTF](#rtf)
- [HTML](#html)
- [PDF](#pdf)
- [Frequently asked questions](#frequently-asked-questions)
- [References](#references)
# Introduction
PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), and [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF).
No Windows operating system is needed for usage because the resulting DOCX, ODT, or RTF files can be opened by all major [word processing softwares](http://en.wikipedia.org/wiki/List_of_word_processors).
PHPWord is an open source project licensed under LGPL. PHPWord is [unit tested](https://travis-ci.org/PHPOffice/PHPWord) to make sure that the released versions are stable.
**Want to contribute?** [Fork us](https://github.com/PHPOffice/PHPWord/fork) or [submit](https://github.com/PHPOffice/PHPWord/issues) your bug reports or feature requests to us.
## Features
- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text
- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Create document from templates
- Use XSL 1.0 style sheets to transform main document part of OOXML template
- ... and many more features on progress
## File formats
Below are the supported features for each file formats.
### Writers
| Features | | DOCX | ODT | RTF | HTML | PDF |
|-------------------------|--------------------|------|-----|-----|------|-----|
| **Document Properties** | Standard | ✓ | | | | |
| | Extended | ✓ | | | | |
| | UserDefined | ✓ | | | | |
| **Element Type** | Text | ✓ | ✓ | ✓ | ✓ | ✓ |
| | Text Run | ✓ | ✓ | ✓ | ✓ | ✓ |
| | Title | ✓ | | | ✓ | ✓ |
| | Link | ✓ | ✓ | | ✓ | ✓ |
| | Preserve Text | ✓ | | | | |
| | Text Break | ✓ | ✓ | ✓ | ✓ | ✓ |
| | Page Break | ✓ | | | | |
| | List | ✓ | | | | |
| | Table | ✓ | ✓ | | ✓ | ✓ |
| | Image | ✓ | ✓ | | ✓ | |
| | Object | ✓ | | | | |
| | Watermark | ✓ | | | | |
| | Table of Contents | ✓ | | | | |
| | Header | ✓ | | | | |
| | Footer | ✓ | | | | |
| | Footnote | ✓ | | | ✓ | |
| | Endnote | ✓ | | | ✓ | |
| **Graphs** | 2D basic graphs | | | | | |
| | 2D advanced graphs | | | | | |
| | 3D graphs | | | | | |
| **Math** | OMML support | | | | | |
| | MathML support | | | | | |
| **Bonus** | Encryption | | | | | |
| | Protection | | | | | |
### Readers
| Features | | DOCX | ODT | RTF |
|-------------------------|--------------------|------|-----|-----|
| **Document Properties** | Standard | ✓ | | |
| | Extended | ✓ | | |
| | UserDefined | ✓ | | |
| **Element Type** | Text | ✓ | ✓ | |
| | Text Run | ✓ | | |
| | Title | ✓ | ✓ | |
| | Link | ✓ | | |
| | Preserve Text | ✓ | | |
| | Text Break | ✓ | | |
| | Page Break | ✓ | | |
| | List | ✓ | ✓ | |
| | Table | ✓ | | |
| | Image | ✓ | | |
| | Object | | | |
| | Watermark | | | |
| | Table of Contents | | | |
| | Header | ✓ | | |
| | Footer | ✓ | | |
| | Footnote | ✓ | | |
| | Endnote | ✓ | | |
| **Graphs** | 2D basic graphs | | | |
| | 2D advanced graphs | | | |
| | 3D graphs | | | |
| **Math** | OMML support | | | |
| | MathML support | | | |
| **Bonus** | Encryption | | | |
| | Protection | | | |
# Installing/configuring
## Requirements
Mandatory:
- PHP 5.3+
- PHP [Zip](http://php.net/manual/en/book.zip.php) extension
- PHP [XML Parser](http://www.php.net/manual/en/xml.installation.php) extension
Optional PHP extensions:
- [GD](http://php.net/manual/en/book.image.php)
- [XMLWriter](http://php.net/manual/en/book.xmlwriter.php)
- [XSL](http://php.net/manual/en/book.xsl.php)
## Installation
There are two ways to install PHPWord, i.e. via [Composer](http://getcomposer.org/) or manually by downloading the library.
### Using Composer
To install via Composer, add the following lines to your `composer.json`:
```json
{
"require": {
"phpoffice/phpword": "dev-master"
}
}
```
### Manual install
To install manually, [download PHPWord package from github](https://github.com/PHPOffice/PHPWord/archive/master.zip). Extract the package and put the contents to your machine. To use the library, include `src/PhpWord/Autoloader.php` in your script and invoke `Autoloader::register`.
```php
require_once '/path/to/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
```
## Using samples
After installation, you can browse and use the samples that we've provided, either by command line or using browser. If you can access your PHPWord library folder using browser, point your browser to the `samples` folder, e.g. `http://localhost/PhpWord/samples/`.
# General usage
## Basic example
The following is a basic example of the PHPWord library. More examples are provided in the [samples folder](https://github.com/PHPOffice/PHPWord/tree/master/samples/).
```php
require_once 'src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Every element you want to append to the word document is placed in a section.
// To create a basic section:
$section = $phpWord->addSection();
// After creating a section, you can append elements:
$section->addText('Hello world!');
// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.',
array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
// If you often need the same style again you can create a user defined style
// to the word document and give the addText function the name of the style:
$phpWord->addFontStyle('myOwnStyle',
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style',
'myOwnStyle');
// You can also put the appended element to local object like this:
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Verdana');
$fontStyle->setSize(22);
$myTextElement = $section->addText('Hello World!');
$myTextElement->setFontStyle($fontStyle);
// Finally, write the document:
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('helloWorld.odt');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
$objWriter->save('helloWorld.rtf');
```
## Settings
The `PhpOffice\PhpWord\Settings` class provides some options that will affect the behavior of PHPWord. Below are the options.
### XML Writer compatibility
This option sets [XMLWriter::setIndent](http://www.php.net/manual/en/function.xmlwriter-set-indent.php) and [XMLWriter::setIndentString](http://www.php.net/manual/en/function.xmlwriter-set-indent-string.php). The default value of this option is `true` (compatible), which is [required for OpenOffice](https://github.com/PHPOffice/PHPWord/issues/103) to render OOXML document correctly. You can set this option to `false` during development to make the resulting XML file easier to read.
```php
\PhpOffice\PhpWord\Settings::setCompatibility(false);
```
### Zip class
By default, PHPWord uses PHP [ZipArchive](http://php.net/manual/en/book.zip.php) to read or write ZIP compressed archive and the files inside them. If you can't have ZipArchive installed on your server, you can use pure PHP library alternative, [PCLZip](http://www.phpconcept.net/pclzip/), which included with PHPWord.
```php
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);
```
## Default font
By default, every text appears in Arial 10 point. You can alter the default font by using the following two functions:
```php
$phpWord->setDefaultFontName('Times New Roman');
$phpWord->setDefaultFontSize(12);
```
## Document properties
You can set the document properties such as title, creator, and company name. Use the following functions:
```php
$properties = $phpWord->getDocumentProperties();
$properties->setCreator('My name');
$properties->setCompany('My factory');
$properties->setTitle('My title');
$properties->setDescription('My description');
$properties->setCategory('My category');
$properties->setLastModifiedBy('My name');
$properties->setCreated(mktime(0, 0, 0, 3, 12, 2014));
$properties->setModified(mktime(0, 0, 0, 3, 14, 2014));
$properties->setSubject('My subject');
$properties->setKeywords('my, key, word');
```
## Measurement units
The base length unit in Open Office XML is twip. Twip means "TWentieth of an Inch Point", i.e. 1 twip = 1/1440 inch.
You can use PHPWord helper functions to convert inches, centimeters, or points to twips.
```php
// Paragraph with 6 points space after
$phpWord->addParagraphStyle('My Style', array(
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
);
$section = $phpWord->addSection();
$sectionStyle = $section->getSettings();
// half inch left margin
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
// 2 cm right margin
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));
```
# Containers
Containers are objects where you can put elements (texts, lists, tables, etc). There are 3 main containers, i.e. sections, headers, and footers. There are 3 elements that can also act as containers, i.e. textruns, table cells, and footnotes.
## Sections
Every visible element in word is placed inside of a section. To create a section, use the following code:
```php
$section = $phpWord->addSection($sectionSettings);
```
The `$sectionSettings` is an optional associative array that sets the section. Example:
```php
$sectionSettings = array(
'orientation' => 'landscape',
'marginTop' => 600,
'colsNum' => 2,
);
```
### Section settings
Below are the available settings for section:
- `orientation` Page orientation, i.e. 'portrait' (default) or 'landscape'
- `marginTop` Page margin top in twips
- `marginLeft` Page margin left in twips
- `marginRight` Page margin right in twips
- `marginBottom` Page margin bottom in twips
- `borderTopSize` Border top size in twips
- `borderTopColor` Border top color
- `borderLeftSize` Border left size in twips
- `borderLeftColor` Border left color
- `borderRightSize` Border right size in twips
- `borderRightColor` Border right color
- `borderBottomSize` Border bottom size in twips
- `borderBottomColor` Border bottom color
- `headerHeight` Spacing to top of header
- `footerHeight` Spacing to bottom of footer
- `gutter` Page gutter spacing
- `colsNum` Number of columns
- `colsSpace` Spacing between columns
- `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
The following two settings are automatically set by the use of the `orientation` setting. You can alter them but that's not recommended.
- `pageSizeW` Page width in twips
- `pageSizeH` Page height in twips
### Page number
You can change a section page number by using the `pageNumberingStart` property of the section.
```php
// Method 1
$section = $phpWord->addSection(array('pageNumberingStart' => 1));
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setPageNumberingStart(1);
```
### Multicolumn
You can change a section layout to multicolumn (like in a newspaper) by using the `breakType` and `colsNum` property of the section.
```php
// Method 1
$section = $phpWord->addSection(array('breakType' => 'continuous', 'colsNum' => 2));
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setBreakType('continuous');
$section->getSettings()->setColsNum(2);
```
### Line numbering
You can apply line numbering to a section by using the `lineNumbering` property of the section.
```php
// Method 1
$section = $phpWord->addSection(array('lineNumbering' => array()));
// Method 2
$section = $phpWord->addSection();
$section->getSettings()->setLineNumbering(array());
```
Below are the properties of the line numbering style.
- `start` Line numbering starting value
- `increment` Line number increments
- `distance` Distance between text and line numbering in twip
- `restart` Line numbering restart setting continuous|newPage|newSection
## Headers
Each section can have its own header reference. To create a header use the `addHeader` method:
```php
$header = $section->addHeader();
```
Be sure to save the result in a local object. You can use all elements that are available for the footer. See "Footer" section for detail. Additionally, only inside of the header reference you can add watermarks or background pictures. See "Watermarks" section.
## Footers
Each section can have its own footer reference. To create a footer, use the `addFooter` method:
```php
$footer = $section->addFooter();
```
Be sure to save the result in a local object to add elements to a footer. You can add the following elements to footers:
- Texts `addText` and `createTextrun`
- Text breaks
- Images
- Tables
- Preserve text
See the "Elements" section for the detail of each elements.
## Other containers
Textruns, table cells, and footnotes are elements that can also act as containers. See the corresponding "Elements" section for the detail of each elements.
# Elements
Below are the matrix of element availability in each container. The column shows the containers while the rows lists the elements.
| Num | Element | Section | Header | Footer | Cell | Text Run | Footnote |
|-----|---------------|---------|--------|--------|------|----------|----------|
| 1 | Text | v | v | v | v | v | v |
| 2 | Text Run | v | v | v | v | - | - |
| 3 | Link | v | v | v | v | v | v |
| 4 | Title | v | ? | ? | ? | ? | ? |
| 5 | Preserve Text | ? | v | v | v* | ? | ? |
| 6 | Text Break | v | v | v | v | v | v |
| 7 | Page Break | v | - | - | - | - | - |
| 8 | List | v | v | v | v | - | - |
| 9 | Table | v | v | v | ? | - | - |
| 10 | Image | v | v | v | v | v | v |
| 11 | Watermark | - | v | - | - | - | - |
| 12 | Object | v | v | v | v | v | v |
| 13 | TOC | v | - | - | - | - | - |
| 14 | Footnote | v | - | - | v** | v** | - |
| 15 | Endnote | v | - | - | v** | v** | - |
| 16 | CheckBox | v | v | v | v | ? | ? |
Legend:
- `v` Available
- `v*` Available only when inside header/footer
- `v**` Available only when inside section
- `-` Not available
- `?` Should be available
## Texts
Text can be added by using `addText` and `addTextRun` method. `addText` is used for creating simple paragraphs that only contain texts with the same style. `addTextRun` is used for creating complex paragraphs that contain text with different style (some bold, other italics, etc) or other elements, e.g. images or links. The syntaxes are as follow:
```php
$section->addText($text, [$fontStyle], [$paragraphStyle]);
$textrun = $section->addTextRun([$paragraphStyle]);
```
### Text styles
You can use the `$fontStyle` and `$paragraphStyle` variable to define text formatting. There are 2 options to style the inserted text elements, i.e. inline style by using array or defined style by adding style definition.
Inline style examples:
```php
$fontStyle = array('name' => 'Times New Roman', 'size' => 9);
$paragraphStyle = array('align' => 'both');
$section->addText('I am simple paragraph', $fontStyle, $paragraphStyle);
$textrun = $section->addTextRun();
$textrun->addText('I am bold', array('bold' => true));
$textrun->addText('I am italic', array('italic' => true));
$textrun->addText('I am colored, array('color' => 'AACC00'));
```
Defined style examples:
```php
$fontStyle = array('color' => '006699', 'size' => 18, 'bold' => true);
$phpWord->addFontStyle('fStyle', $fontStyle);
$text = $section->addText('Hello world!', 'fStyle');
$paragraphStyle = array('align' => 'center');
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
$text = $section->addText('Hello world!', 'pStyle');
```
#### Font style
Available font styles:
- `name` Font name, e.g. *Arial*
- `size` Font size, e.g. *20*, *22*,
- `hint` Font content type, *default*, *eastAsia*, or *cs*
- `bold` Bold, *true* or *false*
- `italic` Italic, *true* or *false*
- `superScript` Superscript, *true* or *false*
- `subScript` Subscript, *true* or *false*
- `underline` Underline, *dash*, *dotted*, etc.
- `strikethrough` Strikethrough, *true* or *false*
- `doubleStrikethrough` Double strikethrough, *true* or *false*
- `color` Font color, e.g. *FF0000*
- `fgColor` Font highlight color, e.g. *yellow*, *green*, *blue*
- `bgColor` Font background color, e.g. *FF0000*
- `smallCaps` Small caps, *true* or *false*
- `allCaps` All caps, *true* or *false*
#### Paragraph style
Available paragraph styles:
- `align` Paragraph alignment, *left*, *right* or *center*
- `spaceBefore` Space before paragraph
- `spaceAfter` Space after paragraph
- `indent` Indent by how much
- `hanging` Hanging by how much
- `basedOn` Parent style
- `next` Style for next paragraph
- `widowControl` Allow first/last line to display on a separate page, *true* or *false*
- `keepNext` Keep paragraph with next paragraph, *true* or *false*
- `keepLines` Keep all lines on one page, *true* or *false*
- `pageBreakBefore` Start paragraph on next page, *true* or *false*
- `lineHeight` text line height, e.g. *1.0*, *1.5*, ect...
- `tabs` Set of custom tab stops
### Titles
If you want to structure your document or build table of contents, you need titles or headings. To add a title to the document, use the `addTitleStyle` and `addTitle` method.
```php
$phpWord->addTitleStyle($depth, [$fontStyle], [$paragraphStyle]);
$section->addTitle($text, [$depth]);
```
Its necessary to add a title style to your document because otherwise the title won't be detected as a real title.
### Links
You can add Hyperlinks to the document by using the function addLink:
```php
$section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle]);
```
- `$linkSrc` The URL of the link.
- `$linkName` Placeholder of the URL that appears in the document.
- `$fontStyle` See "Font style" section.
- `$paragraphStyle` See "Paragraph style" section.
### Preserve texts
The `addPreserveText` method is used to add a page number or page count to headers or footers.
```php
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.');
```
## Breaks
### Text breaks
Text breaks are empty new lines. To add text breaks, use the following syntax. All paramaters are optional.
```php
$section->addTextBreak([$breakCount], [$fontStyle], [$paragraphStyle]);
```
- `$breakCount` How many lines
- `$fontStyle` See "Font style" section.
- `$paragraphStyle` See "Paragraph style" section.
### Page breaks
There are two ways to insert a page breaks, using the `addPageBreak` method or using the `pageBreakBefore` style of paragraph.
:: code-block:: php
> \$section-\>addPageBreak();
## Lists
To add a list item use the function `addListItem`.
Basic usage:
```php
$section->addListItem($text, [$depth], [$fontStyle], [$listStyle], [$paragraphStyle]);
```
Parameters:
- `$text` Text that appears in the document.
- `$depth` Depth of list item.
- `$fontStyle` See "Font style" section.
- `$listStyle` List style of the current element TYPE\_NUMBER, TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\_Style\_ListItem.
- `$paragraphStyle` See "Paragraph style" section.
Advanced usage:
You can also create your own numbering style by changing the `$listStyle` parameter with the name of your numbering style.
```php
$phpWord->addNumberingStyle(
'multilevel',
array('type' => 'multilevel', 'levels' => array(
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
)
)
);
$section->addListItem('List Item I', 0, null, 'multilevel');
$section->addListItem('List Item I.a', 1, null, 'multilevel');
$section->addListItem('List Item I.b', 1, null, 'multilevel');
$section->addListItem('List Item II', 0, null, 'multilevel');
```
Level styles:
- `start` Starting value
- `format` Numbering format bullet|decimal|upperRoman|lowerRoman|upperLetter|lowerLetter
- `restart` Restart numbering level symbol
- `suffix` Content between numbering symbol and paragraph text tab|space|nothing
- `text` Numbering level text e.g. %1 for nonbullet or bullet character
- `align` Numbering symbol align left|center|right|both
- `left` See paragraph style
- `hanging` See paragraph style
- `tabPos` See paragraph style
- `font` Font name
- `hint` See font style
## Tables
To add tables, rows, and cells, use the `addTable`, `addRow`, and `addCell` methods:
```php
$table = $section->addTable([$tableStyle]);
$table->addRow([$height], [$rowStyle]);
$cell = $table->addCell($width, [$cellStyle]);
```
Table style can be defined with `addTableStyle`:
```php
$tableStyle = array(
'borderColor' => '006699',
'borderSize' => 6,
'cellMargin' => 50
);
$firstRowStyle = array('bgColor' => '66BBFF');
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
$table = $section->addTable('myTable');
```
### Table, row, and cell styles
Table styles:
- `width` Table width in percent
- `bgColor` Background color, e.g. '9966CC'
- `border(Top|Right|Bottom|Left)Size` Border size in twips
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
- `cellMargin(Top|Right|Bottom|Left)` Cell margin in twips
Row styles:
- `tblHeader` Repeat table row on every new page, *true* or *false*
- `cantSplit` Table row cannot break across pages, *true* or *false*
- `exactHeight` Row height is exact or at least
Cell styles:
- `width` Cell width in twips
- `valign` Vertical alignment, *top*, *center*, *both*, *bottom*
- `textDirection` Direction of text
- `bgColor` Background color, e.g. '9966CC'
- `border(Top|Right|Bottom|Left)Size` Border size in twips
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
- `gridSpan` Number of columns spanned
- `vMerge` *restart* or *continue*
### Cell span
You can span a cell on multiple columns by using `gridSpan` or multiple rows by using `vMerge`.
```php
$cell = $table->addCell(200);
$cell->getStyle()->setGridSpan(5);
```
See `Sample_09_Tables.php` for more code sample.
## Images
To add an image, use the `addImage` method to sections, headers, footers, textruns, or table cells.
```php
$section->addImage($src, [$style]);
```
- source String path to a local image or URL of a remote image
- styles Array fo styles for the image. See below.
Examples:
```php
$section = $phpWord->addSection();
$section->addImage(
'mars.jpg',
array(
'width' => 100,
'height' => 100,
'marginTop' => -1,
'marginLeft' => -1,
'wrappingStyle' => 'behind'
)
);
$footer = $section->addFooter();
$footer->addImage('http://example.com/image.php');
$textrun = $section->addTextRun();
$textrun->addImage('http://php.net/logo.jpg');
```
### Image styles
Available image styles:
- `width` Width in pixels
- `height` Height in pixels
- `align` Image alignment, *left*, *right*, or *center*
- `marginTop` Top margin in inches, can be negative
- `marginLeft` Left margin in inches, can be negative
- `wrappingStyle` Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*
### Watermarks
To add a watermark (or page background image), your section needs a header reference. After creating a header, you can use the `addWatermark` method to add a watermark.
```php
$section = $phpWord->addSection();
$header = $section->addHeader();
$header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55));
```
## Objects
You can add OLE embeddings, such as Excel spreadsheets or PowerPoint presentations to the document by using `addObject` method.
```php
$section->addObject($src, [$style]);
```
## Table of contents
To add a table of contents (TOC), you can use the `addTOC` method. Your TOC can only be generated if you have add at least one title (See "Titles").
```php
$section->addTOC([$fontStyle], [$tocStyle], [$minDepth], [$maxDepth]);
```
- `$fontStyle`: See font style section
- `$tocStyle`: See available options below
- `$minDepth`: Minimum depth of header to be shown. Default 1
- `$maxDepth`: Maximum depth of header to be shown. Default 9
Options for `$tocStyle`:
- `tabLeader` Fill type between the title text and the page number. Use the defined constants in PHPWord\_Style\_TOC.
- `tabPos` The position of the tab where the page number appears in twips.
- `indent` The indent factor of the titles in twips.
## Footnotes & endnotes
You can create footnotes with `addFootnote` and endnotes with `addEndnote` in texts or textruns, but it's recommended to use textrun to have better layout. You can use `addText`, `addLink`, `addTextBreak`, `addImage`, `addObject` on footnotes and endnotes.
On textrun:
```php
$textrun = $section->addTextRun();
$textrun->addText('Lead text.');
$footnote = $textrun->addFootnote();
$footnote->addText('Footnote text can have ');
$footnote->addLink('http://test.com', 'links');
$footnote->addText('.');
$footnote->addTextBreak();
$footnote->addText('And text break.');
$textrun->addText('Trailing text.');
$endnote = $textrun->addEndnote();
$endnote->addText('Endnote put at the end');
```
On text:
```php
$section->addText('Lead text.');
$footnote = $section->addFootnote();
$footnote->addText('Footnote text.');
```
The footnote reference number will be displayed with decimal number starting from 1. This number use `FooterReference` style which you can redefine by `addFontStyle` method. Default value for this style is `array('superScript' => true)`;
## Checkboxes
Checkbox elements can be added to sections or table cells by using `addCheckBox`.
```php
$section->addCheckBox($name, $text, [$fontStyle], [$paragraphStyle])
```
- `$name` Name of the check box.
- `$text` Text following the check box
- `$fontStyle` See "Font style" section.
- `$paragraphStyle` See "Paragraph style" section.
# Templates
You can create a docx template with included search-patterns that can be replaced by any value you wish. Only single-line values can be replaced. To load a template file, use the `loadTemplate` method. After loading the docx template, you can use the `setValue` method to change the value of a search pattern. The search-pattern model is: `${search-pattern}`. It is not possible to add new PHPWord elements to a loaded template file.
Example:
```php
$template = $phpWord->loadTemplate('Template.docx');
$template->setValue('Name', 'Somebody someone');
$template->setValue('Street', 'Coming-Undone-Street 32');
```
See `Sample_07_TemplateCloneRow.php` for example on how to create multirow from a single row in a template by using `cloneRow`.
See `Sample_23_TemplateBlock.php` for example on how to clone a block of text using `cloneBlock` and delete a block of text using `deleteBlock`.
# Writers & readers
## OOXML
The package of OOXML document consists of the following files.
- _rels/
- .rels
- docProps/
- app.xml
- core.xml
- custom.xml
- word/
- rels/
- document.rels.xml
- media/
- theme/
- theme1.xml
- document.xml
- fontTable.xml
- numbering.xml
- settings.xml
- styles.xml
- webSettings.xml
- [Content_Types].xml
## OpenDocument
### Package
The package of OpenDocument document consists of the following files.
- META-INF/
- manifest.xml
- Pictures/
- content.xml
- meta.xml
- styles.xml
### content.xml
The structure of `content.xml` is described below.
- office:document-content
- office:font-facedecls
- office:automatic-styles
- office:body
- office:text
- draw:*
- office:forms
- table:table
- text:list
- text:numbered-paragraph
- text:p
- text:table-of-contents
- text:section
- office:chart
- office:image
- office:drawing
### styles.xml
The structure of `styles.xml` is described below.
- office:document-styles
- office:styles
- office:automatic-styles
- office:master-styles
- office:master-page
## RTF
To be completed.
## HTML
To be completed.
## PDF
To be completed.
# Frequently asked questions
## Is this the same with PHPWord that I found in CodePlex?
No. This one is much better with tons of new features that you cant find in PHPWord 0.6.3. The development in CodePlex is halted and switched to GitHub to allow more participation from the crowd. The more the merrier, right?
## Ive been running PHPWord from CodePlex flawlessly, but I cant use the latest PHPWord from GitHub. Why?
PHPWord requires PHP 5.3+ since 0.8, while PHPWord 0.6.3 from CodePlex can run with PHP 5.2. Theres a lot of new features that we can get from PHP 5.3 and its been around since 2009! You should upgrade your PHP version to use PHPWord 0.8+.
# References
## Formal specifications
- [Office Open XML (OOXML) (ECMA-376) Schema](http://www.schemacentral.com/sc/ooxml/ss.html)
- [Oasis OpenDocument Standard Version 1.2](http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html)
- [Rich Text Format (RTF) Specification, version 1.9.1](http://www.microsoft.com/en-us/download/details.aspx?id=10725)
## Other resources
- [DocumentFormat.OpenXml.Wordprocessing Namespace on MSDN](http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx)

213
docs/styles.rst Normal file
View File

@ -0,0 +1,213 @@
.. _styles:
Styles
======
.. _section-style:
Section
-------
Available Section style options:
- ``borderBottomColor``. Border bottom color.
- ``borderBottomSize``. Border bottom size in *twip*.
- ``borderLeftColor``. Border left color.
- ``borderLeftSize``. Border left size in *twip*.
- ``borderRightColor``. Border right color.
- ``borderRightSize``. Border right size in *twip*.
- ``borderTopColor``. Border top color.
- ``borderTopSize``. Border top size in *twip*.
- ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage).
- ``colsNum``. Number of columns.
- ``colsSpace``. Spacing between columns.
- ``footerHeight``. Spacing to bottom of footer.
- ``gutter``. Page gutter spacing.
- ``headerHeight``. Spacing to top of header.
- ``marginTop``. Page margin top in *twip*.
- ``marginLeft``. Page margin left in *twip*.
- ``marginRight``. Page margin right in *twip*.
- ``marginBottom``. Page margin bottom in *twip*.
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
See ``\PhpOffice\PhpWord\Style\Section::ORIENTATION_...`` class constants for possible values
- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
- ``vAlign``. Vertical Page Alignment
See ``\PhpOffice\PhpWord\SimpleType\VerticalJc`` for possible values
.. _font-style:
Font
----
Available Font style options:
- ``allCaps``. All caps, *true* or *false*.
- ``bgColor``. Font background color, e.g. *FF0000*.
- ``bold``. Bold, *true* or *false*.
- ``color``. Font color, e.g. *FF0000*.
- ``doubleStrikethrough``. Double strikethrough, *true* or *false*.
- ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*.
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values
- ``hint``. Font content type, *default*, *eastAsia*, or *cs*.
- ``italic``. Italic, *true* or *false*.
- ``name``. Font name, e.g. *Arial*.
- ``rtl``. Right to Left language, *true* or *false*.
- ``size``. Font size, e.g. *20*, *22*.
- ``smallCaps``. Small caps, *true* or *false*.
- ``strikethrough``. Strikethrough, *true* or *false*.
- ``subScript``. Subscript, *true* or *false*.
- ``superScript``. Superscript, *true* or *false*.
- ``underline``. Underline, *single*, *dash*, *dotted*, etc.
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` class constants for possible values
- ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages
See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes.
- ``position``. The text position, raised or lowered, in half points
- ``hidden``. Hidden text, *true* or *false*.
.. _paragraph-style:
Paragraph
---------
Available Paragraph style options:
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``basedOn``. Parent style.
- ``hanging``. Hanging indentation in *half inches*.
- ``indent``. Indent (left indentation) in *half inches*.
- ``indentation``. An array of indentation key => value pairs in *twip*. Supports *left*, *right*, *firstLine* and *hanging* indentation.
See ``\PhpOffice\PhpWord\Style\Indentation`` for possible identation types.
- ``keepLines``. Keep all lines on one page, *true* or *false*.
- ``keepNext``. Keep paragraph with next paragraph, *true* or *false*.
- ``lineHeight``. Text line height, e.g. *1.0*, *1.5*, etc.
- ``next``. Style for next paragraph.
- ``pageBreakBefore``. Start paragraph on next page, *true* or *false*.
- ``spaceBefore``. Space before paragraph in *twip*.
- ``spaceAfter``. Space after paragraph in *twip*.
- ``spacing``. Space between lines in *twip*. If spacingLineRule is auto, 240 (height of 1 line) will be added, so if you want a double line height, set this to 240.
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
See ``\PhpOffice\PhpWord\SimpleType\LineSpacingRule`` class constants for possible values.
- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*.
- ``tabs``. Set of custom tab stops.
- ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*.
- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*.
- ``bidi``. Right to Left Paragraph Layout, *true* or *false*.
- ``shading``. Paragraph Shading.
- ``textAlignment``. Vertical Character Alignment on Line.
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class constants for possible values.
.. _table-style:
Table
-----
Available Table style options:
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``bgColor``. Background color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*.
- ``indent``. Table indent from leading margin. Must be an instance of ``\PhpOffice\PhpWord\ComplexType\TblWidth``.
- ``width``. Table width in Fiftieths of a Percent or Twentieths of a Point.
- ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*.
- ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants.
- ``cellSpacing`` Cell spacing in *twip*
- ``position`` Floating Table Positioning, see below for options
- ``bidiVisual`` Present table as Right-To-Left
Floating Table Positioning options:
- ``leftFromText`` Distance From Left of Table to Text in *twip*
- ``rightFromText`` Distance From Right of Table to Text in *twip*
- ``topFromText`` Distance From Top of Table to Text in *twip*
- ``bottomFromText`` Distance From Top of Table to Text in *twip*
- ``vertAnchor`` Table Vertical Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::VANCHOR_*``
- ``horzAnchor`` Table Horizontal Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::HANCHOR_*``
- ``tblpXSpec`` Relative Horizontal Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::XALIGN_*``
- ``tblpX`` Absolute Horizontal Distance From Anchorin *twip*
- ``tblpYSpec`` Relative Vertical Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::YALIGN_*``
- ``tblpY`` Absolute Vertical Distance From Anchorin *twip*
Available Row style options:
- ``cantSplit``. Table row cannot break across pages, *true* or *false*.
- ``exactHeight``. Row height is exact or at least.
- ``tblHeader``. Repeat table row on every new page, *true* or *false*.
Available Cell style options:
- ``bgColor``. Background color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
- ``border(Top|Right|Bottom|Left)Style``. Border style. You can use constants from ``\PhpOffice\PhpWord\SimpleType\Border``
- ``gridSpan``. Number of columns spanned.
- ``textDirection(btLr|tbRl)``. Direction of text.
You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL``
- ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*.
- ``vMerge``. *restart* or *continue*.
- ``width``. Cell width in *twip*.
.. _image-style:
Image
-----
Available Image style options:
- ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
- ``height``. Height in *pt*.
- ``marginLeft``. Left margin in inches, can be negative.
- ``marginTop``. Top margin in inches, can be negative.
- ``width``. Width in *pt*.
- ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*.
- ``wrapDistanceTop``. Top text wrapping in pixels.
- ``wrapDistanceBottom``. Bottom text wrapping in pixels.
- ``wrapDistanceLeft``. Left text wrapping in pixels.
- ``wrapDistanceRight``. Right text wrapping in pixels.
.. _numbering-level-style:
Numbering level
---------------
Available NumberingLevel style options:
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``font``. Font name.
- ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter.
- ``hanging``. See paragraph style.
- ``hint``. See font style.
- ``left``. See paragraph style.
- ``restart``. Restart numbering level symbol.
- ``start``. Starting value.
- ``suffix``. Content between numbering symbol and paragraph text tab\|space\|nothing.
- ``tabPos``. See paragraph style.
- ``text``. Numbering level text e.g. %1 for nonbullet or bullet character.
.. _chart-style:
Chart
-----
Available Chart style options:
- ``width``. Width (in EMU).
- ``height``. Height (in EMU).
- ``3d``. Is 3D; applies to pie, bar, line, area, *true* or *false*.
- ``colors``. A list of colors to use in the chart.
- ``title``. The title for the chart.
- ``showLegend``. Show legend, *true* or *false*.
- ``LegendPosition``. Legend position, *r* (default), *b*, *t*, *l* or *tr*.
- ``categoryLabelPosition``. Label position for categories, *nextTo* (default), *low* or *high*.
- ``valueLabelPosition``. Label position for values, *nextTo* (default), *low* or *high*.
- ``categoryAxisTitle``. The title for the category axis.
- ``valueAxisTitle``. The title for the values axis.
- ``majorTickMarkPos``. The position for major tick marks, *in*, *out*, *cross*, *none* (default).
- ``showAxisLabels``. Show labels for axis, *true* or *false*.
- ``gridX``. Show Gridlines for X-Axis, *true* or *false*.
- ``gridY``. Show Gridlines for Y-Axis, *true* or *false*.

View File

@ -0,0 +1,303 @@
.. _templates-processing:
Templates processing
====================
You can create an OOXML document template with included search-patterns (macros) which can be replaced by any value you wish. Only single-line values can be replaced.
By default Macros are defined like this: ``${search-pattern}`` but you can define custom macros.
To load a template file, create a new instance of the TemplateProcessor.
.. code-block:: php
$templateProcessor = new TemplateProcessor('Template.docx');
setValue
""""""""
Given a template containing
.. code-block:: clean
Hello ${firstname} ${lastname}!
The following will replace ``${firstname}`` with ``John``, and ``${lastname}`` with ``Doe`` .
The resulting document will now contain ``Hello John Doe!``
.. code-block:: php
$templateProcessor->setValue('firstname', 'John');
$templateProcessor->setValue('lastname', 'Doe');
setValues
"""""""""
You can also set multiple values by passing all of them in an array.
.. code-block:: php
$templateProcessor->setValues(array('firstname' => 'John', 'lastname' => 'Doe'));
setMacroOpeningChars
""""""""
You can define a custom opening macro. The following will set ``{#`` as the opening search pattern.
.. code-block:: php
$templateProcessor->setMacroOpeningChars('{#');
setMacroClosingChars
""""""""
You can define a custom closing macro. The following will set ``#}`` as the closing search pattern.
.. code-block:: php
$templateProcessor->setMacroClosingChars('#}');
setMacroChars
""""""""
You can define a custom opening and closing macro at the same time . The following will set the search-pattern like this: ``{#search-pattern#}`` .
.. code-block:: php
$templateProcessor->setMacroChars('{#', '#}');
setImageValue
"""""""""""""
The search-pattern model for images can be like:
- ``${search-image-pattern}``
- ``${search-image-pattern:[width]:[height]:[ratio]}``
- ``${search-image-pattern:[width]x[height]}``
- ``${search-image-pattern:size=[width]x[height]}``
- ``${search-image-pattern:width=[width]:height=[height]:ratio=false}``
Where:
- [width] and [height] can be just numbers or numbers with measure, which supported by Word (cm, mm, in, pt, pc, px, %, em, ex)
- [ratio] uses only for ``false``, ``-`` or ``f`` to turn off respect aspect ration of image. By default template image size uses as 'container' size.
Example:
.. code-block:: clean
${CompanyLogo}
${UserLogo:50:50} ${Name} - ${City} - ${Street}
.. code-block:: php
$templateProcessor = new TemplateProcessor('Template.docx');
$templateProcessor->setValue('Name', 'John Doe');
$templateProcessor->setValue(array('City', 'Street'), array('Detroit', '12th Street'));
$templateProcessor->setImageValue('CompanyLogo', 'path/to/company/logo.png');
$templateProcessor->setImageValue('UserLogo', array('path' => 'path/to/logo.png', 'width' => 100, 'height' => 100, 'ratio' => false));
$templateProcessor->setImageValue('FeatureImage', function () {
// Closure will only be executed if the replacement tag is found in the template
return array('path' => SlowFeatureImageGenerator::make(), 'width' => 100, 'height' => 100, 'ratio' => false);
});
cloneBlock
""""""""""
Given a template containing
See ``Sample_23_TemplateBlock.php`` for an example.
.. code-block:: clean
${block_name}
Customer: ${customer_name}
Address: ${customer_address}
${/block_name}
The following will duplicate everything between ``${block_name}`` and ``${/block_name}`` 3 times.
.. code-block:: php
$templateProcessor->cloneBlock('block_name', 3, true, true);
The last parameter will rename any macro defined inside the block and add #1, #2, #3 ... to the macro name.
The result will be
.. code-block:: clean
Customer: ${customer_name#1}
Address: ${customer_address#1}
Customer: ${customer_name#2}
Address: ${customer_address#2}
Customer: ${customer_name#3}
Address: ${customer_address#3}
It is also possible to pass an array with the values to replace the marcros with.
If an array with replacements is passed, the ``count`` argument is ignored, it is the size of the array that counts.
.. code-block:: php
$replacements = array(
array('customer_name' => 'Batman', 'customer_address' => 'Gotham City'),
array('customer_name' => 'Superman', 'customer_address' => 'Metropolis'),
);
$templateProcessor->cloneBlock('block_name', 0, true, false, $replacements);
The result will then be
.. code-block:: clean
Customer: Batman
Address: Gotham City
Customer: Superman
Address: Metropolis
replaceBlock
""""""""""""
Given a template containing
.. code-block:: clean
${block_name}
This block content will be replaced
${/block_name}
The following will replace everything between ``${block_name}`` and ``${/block_name}`` with the value passed.
.. code-block:: php
$templateProcessor->replaceBlock('block_name', 'This is the replacement text.');
deleteBlock
"""""""""""
Same as previous, but it deletes the block
.. code-block:: php
$templateProcessor->deleteBlock('block_name');
cloneRow
""""""""
Clones a table row in a template document.
See ``Sample_07_TemplateCloneRow.php`` for an example.
.. code-block:: clean
+-----------+----------------+
| ${userId} | ${userName} |
| |----------------+
| | ${userAddress} |
+-----------+----------------+
.. code-block:: php
$templateProcessor->cloneRow('userId', 2);
Will result in
.. code-block:: clean
+-------------+------------------+
| ${userId#1} | ${userName#1} |
| |------------------+
| | ${userAddress#1} |
+-------------+------------------+
| ${userId#2} | ${userName#2} |
| |------------------+
| | ${userAddress#2} |
+-------------+------------------+
cloneRowAndSetValues
""""""""""""""""""""
Finds a row in a table row identified by `$search` param and clones it as many times as there are entries in `$values`.
.. code-block:: clean
+-----------+----------------+
| ${userId} | ${userName} |
| |----------------+
| | ${userAddress} |
+-----------+----------------+
.. code-block:: php
$values = [
['userId' => 1, 'userName' => 'Batman', 'userAddress' => 'Gotham City'],
['userId' => 2, 'userName' => 'Superman', 'userAddress' => 'Metropolis'],
];
$templateProcessor->cloneRowAndSetValues('userId', $values);
Will result in
.. code-block:: clean
+---+-------------+
| 1 | Batman |
| |-------------+
| | Gotham City |
+---+-------------+
| 2 | Superman |
| |-------------+
| | Metropolis |
+---+-------------+
applyXslStyleSheet
""""""""""""""""""
Applies the XSL stylesheet passed to header part, footer part and main part
.. code-block:: php
$xslDomDocument = new \DOMDocument();
$xslDomDocument->load('/path/to/my/stylesheet.xsl');
$templateProcessor->applyXslStyleSheet($xslDomDocument);
setComplexValue
"""""""""""""""
Raplaces a ${macro} with the ComplexType passed.
See ``Sample_40_TemplateSetComplexValue.php`` for examples.
.. code-block:: php
$inline = new TextRun();
$inline->addText('by a red italic text', array('italic' => true, 'color' => 'red'));
$templateProcessor->setComplexValue('inline', $inline);
setComplexBlock
"""""""""""""""
Raplaces a ${macro} with the ComplexType passed.
See ``Sample_40_TemplateSetComplexValue.php`` for examples.
.. code-block:: php
$table = new Table(array('borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP));
$table->addRow();
$table->addCell(150)->addText('Cell A1');
$table->addCell(150)->addText('Cell A2');
$table->addCell(150)->addText('Cell A3');
$table->addRow();
$table->addCell(150)->addText('Cell B1');
$table->addCell(150)->addText('Cell B2');
$table->addCell(150)->addText('Cell B3');
$templateProcessor->setComplexBlock('table', $table);
setChartValue
"""""""""""""
Replace a variable by a chart.
.. code-block:: php
$categories = array('A', 'B', 'C', 'D', 'E');
$series1 = array(1, 3, 2, 5, 4);
$chart = new Chart('doughnut', $categories, $series1);
$templateProcessor->setChartValue('myChart', $chart);
save
""""
Saves the loaded template within the current directory. Returns the file path.
.. code-block:: php
$filepath = $templateProcessor->save();
saveAs
""""""
Saves a copy of the loaded template in the indicated path.
.. code-block:: php
$pathToSave = 'path/to/save/file.ext';
$templateProcessor->saveAs($pathToSave);

View File

@ -1,27 +0,0 @@
.. _templates:
Templates
=========
You can create a docx template with included search-patterns that can be
replaced by any value you wish. Only single-line values can be replaced.
To load a template file, use the ``loadTemplate`` method. After loading
the docx template, you can use the ``setValue`` method to change the
value of a search pattern. The search-pattern model is:
``${search-pattern}``. It is not possible to add new PHPWord elements to
a loaded template file.
Example:
.. code-block:: php
$template = $phpWord->loadTemplate('Template.docx');
$template->setValue('Name', 'Somebody someone');
$template->setValue('Street', 'Coming-Undone-Street 32');
See ``Sample_07_TemplateCloneRow.php`` for example on how to create
multirow from a single row in a template by using ``cloneRow``.
See ``Sample_23_TemplateBlock.php`` for example on how to clone a block
of text using ``cloneBlock`` and delete a block of text using
``deleteBlock``.

View File

@ -8,35 +8,35 @@ OOXML
The package of OOXML document consists of the following files.
- \_rels/
- \_rels/
- .rels
- .rels
- docProps/
- docProps/
- app.xml
- core.xml
- custom.xml
- app.xml
- core.xml
- custom.xml
- word/
- word/
- rels/
- rels/
- document.rels.xml
- document.rels.xml
- media/
- theme/
- media/
- theme/
- theme1.xml
- theme1.xml
- document.xml
- fontTable.xml
- numbering.xml
- settings.xml
- styles.xml
- webSettings.xml
- document.xml
- fontTable.xml
- numbering.xml
- settings.xml
- styles.xml
- webSettings.xml
- [Content\_Types].xml
- [Content\_Types].xml
OpenDocument
------------
@ -46,53 +46,53 @@ Package
The package of OpenDocument document consists of the following files.
- META-INF/
- META-INF/
- manifest.xml
- manifest.xml
- Pictures/
- content.xml
- meta.xml
- styles.xml
- Pictures/
- content.xml
- meta.xml
- styles.xml
content.xml
~~~~~~~~~~~
The structure of ``content.xml`` is described below.
- office:document-content
- office:document-content
- office:font-facedecls
- office:automatic-styles
- office:body
- office:font-facedecls
- office:automatic-styles
- office:body
- office:text
- office:text
- draw:\*
- office:forms
- table:table
- text:list
- text:numbered-paragraph
- text:p
- text:table-of-contents
- text:section
- draw:\*
- office:forms
- table:table
- text:list
- text:numbered-paragraph
- text:p
- text:table-of-contents
- text:section
- office:chart
- office:image
- office:drawing
- office:chart
- office:image
- office:drawing
styles.xml
~~~~~~~~~~
The structure of ``styles.xml`` is described below.
- office:document-styles
- office:document-styles
- office:styles
- office:automatic-styles
- office:master-styles
- office:styles
- office:automatic-styles
- office:master-styles
- office:master-page
- office:master-page
RTF
---

View File

@ -1,14 +0,0 @@
<?xml version="1.0"?>
<ruleset name="PHPWord mess detector ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation=" http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml/LongVariable" />
<rule ref="rulesets/naming.xml/ShortVariable" />
<rule ref="rulesets/naming.xml/ShortMethodName" />
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
</ruleset>

34
phpmd.xml.dist Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="PHPWord PHP Mess Detector Rule Set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
<exclude name="ShortClassName" />
<exclude name="LongVariable" />
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="32" />
</properties>
</rule>
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<!-- AbstractContainer and Html need more coupling (default: 13) -->
<properties>
<property name="maximum" value="25" />
</properties>
</rule>
<rule ref="rulesets/design.xml/NumberOfChildren">
<!-- AbstractStyle needs more children (default: 15) -->
<properties>
<property name="minimum" value="30" />
</properties>
</rule>
<rule ref="rulesets/controversial.xml" />
</ruleset>

13
phpstan.neon Normal file
View File

@ -0,0 +1,13 @@
includes:
- vendor/phpstan/phpstan/conf/config.level1.neon
parameters:
memory-limit: 20000000
autoload_directories:
- tests
autoload_files:
- tests/bootstrap.php
excludes_analyse:
- */pclzip.lib.php
- src/PhpWord/Shared/OLERead.php
- src/PhpWord/Reader/MsDoc.php
- src/PhpWord/Writer/PDF/MPDF.php

View File

@ -6,19 +6,18 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="PhpWord Test Suite">
<directory>./tests/PhpWord/</directory>
<directory>./tests/PhpWordTests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".php">./src/PhpWord/Shared/PCLZip</directory>
<directory suffix=".php">./src/PhpWordTests/Shared/PCLZip</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>

20
phpword.ini.dist Normal file
View File

@ -0,0 +1,20 @@
; Default config file for PHPWord
; Copy this file into phpword.ini and use Settings::loadConfig to load
[General]
compatibility = true
zipClass = ZipArchive
pdfRendererName = DomPDF
pdfRendererPath =
; tempDir = "C:\PhpWordTemp"
outputEscapingEnabled = false
[Font]
defaultFontName = Arial
defaultFontSize = 10
[Paper]
defaultPaper = "A4"

View File

@ -1,12 +1,24 @@
<?php
use PhpOffice\PhpWord\Style\Font;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$languageEnGb = new \PhpOffice\PhpWord\Style\Language(\PhpOffice\PhpWord\Style\Language::EN_GB);
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true));
$phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
$phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240));
$phpWord->getSettings()->setThemeFontLang($languageEnGb);
$fontStyleName = 'rStyle';
$phpWord->addFontStyle($fontStyleName, ['bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true]);
$paragraphStyleName = 'pStyle';
$phpWord->addParagraphStyle($paragraphStyleName, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'spaceAfter' => 100]);
$phpWord->addTitleStyle(1, ['bold' => true], ['spaceAfter' => 240]);
// New portrait section
$section = $phpWord->addSection();
@ -15,35 +27,62 @@ $section = $phpWord->addSection();
$section->addTitle('Welcome to PhpWord', 1);
$section->addText('Hello World!');
// $pStyle = new Font();
// $pStyle->setLang()
$section->addText('Ce texte-ci est en français.', ['lang' => \PhpOffice\PhpWord\Style\Language::FR_BE]);
// Two text break
$section->addTextBreak(2);
// Defined style
$section->addText('I am styled by a font style definition.', 'rStyle');
$section->addText('I am styled by a paragraph style definition.', null, 'pStyle');
$section->addText('I am styled by both font and paragraph style.', 'rStyle', 'pStyle');
// Define styles
$section->addText('I am styled by a font style definition.', $fontStyleName);
$section->addText('I am styled by a paragraph style definition.', null, $paragraphStyleName);
$section->addText('I am styled by both font and paragraph style.', $fontStyleName, $paragraphStyleName);
$section->addTextBreak();
// Inline font style
$fontStyle['name'] = 'Times New Roman';
$fontStyle['size'] = 20;
$fontStyle['bold'] = true;
$fontStyle['italic'] = true;
$fontStyle['underline'] = 'dash';
$fontStyle['strikethrough'] = true;
$fontStyle['superScript'] = true;
$fontStyle['color'] = 'FF0000';
$fontStyle['fgColor'] = 'yellow';
$fontStyle['smallCaps'] = true;
$section->addText('I am inline styled.', $fontStyle);
$section->addTextBreak();
$textrun = $section->addTextRun();
$textrun->addText('I am inline styled ', $fontStyle);
$textrun->addText('with ');
$textrun->addText('color', ['color' => '996699']);
$textrun->addText(', ');
$textrun->addText('bold', ['bold' => true]);
$textrun->addText(', ');
$textrun->addText('italic', ['italic' => true]);
$textrun->addText(', ');
$textrun->addText('underline', ['underline' => 'dash']);
$textrun->addText(', ');
$textrun->addText('strikethrough', ['strikethrough' => true]);
$textrun->addText(', ');
$textrun->addText('doubleStrikethrough', ['doubleStrikethrough' => true]);
$textrun->addText(', ');
$textrun->addText('superScript', ['superScript' => true]);
$textrun->addText(', ');
$textrun->addText('subScript', ['subScript' => true]);
$textrun->addText(', ');
$textrun->addText('smallCaps', ['smallCaps' => true]);
$textrun->addText(', ');
$textrun->addText('allCaps', ['allCaps' => true]);
$textrun->addText(', ');
$textrun->addText('fgColor', ['fgColor' => 'yellow']);
$textrun->addText(', ');
$textrun->addText('scale', ['scale' => 200]);
$textrun->addText(', ');
$textrun->addText('spacing', ['spacing' => 120]);
$textrun->addText(', ');
$textrun->addText('kerning', ['kerning' => 10]);
$textrun->addText('. ');
// Link
$section->addLink('http://www.google.com', null, 'NLink');
$section->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
$section->addTextBreak();
// Image
$section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18));
$section->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,36 +1,37 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Ads styles
$phpWord->addParagraphStyle('multipleTab', array(
'tabs' => array(
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
new \PhpOffice\PhpWord\Style\Tab('right', 5300)
)
));
$phpWord->addParagraphStyle('rightTab', array(
'tabs' => array(
new \PhpOffice\PhpWord\Style\Tab('right', 9090)
)
));
$phpWord->addParagraphStyle('centerTab', array(
'tabs' => array(
new \PhpOffice\PhpWord\Style\Tab('center', 4680)
)
));
// Define styles
$multipleTabsStyleName = 'multipleTab';
$phpWord->addParagraphStyle(
$multipleTabsStyleName,
[
'tabs' => [
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
],
]
);
$rightTabStyleName = 'rightTab';
$phpWord->addParagraphStyle($rightTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('right', 9090)]]);
$leftTabStyleName = 'centerTab';
$phpWord->addParagraphStyle($leftTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('center', 4680)]]);
// New portrait section
$section = $phpWord->addSection();
// Add listitem elements
$section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, 'multipleTab');
$section->addText("Left Aligned\tRight Aligned", null, 'rightTab');
$section->addText("\tCenter Aligned", null, 'centerTab');
$section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, $multipleTabsStyleName);
$section->addText("Left Aligned\tRight Aligned", null, $rightTabStyleName);
$section->addText("\tCenter Aligned", null, $leftTabStyleName);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,26 +1,46 @@
<?php
use PhpOffice\PhpWord\SimpleType\VerticalJc;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section
$section = $phpWord->addSection(array('borderColor' => '00FF00', 'borderSize' => 12));
$section = $phpWord->addSection(['borderColor' => '00FF00', 'borderSize' => 12]);
$section->addText('I am placed on a default section.');
// New landscape section
$section = $phpWord->addSection(array('orientation' => 'landscape'));
$section = $phpWord->addSection(['orientation' => 'landscape']);
$section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.');
$section->addPageBreak();
$section->addPageBreak();
// New portrait section
$section = $phpWord->addSection(array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600));
$section->addText('This section uses other margins.');
$section = $phpWord->addSection(
['paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600]
);
$section->addText('This section uses other margins with folio papersize.');
// The text of this section is vertically centered
$section = $phpWord->addSection(
['vAlign' => VerticalJc::CENTER]
);
$section->addText('This section is vertically centered.');
// New portrait section with Header & Footer
$section = $phpWord->addSection(array('marginLeft' => 200, 'marginRight' => 200, 'marginTop' => 200, 'marginBottom' => 200, 'headerHeight' => 50, 'footerHeight' => 50,));
$section = $phpWord->addSection(
[
'marginLeft' => 200,
'marginRight' => 200,
'marginTop' => 200,
'marginBottom' => 200,
'headerHeight' => 50,
'footerHeight' => 50,
]
);
$section->addText('This section and we play with header/footer height.');
$section->addHeader()->addText('Header');
$section->addFooter()->addText('Footer');

View File

@ -1,38 +1,48 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Ads styles
$phpWord->addParagraphStyle('pStyle', array('spacing'=>100));
$phpWord->addFontStyle('BoldText', array('bold'=>true));
$phpWord->addFontStyle('ColoredText', array('color'=>'FF8080', 'bgColor' => 'FFFFCC'));
$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
// Define styles
$paragraphStyleName = 'pStyle';
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]);
$boldFontStyleName = 'BoldText';
$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]);
$coloredFontStyleName = 'ColoredText';
$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']);
$linkFontStyleName = 'NLink';
$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]);
// New portrait section
$section = $phpWord->addSection();
// Add text run
$textrun = $section->addTextRun('pStyle');
$textrun = $section->addTextRun($paragraphStyleName);
$textrun->addText('Each textrun can contain native text, link elements or an image.');
$textrun->addText(' No break is placed after adding an element.', 'BoldText');
$textrun->addText(' No break is placed after adding an element.', $boldFontStyleName);
$textrun->addText(' Both ');
$textrun->addText('superscript', array('superScript' => true));
$textrun->addText('superscript', ['superScript' => true]);
$textrun->addText(' and ');
$textrun->addText('subscript', array('subScript' => true));
$textrun->addText('subscript', ['subScript' => true]);
$textrun->addText(' are also available.');
$textrun->addText(' All elements are placed inside a paragraph with the optionally given p-Style.', 'ColoredText');
$textrun->addText(' All elements are placed inside a paragraph with the optionally given paragraph style.', $coloredFontStyleName);
$textrun->addText(' Sample Link: ');
$textrun->addLink('http://www.google.com', null, 'NLink');
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName);
$textrun->addText(' Sample Image: ');
$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
$textrun->addText(' Sample Object: ');
$textrun->addObject('resources/_sheet.xls');
$textrun->addText(' Here is some more text. ');
$textrun = $section->addTextRun();
$textrun->addText('This text is not visible.', ['hidden' => true]);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {

View File

@ -1,39 +1,46 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' .
'Donec vulputate iaculis metus, vel luctus dolor hendrerit ac. ' .
'Suspendisse congue congue leo sed pellentesque.';
$filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
. 'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. '
. 'Donec vulputate iaculis metus, vel luctus dolor hendrerit ac. '
. 'Suspendisse congue congue leo sed pellentesque.';
// Normal
$section = $phpWord->addSection();
$section->addText('Normal paragraph. ' . $filler);
$section->addText("Normal paragraph. {$filler}");
// Two columns
$section = $phpWord->addSection(array(
'colsNum' => 2,
'colsSpace' => 1440,
'breakType' => 'continuous'));
$section->addText('Three columns, one inch (1440 twips) spacing. ' . $filler);
$section = $phpWord->addSection(
[
'colsNum' => 2,
'colsSpace' => 1440,
'breakType' => 'continuous',
]
);
$section->addText("Two columns, one inch (1440 twips) spacing. {$filler}");
// Normal
$section = $phpWord->addSection(array('breakType' => 'continuous'));
$section->addText('Normal paragraph again. ' . $filler);
$section = $phpWord->addSection(['breakType' => 'continuous']);
$section->addText("Normal paragraph again. {$filler}");
// Three columns
$section = $phpWord->addSection(array(
'colsNum' => 3,
'colsSpace' => 720,
'breakType' => 'continuous'));
$section->addText('Three columns, half inch (720 twips) spacing. ' . $filler);
$section = $phpWord->addSection(
[
'colsNum' => 3,
'colsSpace' => 720,
'breakType' => 'continuous',
]
);
$section->addText("Three columns, half inch (720 twips) spacing. {$filler}");
// Normal
$section = $phpWord->addSection(array('breakType' => 'continuous'));
$section->addText('Normal paragraph again.');
$section = $phpWord->addSection(['breakType' => 'continuous']);
$section->addText("Normal paragraph again. {$filler}");
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,42 +1,60 @@
<?php
use PhpOffice\PhpWord\ComplexType\FootnoteProperties;
use PhpOffice\PhpWord\SimpleType\NumberFormat;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
\PhpOffice\PhpWord\Settings::setCompatibility(false);
// Define styles
$paragraphStyleName = 'pStyle';
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]);
$boldFontStyleName = 'BoldText';
$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]);
$coloredFontStyleName = 'ColoredText';
$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']);
$linkFontStyleName = 'NLink';
$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]);
// New portrait section
$section = $phpWord->addSection();
// Add style definitions
$phpWord->addParagraphStyle('pStyle', array('spacing'=>100));
$phpWord->addFontStyle('BoldText', array('bold'=>true));
$phpWord->addFontStyle('ColoredText', array('color'=>'FF8080'));
$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
// Add text elements
$textrun = $section->addTextRun('pStyle');
$textrun->addText('This is some lead text in a paragraph with a following footnote. ','pStyle');
$textrun = $section->addTextRun($paragraphStyleName);
$textrun->addText('This is some lead text in a paragraph with a following footnote. ', $paragraphStyleName);
$footnote = $textrun->addFootnote();
$footnote->addText('Just like a textrun, a footnote can contain native texts. ');
$footnote->addText('No break is placed after adding an element. ', 'BoldText');
$footnote->addText('All elements are placed inside a paragraph. ', 'ColoredText');
$footnote->addText('No break is placed after adding an element. ', $boldFontStyleName);
$footnote->addText('All elements are placed inside a paragraph. ', $coloredFontStyleName);
$footnote->addTextBreak();
$footnote->addText('But you can insert a manual text break like above, ');
$footnote->addText('links like ');
$footnote->addLink('http://www.google.com', null, 'NLink');
$footnote->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName);
$footnote->addText(', image like ');
$footnote->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
$footnote->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
$footnote->addText(', or object like ');
$footnote->addObject('resources/_sheet.xls');
$footnote->addText('But you can only put footnote in section, not in header or footer.');
$section->addText('You can also create the footnote directly from the section making it wrap in a paragraph like the footnote below this paragraph. But is is best used from within a textrun.');
$section->addText(
'You can also create the footnote directly from the section making it wrap in a paragraph '
. 'like the footnote below this paragraph. But is best used from within a textrun.'
);
$footnote = $section->addFootnote();
$footnote->addText('The reference for this is wrapped in its own line');
$footnoteProperties = new FootnoteProperties();
$footnoteProperties->setNumFmt(NumberFormat::DECIMAL_ENCLOSED_CIRCLE);
$section->setFootnoteProperties($footnoteProperties);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {

View File

@ -1,66 +1,87 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$document = $phpWord->loadTemplate('resources/Sample_07_TemplateCloneRow.docx');
// Variables on different parts of document
$document->setValue('weekday', date('l')); // On section/content
$document->setValue('time', date('H:i')); // On footer
$document->setValue('serverName', realpath(__DIR__)); // On header
// Simple table
$document->cloneRow('rowValue', 10);
$document->setValue('rowValue#1', 'Sun');
$document->setValue('rowValue#2', 'Mercury');
$document->setValue('rowValue#3', 'Venus');
$document->setValue('rowValue#4', 'Earth');
$document->setValue('rowValue#5', 'Mars');
$document->setValue('rowValue#6', 'Jupiter');
$document->setValue('rowValue#7', 'Saturn');
$document->setValue('rowValue#8', 'Uranus');
$document->setValue('rowValue#9', 'Neptun');
$document->setValue('rowValue#10', 'Pluto');
$document->setValue('rowNumber#1', '1');
$document->setValue('rowNumber#2', '2');
$document->setValue('rowNumber#3', '3');
$document->setValue('rowNumber#4', '4');
$document->setValue('rowNumber#5', '5');
$document->setValue('rowNumber#6', '6');
$document->setValue('rowNumber#7', '7');
$document->setValue('rowNumber#8', '8');
$document->setValue('rowNumber#9', '9');
$document->setValue('rowNumber#10', '10');
// Table with a spanned cell
$document->cloneRow('userId', 3);
$document->setValue('userId#1', '1');
$document->setValue('userFirstName#1', 'James');
$document->setValue('userName#1', 'Taylor');
$document->setValue('userPhone#1', '+1 428 889 773');
$document->setValue('userId#2', '2');
$document->setValue('userFirstName#2', 'Robert');
$document->setValue('userName#2', 'Bell');
$document->setValue('userPhone#2', '+1 428 889 774');
$document->setValue('userId#3', '3');
$document->setValue('userFirstName#3', 'Michael');
$document->setValue('userName#3', 'Ray');
$document->setValue('userPhone#3', '+1 428 889 775');
$name = 'Sample_07_TemplateCloneRow.docx';
echo date('H:i:s'), " Write to Word2007 format", EOL;
$document->saveAs($name);
rename($name, "results/{$name}");
echo getEndingNotes(array('Word2007' => 'docx'));
if (!CLI) {
include_once 'Sample_Footer.php';
}
<?php
include_once 'Sample_Header.php';
// Template processor instance creation
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
// Variables on different parts of document
$templateProcessor->setValue('weekday', date('l')); // On section/content
$templateProcessor->setValue('time', date('H:i')); // On footer
$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header
// Simple table
$templateProcessor->cloneRow('rowValue', 10);
$templateProcessor->setValue('rowValue#1', 'Sun');
$templateProcessor->setValue('rowValue#2', 'Mercury');
$templateProcessor->setValue('rowValue#3', 'Venus');
$templateProcessor->setValue('rowValue#4', 'Earth');
$templateProcessor->setValue('rowValue#5', 'Mars');
$templateProcessor->setValue('rowValue#6', 'Jupiter');
$templateProcessor->setValue('rowValue#7', 'Saturn');
$templateProcessor->setValue('rowValue#8', 'Uranus');
$templateProcessor->setValue('rowValue#9', 'Neptun');
$templateProcessor->setValue('rowValue#10', 'Pluto');
$templateProcessor->setValue('rowNumber#1', '1');
$templateProcessor->setValue('rowNumber#2', '2');
$templateProcessor->setValue('rowNumber#3', '3');
$templateProcessor->setValue('rowNumber#4', '4');
$templateProcessor->setValue('rowNumber#5', '5');
$templateProcessor->setValue('rowNumber#6', '6');
$templateProcessor->setValue('rowNumber#7', '7');
$templateProcessor->setValue('rowNumber#8', '8');
$templateProcessor->setValue('rowNumber#9', '9');
$templateProcessor->setValue('rowNumber#10', '10');
// Table with a spanned cell
$values = [
[
'userId' => 1,
'userFirstName' => 'James',
'userName' => 'Taylor',
'userPhone' => '+1 428 889 773',
],
[
'userId' => 2,
'userFirstName' => 'Robert',
'userName' => 'Bell',
'userPhone' => '+1 428 889 774',
],
[
'userId' => 3,
'userFirstName' => 'Michael',
'userName' => 'Ray',
'userPhone' => '+1 428 889 775',
],
];
$templateProcessor->cloneRowAndSetValues('userId', $values);
//this is equivalent to cloning and settings values with cloneRowAndSetValues
// $templateProcessor->cloneRow('userId', 3);
// $templateProcessor->setValue('userId#1', '1');
// $templateProcessor->setValue('userFirstName#1', 'James');
// $templateProcessor->setValue('userName#1', 'Taylor');
// $templateProcessor->setValue('userPhone#1', '+1 428 889 773');
// $templateProcessor->setValue('userId#2', '2');
// $templateProcessor->setValue('userFirstName#2', 'Robert');
// $templateProcessor->setValue('userName#2', 'Bell');
// $templateProcessor->setValue('userPhone#2', '+1 428 889 774');
// $templateProcessor->setValue('userId#3', '3');
// $templateProcessor->setValue('userFirstName#3', 'Michael');
// $templateProcessor->setValue('userName#3', 'Ray');
// $templateProcessor->setValue('userPhone#3', '+1 428 889 775');
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_07_TemplateCloneRow.docx');
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -1,49 +1,67 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->setDefaultParagraphStyle(array(
'align' => 'both',
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(12),
'spacing' => 120,
));
$phpWord->setDefaultParagraphStyle(
[
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::BOTH,
'spaceAfter' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(12),
'spacing' => 120,
]
);
// Sample
// New section
$section = $phpWord->addSection();
$section->addText('Below are the samples on how to control your paragraph ' .
'pagination. See "Line and Page Break" tab on paragraph properties ' .
'window to see the attribute set by these controls.',
array('bold' => true), array('space' => array('before' => 360, 'after' => 480)));
$section->addText(
'Below are the samples on how to control your paragraph '
. 'pagination. See "Line and Page Break" tab on paragraph properties '
. 'window to see the attribute set by these controls.',
['bold' => true],
['space' => ['before' => 360, 'after' => 480]]
);
$section->addText('Paragraph with widowControl = false (default: true). ' .
'A "widow" is the last line of a paragraph printed by itself at the top ' .
'of a page. An "orphan" is the first line of a paragraph printed by ' .
'itself at the bottom of a page. Set this option to "false" if you want ' .
'to disable this automatic control.',
null, array('widowControl' => false, 'indentation' => array('left' => 240, 'right' => 120)));
$section->addText(
'Paragraph with widowControl = false (default: true). '
. 'A "widow" is the last line of a paragraph printed by itself at the top '
. 'of a page. An "orphan" is the first line of a paragraph printed by '
. 'itself at the bottom of a page. Set this option to "false" if you want '
. 'to disable this automatic control.',
null,
['widowControl' => false, 'indentation' => ['left' => 240, 'right' => 120]]
);
$section->addText('Paragraph with keepNext = true (default: false). ' .
'"Keep with next" is used to prevent Word from inserting automatic page ' .
'breaks between paragraphs. Set this option to "true" if you do not want ' .
'your paragraph to be separated with the next paragraph.',
null, array('keepNext' => true, 'indentation' => array('firstLine' => 240)));
$section->addText(
'Paragraph with keepNext = true (default: false). '
. '"Keep with next" is used to prevent Word from inserting automatic page '
. 'breaks between paragraphs. Set this option to "true" if you do not want '
. 'your paragraph to be separated with the next paragraph.',
null,
['keepNext' => true, 'indentation' => ['firstLine' => 240]]
);
$section->addText('Paragraph with keepLines = true (default: false). ' .
'"Keep lines together" will prevent Word from inserting an automatic page ' .
'break within a paragraph. Set this option to "true" if you do not want ' .
'all lines of your paragraph to be in the same page.',
null, array('keepLines' => true, 'indentation' => array('left' => 240, 'hanging' => 240)));
$section->addText(
'Paragraph with keepLines = true (default: false). '
. '"Keep lines together" will prevent Word from inserting an automatic page '
. 'break within a paragraph. Set this option to "true" if you do not want '
. 'all lines of your paragraph to be in the same page.',
null,
['keepLines' => true, 'indentation' => ['left' => 240, 'hanging' => 240]]
);
$section->addText('Keep scrolling. More below.');
$section->addText('Paragraph with pageBreakBefore = true (default: false). ' .
'Different with all other control above, "page break before" separates ' .
'your paragraph into the next page. This option is most useful for ' .
'heading styles.',
null, array('pageBreakBefore' => true));
$section->addText(
'Paragraph with pageBreakBefore = true (default: false). '
. 'Different with all other control above, "page break before" separates '
. 'your paragraph into the next page. This option is most useful for '
. 'heading styles.',
null,
['pageBreakBefore' => true]
);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,68 +1,81 @@
<?php
use PhpOffice\PhpWord\Shared\Converter;
use PhpOffice\PhpWord\Style\TablePosition;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true);
$header = ['size' => 16, 'bold' => true];
// 1. Basic table
$rows = 10;
$cols = 5;
$section->addText("Basic table", $header);
$section->addText('Basic table', $header);
$table = $section->addTable();
for($r = 1; $r <= 8; $r++) {
for ($r = 1; $r <= $rows; ++$r) {
$table->addRow();
for($c = 1; $c <= 5; $c++) {
$table->addCell(1750)->addText("Row $r, Cell $c");
for ($c = 1; $c <= $cols; ++$c) {
$table->addCell(1750)->addText("Row {$r}, Cell {$c}");
}
}
// 2. Advanced table
$section->addTextBreak(1);
$section->addText("Fancy table", $header);
$section->addText('Fancy table', $header);
$styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80);
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
$fontStyle = array('bold' => true, 'align' => 'center');
$phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow);
$table = $section->addTable('Fancy Table');
$fancyTableStyleName = 'Fancy Table';
$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50];
$fancyTableFirstRowStyle = ['borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'];
$fancyTableCellStyle = ['valign' => 'center'];
$fancyTableCellBtlrStyle = ['valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR];
$fancyTableFontStyle = ['bold' => true];
$phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle);
$table = $section->addTable($fancyTableStyleName);
$table->addRow(900);
$table->addCell(2000, $styleCell)->addText('Row 1', $fontStyle);
$table->addCell(2000, $styleCell)->addText('Row 2', $fontStyle);
$table->addCell(2000, $styleCell)->addText('Row 3', $fontStyle);
$table->addCell(2000, $styleCell)->addText('Row 4', $fontStyle);
$table->addCell(500, $styleCellBTLR)->addText('Row 5', $fontStyle);
for($i = 1; $i <= 8; $i++) {
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 1', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 2', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 3', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 4', $fancyTableFontStyle);
$table->addCell(500, $fancyTableCellBtlrStyle)->addText('Row 5', $fancyTableFontStyle);
for ($i = 1; $i <= 8; ++$i) {
$table->addRow();
$table->addCell(2000)->addText("Cell $i");
$table->addCell(2000)->addText("Cell $i");
$table->addCell(2000)->addText("Cell $i");
$table->addCell(2000)->addText("Cell $i");
$text = ($i % 2 == 0) ? 'X' : '';
$table->addCell(2000)->addText("Cell {$i}");
$table->addCell(2000)->addText("Cell {$i}");
$table->addCell(2000)->addText("Cell {$i}");
$table->addCell(2000)->addText("Cell {$i}");
$text = (0 == $i % 2) ? 'X' : '';
$table->addCell(500)->addText($text);
}
// 3. colspan (gridSpan) and rowspan (vMerge)
/*
* 3. colspan (gridSpan) and rowspan (vMerge)
* ---------------------
* | | B | |
* | A |--------| E |
* | | C | D | |
* ---------------------
*/
$section->addTextBreak(1);
$section->addText("Table with colspan and rowspan", $header);
$section->addPageBreak();
$section->addText('Table with colspan and rowspan', $header);
$styleTable = array('borderSize' => 6, 'borderColor' => '999999');
$cellRowSpan = array('vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00');
$cellRowContinue = array('vMerge' => 'continue');
$cellColSpan = array('gridSpan' => 2, 'valign' => 'center');
$cellHCentered = array('align' => 'center');
$cellVCentered = array('valign' => 'center');
$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '999999'];
$cellRowSpan = ['vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00'];
$cellRowContinue = ['vMerge' => 'continue'];
$cellColSpan = ['gridSpan' => 2, 'valign' => 'center'];
$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER];
$cellVCentered = ['valign' => 'center'];
$phpWord->addTableStyle('Colspan Rowspan', $styleTable);
$table = $section->addTable('Colspan Rowspan');
$spanTableStyleName = 'Colspan Rowspan';
$phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle);
$table = $section->addTable($spanTableStyleName);
$table->addRow();
@ -74,7 +87,7 @@ $textrun1->addFootnote()->addText('Row span');
$cell2 = $table->addCell(4000, $cellColSpan);
$textrun2 = $cell2->addTextRun($cellHCentered);
$textrun2->addText('B');
$textrun2->addFootnote()->addText('Colspan span');
$textrun2->addFootnote()->addText('Column span');
$table->addCell(2000, $cellRowSpan)->addText('E', null, $cellHCentered);
@ -84,6 +97,61 @@ $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered);
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
$table->addCell(null, $cellRowContinue);
/*
* 4. colspan (gridSpan) and rowspan (vMerge)
* ---------------------
* | | B | 1 |
* | A | |----|
* | | | 2 |
* | |---|----|----|
* | | C | D | 3 |
* ---------------------
* @see https://github.com/PHPOffice/PHPWord/issues/806
*/
$section->addPageBreak();
$section->addText('Table with colspan and rowspan', $header);
$styleTable = ['borderSize' => 6, 'borderColor' => '999999'];
$phpWord->addTableStyle('Colspan Rowspan', $styleTable);
$table = $section->addTable('Colspan Rowspan');
$row = $table->addRow();
$row->addCell(1000, ['vMerge' => 'restart'])->addText('A');
$row->addCell(1000, ['gridSpan' => 2, 'vMerge' => 'restart'])->addText('B');
$row->addCell(1000)->addText('1');
$row = $table->addRow();
$row->addCell(1000, ['vMerge' => 'continue']);
$row->addCell(1000, ['vMerge' => 'continue', 'gridSpan' => 2]);
$row->addCell(1000)->addText('2');
$row = $table->addRow();
$row->addCell(1000, ['vMerge' => 'continue']);
$row->addCell(1000)->addText('C');
$row->addCell(1000)->addText('D');
$row->addCell(1000)->addText('3');
// 5. Nested table
$section->addTextBreak(2);
$section->addText('Nested table in a centered and 50% width table.', $header);
$table = $section->addTable(['width' => 50 * 50, 'unit' => 'pct', 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER]);
$cell = $table->addRow()->addCell();
$cell->addText('This cell contains nested table.');
$innerCell = $cell->addTable(['alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER])->addRow()->addCell();
$innerCell->addText('Inside nested table');
// 6. Table with floating position
$section->addTextBreak(2);
$section->addText('Table with floating positioning.', $header);
$table = $section->addTable(['borderSize' => 6, 'borderColor' => '999999', 'position' => ['vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1)]]);
$cell = $table->addRow()->addCell();
$cell->addText('This is a single cell.');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {

View File

@ -1,13 +1,14 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true);
$header = ['size' => 16, 'bold' => true];
//1.Use EastAisa FontStyle
$section->addText('中文楷体样式测试',array('name' => '楷体', 'size' => 16, 'color' => '1B2232'));
$section->addText('中文楷体样式测试', ['name' => '楷体', 'size' => 16, 'color' => '1B2232', 'lang' => ['latin' => 'en-US', 'eastAsia' => 'zh-CN']]);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,9 +1,11 @@
<?php
include_once 'Sample_Header.php';
// Read contents
$name = basename(__FILE__, '.php');
$source = "resources/{$name}.docx";
$source = __DIR__ . "/resources/{$name}.docx";
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);

View File

@ -0,0 +1,15 @@
<?php
include_once 'Sample_Header.php';
// Read contents
$name = basename(__FILE__, '.php');
$source = "resources/{$name}.doc";
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'MsDoc');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -1,8 +1,9 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section
@ -16,20 +17,18 @@ $table->addRow();
$cell = $table->addCell(4500);
$textrun = $cell->addTextRun();
$textrun->addText('This is the header with ');
$textrun->addLink('http://google.com', 'link to Google');
$table->addCell(4500)->addImage(
'resources/PhpWord.png',
array('width' => 80, 'height' => 80, 'align' => 'right')
);
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
$table->addCell(4500)->addImage('resources/PhpWord.png', ['width' => 80, 'height' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]);
// Add header for all other pages
$subsequent = $section->addHeader();
$subsequent->addText("Subsequent pages in Section 1 will Have this!");
$subsequent->addText('Subsequent pages in Section 1 will Have this!');
$subsequent->addImage('resources/_mars.jpg', ['width' => 80, 'height' => 80]);
// Add footer
$footer = $section->addFooter();
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.', array('align' => 'center'));
$footer->addLink('http://google.com', 'Direct Google');
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.', null, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$footer->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
// Write some text
$section->addTextBreak();
@ -53,7 +52,7 @@ $section->addText('Some text...');
$section2 = $phpWord->addSection();
$sec2Header = $section2->addHeader();
$sec2Header->addText("All pages in Section 2 will Have this!");
$sec2Header->addText('All pages in Section 2 will Have this!');
// Write some text
$section2->addTextBreak();

View File

@ -1,34 +1,98 @@
<?php
use PhpOffice\PhpWord\Element\Section;
use PhpOffice\PhpWord\Shared\Converter;
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$section = $phpWord->addSection();
$section->addText('Local image without any styles:');
$section->addImage('resources/_mars.jpg');
$section->addTextBreak(2);
printSeparator($section);
$section->addText('Local image with styles:');
$section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'align' => 'center'));
$section->addTextBreak(2);
$section->addImage('resources/_earth.jpg', ['width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
// Remote image
printSeparator($section);
$source = 'http://php.net/images/logos/php-med-trans-light.gif';
$section->addText("Remote image from: {$source}");
$section->addImage($source);
// Image from string
printSeparator($section);
$source = 'resources/_mars.jpg';
$fileContent = file_get_contents($source);
$section->addText('Image from string');
$section->addImage($fileContent);
//Wrapping style
$text = str_repeat('Hello World! ', 15);
$wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight');
printSeparator($section);
$text = str_repeat('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 2);
$wrappingStyles = ['inline', 'behind', 'infront', 'square', 'tight'];
foreach ($wrappingStyles as $wrappingStyle) {
$section->addTextBreak(5);
$section->addText('Wrapping style ' . $wrappingStyle);
$section->addImage('resources/_earth.jpg', array('marginTop' => -1, 'marginLeft' => 1,
'width' => 80, 'height' => 80, 'wrappingStyle' => $wrappingStyle));
$section->addText("Wrapping style {$wrappingStyle}");
$section->addImage(
'resources/_earth.jpg',
[
'positioning' => 'relative',
'marginTop' => -1,
'marginLeft' => 1,
'width' => 80,
'height' => 80,
'wrappingStyle' => $wrappingStyle,
'wrapDistanceRight' => Converter::cmToPoint(1),
'wrapDistanceBottom' => Converter::cmToPoint(1),
]
);
$section->addText($text);
printSeparator($section);
}
//Absolute positioning
$section->addText('Absolute positioning: see top right corner of page');
$section->addImage(
'resources/_mars.jpg',
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT,
'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE,
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE,
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.5),
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.55),
]
);
//Relative positioning
printSeparator($section);
$section->addText('Relative positioning: Horizontal position center relative to column,');
$section->addText('Vertical position top relative to line');
$section->addImage(
'resources/_mars.jpg',
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE,
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER,
'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_COLUMN,
'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP,
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_LINE,
]
);
function printSeparator(Section $section): void
{
$section->addTextBreak();
$lineStyle = ['weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center'];
$section->addLine($lineStyle);
$section->addTextBreak(2);
}
// Save file

View File

@ -1,36 +1,43 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
// Define styles
$fontStyleName = 'myOwnStyle';
$phpWord->addFontStyle($fontStyleName, ['color' => 'FF0000']);
$paragraphStyleName = 'P-Style';
$phpWord->addParagraphStyle($paragraphStyleName, ['spaceAfter' => 95]);
$multilevelNumberingStyleName = 'multilevel';
$phpWord->addNumberingStyle(
$multilevelNumberingStyleName,
[
'type' => 'multilevel',
'levels' => [
['format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360],
['format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720],
],
]
);
$predefinedMultilevelStyle = ['listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED];
// New section
$section = $phpWord->addSection();
// Style definition
$phpWord->addFontStyle('myOwnStyle', array('color'=>'FF0000'));
$phpWord->addParagraphStyle('P-Style', array('spaceAfter'=>95));
$phpWord->addNumberingStyle(
'multilevel',
array('type' => 'multilevel', 'levels' => array(
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
)
)
);
$predefinedMultilevel = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED);
// Lists
$section->addText('Multilevel list.');
$section->addListItem('List Item I', 0, null, 'multilevel');
$section->addListItem('List Item I.a', 1, null, 'multilevel');
$section->addListItem('List Item I.b', 1, null, 'multilevel');
$section->addListItem('List Item II', 0, null, 'multilevel');
$section->addListItem('List Item II.a', 1, null, 'multilevel');
$section->addListItem('List Item III', 0, null, 'multilevel');
$section->addListItem('List Item I', 0, null, $multilevelNumberingStyleName);
$section->addListItem('List Item I.a', 1, null, $multilevelNumberingStyleName);
$section->addListItem('List Item I.b', 1, null, $multilevelNumberingStyleName);
$section->addListItem('List Item II', 0, null, $multilevelNumberingStyleName);
$section->addListItem('List Item II.a', 1, null, $multilevelNumberingStyleName);
$section->addListItem('List Item III', 0, null, $multilevelNumberingStyleName);
$section->addTextBreak(2);
$section->addText('Basic simple bulleted list.');
@ -40,20 +47,54 @@ $section->addListItem('List Item 3');
$section->addTextBreak(2);
$section->addText('Continue from multilevel list above.');
$section->addListItem('List Item IV', 0, null, 'multilevel');
$section->addListItem('List Item IV.a', 1, null, 'multilevel');
$section->addListItem('List Item IV', 0, null, $multilevelNumberingStyleName);
$section->addListItem('List Item IV.a', 1, null, $multilevelNumberingStyleName);
$section->addTextBreak(2);
$section->addText('Multilevel predefined list.');
$section->addListItem('List Item 1', 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 2', 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 3', 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 4', 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 5', 2, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 6', 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 7', 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
$section->addListItem('List Item 1', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 2', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 3', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 4', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 5', 2, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 6', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addListItem('List Item 7', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
$section->addTextBreak(2);
$section->addText('List with inline formatting.');
$listItemRun = $section->addListItemRun();
$listItemRun->addText('List item 1');
$listItemRun->addText(' in bold', ['bold' => true]);
$listItemRun = $section->addListItemRun(1, $predefinedMultilevelStyle, $paragraphStyleName);
$listItemRun->addText('List item 2');
$listItemRun->addText(' in italic', ['italic' => true]);
$footnote = $listItemRun->addFootnote();
$footnote->addText('this is a footnote on a list item');
$listItemRun = $section->addListItemRun();
$listItemRun->addText('List item 3');
$listItemRun->addText(' underlined', ['underline' => 'dash']);
$section->addTextBreak(2);
// Numbered heading
$headingNumberingStyleName = 'headingNumbering';
$phpWord->addNumberingStyle(
$headingNumberingStyleName,
['type' => 'multilevel',
'levels' => [
['pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'],
['pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'],
['pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'],
],
]
);
$phpWord->addTitleStyle(1, ['size' => 16], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 0]);
$phpWord->addTitleStyle(2, ['size' => 14], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 1]);
$phpWord->addTitleStyle(3, ['size' => 12], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 2]);
$section->addTitle('Heading 1', 1);
$section->addTitle('Heading 2', 2);
$section->addTitle('Heading 3', 3);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {

View File

@ -1,20 +1,27 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
// Define styles
$linkFontStyleName = 'myOwnLinStyle';
$phpWord->addLinkStyle($linkFontStyleName, ['bold' => true, 'color' => '808000']);
// New section
$section = $phpWord->addSection();
// Add hyperlink elements
$section->addLink('http://www.google.com', 'Best search engine', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
$section->addLink(
'https://github.com/PHPOffice/PHPWord',
'PHPWord on GitHub',
['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]
);
$section->addTextBreak(2);
$phpWord->addLinkStyle('myOwnLinkStyle', array('bold'=>true, 'color'=>'808000'));
$section->addLink('http://www.bing.com', null, 'myOwnLinkStyle');
$section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
$section->addLink('http://www.bing.com', null, $linkFontStyleName);
$section->addLink('http://www.yahoo.com', null, $linkFontStyleName);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,15 +1,16 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$section = $phpWord->addSection();
$section->addText('You can open this OLE object by double clicking on the icon:');
$section->addTextBreak(2);
$section->addObject('resources/_sheet.xls');
$section->addOLEObject('resources/_sheet.xls');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,29 +1,30 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->getSettings()->setUpdateFields(true);
// Begin code
// New section
$section = $phpWord->addSection();
// Define the TOC font style
$fontStyle = array('spaceAfter' => 60, 'size' => 12);
$fontStyle2 = array('size' => 10);
// Add title styles
$phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true));
$phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666'));
$phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true));
$phpWord->addTitleStyle(4, array('size' => 12));
// Define styles
$fontStyle12 = ['spaceAfter' => 60, 'size' => 12];
$fontStyle10 = ['size' => 10];
$phpWord->addTitleStyle(null, ['size' => 22, 'bold' => true]);
$phpWord->addTitleStyle(1, ['size' => 20, 'color' => '333333', 'bold' => true]);
$phpWord->addTitleStyle(2, ['size' => 16, 'color' => '666666']);
$phpWord->addTitleStyle(3, ['size' => 14, 'italic' => true]);
$phpWord->addTitleStyle(4, ['size' => 12]);
// Add text elements
$section->addText('Table of contents 1');
$section->addTitle('Table of contents 1', 0);
$section->addTextBreak(2);
// Add TOC #1
$toc = $section->addTOC($fontStyle);
$toc = $section->addTOC($fontStyle12);
$section->addTextBreak(2);
// Filler
@ -33,14 +34,13 @@ $section->addTextBreak(2);
// Add TOC #1
$section->addText('Table of contents 2');
$section->addTextBreak(2);
$toc2 = $section->addTOC($fontStyle2);
$toc2 = $section->addTOC($fontStyle10);
$toc2->setMinDepth(2);
$toc2->setMaxDepth(3);
// Add Titles
$section->addPageBreak();
$section->addTitle('I am Title 1', 1);
$section->addTitle('Foo n Bar', 1);
$section->addText('Some text...');
$section->addTextBreak(2);
@ -66,7 +66,7 @@ $section->addText('Text');
$section->addTitle('Subtitle 3.1.2', 3);
$section->addText('Text');
echo date('H:i:s'), " Note: Please refresh TOC manually.", EOL;
echo date('H:i:s'), ' Note: Please refresh TOC manually.', EOL;
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,15 +1,15 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$section = $phpWord->addSection();
$header = $section->addHeader();
$header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55));
$header->addWatermark('resources/_earth.jpg', ['marginTop' => 200, 'marginLeft' => 55]);
$section->addText('The header reference to the current section includes a watermark image.');
// Save file

View File

@ -1,28 +1,35 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$fontStyle = array('size' => 24);
$paragraphStyle = array('spacing' => 240, 'size' => 24);
$phpWord->addFontStyle('fontStyle', array('size' => 9));
$phpWord->addParagraphStyle('paragraphStyle', array('spacing' => 480));
$fontStyle = array('size' => 24);
// Define styles
$fontStyle24 = ['size' => 24];
$paragraphStyle24 = ['spacing' => 240, 'size' => 24];
$fontStyleName = 'fontStyle';
$phpWord->addFontStyle($fontStyleName, ['size' => 9]);
$paragraphStyleName = 'paragraphStyle';
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 480]);
// New section
$section = $phpWord->addSection();
$section->addText('Text break with no style:');
$section->addTextBreak();
$section->addText('Text break with defined font style:');
$section->addTextBreak(1, 'fontStyle');
$section->addTextBreak(1, $fontStyleName);
$section->addText('Text break with defined paragraph style:');
$section->addTextBreak(1, null, 'paragraphStyle');
$section->addTextBreak(1, null, $paragraphStyleName);
$section->addText('Text break with inline font style:');
$section->addTextBreak(1, $fontStyle);
$section->addTextBreak(1, $fontStyle24);
$section->addText('Text break with inline paragraph style:');
$section->addTextBreak(1, null, $paragraphStyle);
$section->addTextBreak(1, null, $paragraphStyle24);
$section->addText('Done.');
// Save file

View File

@ -1,14 +1,20 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
$section->addText("This is some text highlighted using fgColor (limited to 15 colors) ", array("fgColor" => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW));
$section->addText("This one uses bgColor and is using hex value (0xfbbb10)", array("bgColor" => "fbbb10"));
$section->addText("Compatible with font colors", array("color"=>"0000ff", "bgColor" => "fbbb10"));
$section->addText(
'This is some text highlighted using fgColor (limited to 15 colors)',
['fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW]
);
$section->addText('This one uses bgColor and is using hex value (0xfbbb10)', ['bgColor' => 'fbbb10']);
$section->addText('Compatible with font colors', ['color' => '0000ff', 'bgColor' => 'fbbb10']);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,31 +1,44 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
$section->addText("By default, when you insert an image, it adds a textbreak after its content.");
$section->addText("If we want a simple border around an image, we wrap the image inside a table->row->cell");
$section->addText("On the image with the red border, even if we set the row height to the height of the image, the textbreak is still there:");
$section->addText('By default, when you insert an image, it adds a textbreak after its content.');
$section->addText('If we want a simple border around an image, we wrap the image inside a table->row->cell');
$section->addText(
'On the image with the red border, even if we set the row height to the height of the image, '
. 'the textbreak is still there:'
);
$table1 = $section->addTable(array("cellMargin" => 0, "cellMarginRight" => 0, "cellMarginBottom" => 0, "cellMarginLeft" => 0));
$table1 = $section->addTable(['cellMargin' => 0, 'cellMarginRight' => 0, 'cellMarginBottom' => 0, 'cellMarginLeft' => 0]);
$table1->addRow(3750);
$cell1 = $table1->addCell(null, array("valign" => "top", "borderSize" => 30, "borderColor" => "ff0000"));
$cell1->addImage("./resources/_earth.jpg", array("width" => 250, "height" => 250, "align" => "center"));
$cell1 = $table1->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => 'ff0000']);
$cell1->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$section->addTextBreak();
$section->addText("But if we set the rowStyle 'exactHeight' to true, the real row height is used, removing the textbreak:");
$table2 = $section->addTable(array("cellMargin" => 0, "cellMarginRight" => 0, "cellMarginBottom" => 0, "cellMarginLeft" => 0));
$table2->addRow(3750, array("exactHeight" => true));
$cell2 = $table2->addCell(null, array("valign" => "top", "borderSize" => 30, "borderColor" => "00ff00"));
$cell2->addImage("./resources/_earth.jpg", array("width" => 250, "height" => 250, "align" => "center"));
$table2 = $section->addTable(
[
'cellMargin' => 0,
'cellMarginRight' => 0,
'cellMarginBottom' => 0,
'cellMarginLeft' => 0,
]
);
$table2->addRow(3750, ['exactHeight' => true]);
$cell2 = $table2->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => '00ff00']);
$cell2->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$section->addTextBreak();
$section->addText("In this example, image is 250px height. Rows are calculated in twips, and 1px = 15twips.");
$section->addText("So: $"."table2->addRow(3750, array('exactHeight'=>true));");
$section->addText('In this example, image is 250px height. Rows are calculated in twips, and 1px = 15twips.');
$section->addText('So: $' . "table2->addRow(3750, array('exactHeight'=>true));");
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);

View File

@ -1,11 +1,14 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), " Create new PhpWord object", EOL;
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
$section->addText('Check box in section');
$section->addCheckBox('chkBox1', 'Checkbox 1');
$section->addText('Check box in table cell');

View File

@ -1,24 +1,21 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$document = $phpWord->loadTemplate('resources/Sample_23_TemplateBlock.docx');
// Template processor instance creation
echo date('H:i:s') , ' Creating new TemplateProcessor instance...' , EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_23_TemplateBlock.docx');
// Will clone everything between ${tag} and ${/tag}, the number of times. By default, 1.
$document->cloneBlock('CLONEME', 3);
$templateProcessor->cloneBlock('CLONEME', 3);
// Everything between ${tag} and ${/tag}, will be deleted/erased.
$document->deleteBlock('DELETEME');
$templateProcessor->deleteBlock('DELETEME');
$name = 'Sample_23_TemplateBlock.docx';
echo date('H:i:s'), " Write to Word2007 format", EOL;
$document->saveAs($name);
rename($name, "results/{$name}");
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
echo getEndingNotes(array('Word2007' => 'docx'));
echo getEndingNotes(['Word2007' => 'docx'], 'Sample_23_TemplateBlock');
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -1,9 +1,11 @@
<?php
include_once 'Sample_Header.php';
// Read contents
$name = basename(__FILE__, '.php');
$source = "resources/{$name}.odt";
$source = __DIR__ . "/resources/{$name}.odt";
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'ODText');

View File

@ -0,0 +1,49 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
// In section
$textbox = $section->addTextBox(
[
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER,
'width' => 400,
'height' => 150,
'borderSize' => 1,
'borderColor' => '#FF0000',
]
);
$textbox->addText('Text box content in section.');
$textbox->addText('Another line.');
$cell = $textbox->addTable()->addRow()->addCell();
$cell->addText('Table inside textbox');
// Inside table
$section->addTextBreak(2);
$cell = $section->addTable()->addRow()->addCell(300);
$textbox = $cell->addTextBox(['borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100]);
$textbox->addText('Textbox inside table');
// Inside header with textrun
$header = $section->addHeader();
$textbox = $header->addTextBox(['width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00']);
$textrun = $textbox->addTextRun();
$textrun->addText('TextBox in header. TextBox can contain a TextRun ');
$textrun->addText('with bold text', ['bold' => true]);
$textrun->addText(', ');
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
$textrun->addText(', and image ');
$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
$textrun->addText('.');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

102
samples/Sample_26_Html.php Normal file
View File

@ -0,0 +1,102 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addParagraphStyle('Heading2', ['alignment' => 'center']);
$section = $phpWord->addSection();
$html = '<h1>Adding element via HTML</h1>';
$html .= '<p>Some well-formed HTML snippet needs to be used</p>';
$html .= '<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>';
$html .= '<p>A link to <a href="http://phpword.readthedocs.io/" style="text-decoration: underline">Read the docs</a></p>';
$html .= '<p lang="he-IL" style="text-align: right; direction: rtl">היי, זה פסקה מימין לשמאל</p>';
$html .= '<p style="margin-top: 240pt;">Unordered (bulleted) list:</p>';
$html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>';
$html .= '<p style="margin-top: 240pt;">1.5 line height with first line text indent:</p>';
$html .= '<p style="text-align: justify; text-indent: 70.9pt; line-height: 150%;">Lorem ipsum dolor sit amet, <strong>consectetur adipiscing elit</strong>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>';
$html .= '<h2 style="align: center">centered title</h2>';
$html .= '<p style="margin-top: 240pt;">Ordered (numbered) list:</p>';
$html .= '<ol>
<li><p style="font-weight: bold;">List 1 item 1</p></li>
<li>List 1 item 2</li>
<ol>
<li>sub list 1</li>
<li>sub list 2</li>
</ol>
<li>List 1 item 3</li>
</ol>
<p style="margin-top: 15px;">A second list, numbering should restart</p>
<ol>
<li>List 2 item 1</li>
<li>List 2 item 2</li>
<li>
<ol>
<li>sub list 1</li>
<li>sub list 2</li>
</ol>
</li>
<li>List 2 item 3</li>
<ol>
<li>sub list 1, restarts with a</li>
<li>sub list 2</li>
</ol>
</ol>';
$html .= '<p style="margin-top: 240pt;">List with formatted content:</p>';
$html .= '<ul>
<li>
<span style="font-family: arial,helvetica,sans-serif;">
<span style="font-size: 16px;">big list item1</span>
</span>
</li>
<li>
<span style="font-family: arial,helvetica,sans-serif;">
<span style="font-size: 10px; font-weight: bold;">list item2 in bold</span>
</span>
</li>
</ul>';
$html .= '<p style="margin-top: 240pt;">A table with formatting:</p>';
$html .= '<table align="center" style="width: 50%; border: 6px #0000FF double;">
<thead>
<tr style="background-color: #FF0000; text-align: center; color: #FFFFFF; font-weight: bold; ">
<th style="width: 50pt">header a</th>
<th style="width: 50">header b</th>
<th style="background-color: #FFFF00; border-width: 12px"><span style="background-color: #00FF00;">header c</span></th>
</tr>
</thead>
<tbody>
<tr><td style="border-style: dotted; border-color: #FF0000">1</td><td colspan="2">2</td></tr>
<tr><td>This is <b>bold</b> text</td><td></td><td>6</td></tr>
</tbody>
</table>';
$html .= '<p style="margin-top: 240pt;">Table inside another table:</p>';
$html .= '<table align="center" style="width: 80%; border: 6px #0000FF double;">
<tr><td>
<table style="width: 100%; border: 4px #FF0000 dotted;">
<tr><td>column 1</td><td>column 2</td></tr>
</table>
</td></tr>
<tr><td style="text-align: center;">Cell in parent table</td></tr>
</table>';
$html .= '<p style="margin-top: 240pt;">The text below is not visible, click on show/hide to reveil it:</p>';
$html .= '<p style="display: none">This is hidden text</p>';
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,71 @@
<?php
use PhpOffice\PhpWord\Element\TextRun;
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
PhpOffice\PhpWord\Style::addTitleStyle(1, ['size' => 14]);
// New section
$section = $phpWord->addSection();
$section->addTitle('This page demos fields');
// Add Field elements
// See Element/Field.php for all options
$section->addText('Date field:');
$section->addField('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']);
$section->addText('Style Ref field:');
$section->addField('STYLEREF', ['StyleIdentifier' => 'Heading 1']);
$section->addText('Page field:');
$section->addField('PAGE', ['format' => 'Arabic']);
$section->addText('Number of pages field:');
$section->addField('NUMPAGES', ['numformat' => '0,00', 'format' => 'Arabic'], ['PreserveFormat']);
$section->addTextBreak();
$textrun = $section->addTextRun();
$textrun->addText('An index field is ');
$textrun->addField('XE', [], ['Italic'], 'My first index');
$textrun->addText('here:');
$indexEntryText = new TextRun();
$indexEntryText->addText('My ');
$indexEntryText->addText('bold index', ['bold' => true]);
$indexEntryText->addText(' entry');
$textrun = $section->addTextRun();
$textrun->addText('A complex index field is ');
$textrun->addField('XE', [], ['Bold'], $indexEntryText);
$textrun->addText('here:');
$section->addText('The actual index:');
$section->addField('INDEX', [], ['\\e " "'], 'right click to update the index');
$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$textrun->addText('This is the date of lunar calendar ');
$textrun->addField('DATE', ['dateformat' => 'd-M-yyyy H:mm:ss'], ['PreserveFormat', 'LunarCalendar']);
$textrun->addText(' written in a textrun.');
$section->addTextBreak();
$macroText = new TextRun();
$macroText->addText('Double click', ['bold' => true]);
$macroText->addText(' to ');
$macroText->addText('zoom to 100%', ['italic' => true]);
$section->addText('A macro button with styled text:');
$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], $macroText);
$section->addTextBreak();
$section->addText('A macro button with simple text:');
$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], 'double click to zoom');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,16 @@
<?php
include_once 'Sample_Header.php';
// Read contents
$name = basename(__FILE__, '.php');
$source = __DIR__ . "/resources/{$name}.rtf";
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'RTF');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,65 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
// Add Line elements
// See Element/Line.php for all options
$section->addText('Horizontal Line (Inline style):');
$section->addLine(
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
'positioning' => 'absolute',
]
);
$section->addText('Vertical Line (Inline style):');
$section->addLine(
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
'positioning' => 'absolute',
]
);
// Two text break
$section->addTextBreak(1);
$section->addText('Positioned Line (red):');
$section->addLine(
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
'positioning' => 'absolute',
'posHorizontalRel' => 'page',
'posVerticalRel' => 'page',
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(10),
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(8),
'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE,
'color' => 'red',
]
);
$section->addText('Horizontal Formatted Line');
$section->addLine(
[
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
'positioning' => 'absolute',
'beginArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_BLOCK,
'endArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_OVAL,
'dash' => \PhpOffice\PhpWord\Style\Line::DASH_STYLE_LONG_DASH_DOT_DOT,
'weight' => 10,
]
);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,16 @@
<?php
include_once 'Sample_Header.php';
// Read contents
$name = basename(__FILE__, '.php');
$source = realpath(__DIR__ . "/resources/{$name}.html");
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'HTML');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,98 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
// Define styles
$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true]);
// Arc
$section->addTitle('Arc', 1);
$section->addShape(
'arc',
[
'points' => '-90 20',
'frame' => ['width' => 120, 'height' => 120],
'outline' => ['color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'],
]
);
// Curve
$section->addTitle('Curve', 1);
$section->addShape(
'curve',
[
'points' => '1,100 200,1 1,50 200,50',
'connector' => 'elbow',
'outline' => [
'color' => '#66cc00',
'weight' => 2,
'dash' => 'dash',
'startArrow' => 'diamond',
'endArrow' => 'block',
],
]
);
// Line
$section->addTitle('Line', 1);
$section->addShape(
'line',
[
'points' => '1,1 150,30',
'outline' => [
'color' => '#cc00ff',
'line' => 'thickThin',
'weight' => 3,
'startArrow' => 'oval',
'endArrow' => 'classic',
],
]
);
// Polyline
$section->addTitle('Polyline', 1);
$section->addShape(
'polyline',
[
'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50',
'outline' => ['color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'],
]
);
// Rectangle
$section->addTitle('Rectangle', 1);
$section->addShape(
'rect',
[
'roundness' => 0.2,
'frame' => ['width' => 100, 'height' => 100, 'left' => 1, 'top' => 1],
'fill' => ['color' => '#FFCC33'],
'outline' => ['color' => '#990000', 'weight' => 1],
'shadow' => [],
]
);
// Oval
$section->addTitle('Oval', 1);
$section->addShape(
'oval',
[
'frame' => ['width' => 100, 'height' => 70, 'left' => 1, 'top' => 1],
'fill' => ['color' => '#33CC99'],
'outline' => ['color' => '#333333', 'weight' => 2],
'extrusion' => [],
]
);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,80 @@
<?php
include_once 'Sample_Header.php';
use PhpOffice\PhpWord\Shared\Converter;
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Define styles
$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]);
$phpWord->addTitleStyle(2, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]);
// 2D charts
$section = $phpWord->addSection();
$section->addTitle('2D charts', 1);
$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']);
$chartTypes = ['pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
$twoSeries = ['bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
$threeSeries = ['bar', 'line'];
$categories = ['A', 'B', 'C', 'D', 'E'];
$series1 = [1, 3, 2, 5, 4];
$series2 = [3, 1, 7, 2, 6];
$series3 = [8, 3, 2, 5, 4];
$showGridLines = false;
$showAxisLabels = false;
$showLegend = true;
$legendPosition = 't';
// r = right, l = left, t = top, b = bottom, tr = top right
foreach ($chartTypes as $chartType) {
$section->addTitle(ucfirst($chartType), 2);
$chart = $section->addChart($chartType, $categories, $series1);
$chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2));
$chart->getStyle()->setShowGridX($showGridLines);
$chart->getStyle()->setShowGridY($showGridLines);
$chart->getStyle()->setShowAxisLabels($showAxisLabels);
$chart->getStyle()->setShowLegend($showLegend);
$chart->getStyle()->setLegendPosition($legendPosition);
if (in_array($chartType, $twoSeries)) {
$chart->addSeries($categories, $series2);
}
if (in_array($chartType, $threeSeries)) {
$chart->addSeries($categories, $series3);
}
$section->addTextBreak();
}
// 3D charts
$section = $phpWord->addSection(['breakType' => 'continuous']);
$section->addTitle('3D charts', 1);
$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']);
$chartTypes = ['pie', 'bar', 'column', 'line', 'area'];
$multiSeries = ['bar', 'column', 'line', 'area'];
$style = [
'width' => Converter::cmToEmu(5),
'height' => Converter::cmToEmu(4),
'3d' => true,
'showAxisLabels' => $showAxisLabels,
'showGridX' => $showGridLines,
'showGridY' => $showGridLines,
];
foreach ($chartTypes as $chartType) {
$section->addTitle(ucfirst($chartType), 2);
$chart = $section->addChart($chartType, $categories, $series1, $style);
if (in_array($chartType, $multiSeries)) {
$chart->addSeries($categories, $series2);
$chart->addSeries($categories, $series3);
}
$section->addTextBreak();
}
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,29 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->getSettings()->getDocumentProtection()->setEditing('forms');
// New section
$section = $phpWord->addSection();
$textrun = $section->addTextRun();
$textrun->addText('Form fields can be added in a text run and can be in form of textinput ');
$textrun->addFormField('textinput')->setName('MyTextBox');
$textrun->addText(', checkbox ');
$textrun->addFormField('checkbox')->setDefault(true);
$textrun->addText(', or dropdown ');
$textrun->addFormField('dropdown')->setEntries(['Choice 1', 'Choice 2', 'Choice 3']);
$textrun->addText('. You have to set document protection to "forms" to enable dropdown.');
$section->addText('They can also be added as a stand alone paragraph.');
$section->addFormField('textinput')->setValue('Your name');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

34
samples/Sample_34_SDT.php Normal file
View File

@ -0,0 +1,34 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
$textrun = $section->addTextRun();
$textrun->addText('Combobox: ');
$textrun->addSDT('comboBox')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2']);
$textrun = $section->addTextRun();
$textrun->addText('Date: ');
$textrun->addSDT('date');
$textrun->addTextBreak(1);
$textrun->addText('Date with pre set value: ');
$textrun->addSDT('date')->setValue('03/30/2017');
$textrun->addTextBreak(1);
$textrun->addText('Date with pre set value: ');
$textrun->addSDT('date')->setValue('30.03.2017');
$textrun = $section->addTextRun();
$textrun->addText('Drop down list: ');
$textrun->addSDT('dropDownList')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2'])->setValue('Choice 1');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,23 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addTitle('This is page 1', 1);
$linkIsInternal = true;
$section->addLink('MyBookmark', 'Take me to page 3', null, null, $linkIsInternal);
$section->addPageBreak();
$section->addTitle('This is page 2', 1);
$section->addPageBreak();
$section->addTitle('This is page 3', 1);
$section->addBookmark('MyBookmark');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

45
samples/Sample_36_RTL.php Normal file
View File

@ -0,0 +1,45 @@
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New section
$section = $phpWord->addSection();
$textrun = $section->addTextRun();
$textrun->addText('This is a Left to Right paragraph.');
$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]);
$textrun->addText('سلام این یک پاراگراف راست به چپ است', ['rtl' => true]);
$section->addText('Table visually presented as RTL');
$style = ['rtl' => true, 'size' => 12];
$tableStyle = ['borderSize' => 6, 'borderColor' => '000000', 'width' => 5000, 'unit' => \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT, 'bidiVisual' => true];
$table = $section->addTable($tableStyle);
$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER];
$cellHEnd = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END];
$cellVCentered = ['valign' => \PhpOffice\PhpWord\SimpleType\VerticalJc::CENTER];
//Vidually bidirectinal table
$table->addRow();
$cell = $table->addCell(500, $cellVCentered);
$textrun = $cell->addTextRun($cellHCentered);
$textrun->addText('ردیف', $style);
$cell = $table->addCell(11000);
$textrun = $cell->addTextRun($cellHEnd);
$textrun->addText('سوالات', $style);
$cell = $table->addCell(500, $cellVCentered);
$textrun = $cell->addTextRun($cellHCentered);
$textrun->addText('بارم', $style);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,63 @@
<?php
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// A comment
$comment = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
$comment->addText('Test', ['bold' => true]);
$phpWord->addComment($comment);
$section = $phpWord->addSection();
$textrun = $section->addTextRun();
$textrun->addText('This ');
$text = $textrun->addText('is');
$text->setCommentRangeStart($comment);
$textrun->addText(' a test');
$section->addTextBreak(2);
// Let's create a comment that we will link to a start element and an end element
$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime());
$commentWithStartAndEnd->addText('A comment with a start and an end');
$phpWord->addComment($commentWithStartAndEnd);
$textrunWithEnd = $section->addTextRun();
$textrunWithEnd->addText('This ');
$textToStartOn = $textrunWithEnd->addText('is', ['bold' => true]);
$textToStartOn->setCommentRangeStart($commentWithStartAndEnd);
$textrunWithEnd->addText(' another', ['italic' => true]);
$textToEndOn = $textrunWithEnd->addText(' test');
$textToEndOn->setCommentRangeEnd($commentWithStartAndEnd);
$section->addTextBreak(2);
// Let's add a comment on an image
$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime());
$imageComment = $commentOnImage->addTextRun();
$imageComment->addText('Hey, Mars does look ');
$imageComment->addText('red', ['color' => 'FF0000']);
$phpWord->addComment($commentOnImage);
$image = $section->addImage('resources/_mars.jpg');
$image->setCommentRangeStart($commentOnImage);
$section->addTextBreak(2);
// We can also do things the other way round, link the comment to the element
$anotherText = $section->addText('another text');
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
$comment1->addText('Test', ['bold' => true]);
$comment1->setStartElement($anotherText);
$comment1->setEndElement($anotherText);
$phpWord->addComment($comment1);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,22 @@
<?php
use PhpOffice\PhpWord\SimpleType\DocProtect;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(DocProtect::READ_ONLY);
$documentProtection->setPassword('myPassword');
$section = $phpWord->addSection();
$section->addText('this document is password protected');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,30 @@
<?php
use PhpOffice\PhpWord\Element\TrackChange;
include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section
$section = $phpWord->addSection();
$textRun = $section->addTextRun();
$text = $textRun->addText('Hello World! Time to ');
$text = $textRun->addText('wake ', ['bold' => true]);
$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);
$text = $textRun->addText('up');
$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));
$text = $textRun->addText('go to sleep');
$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,46 @@
<?php
use PhpOffice\PhpWord\Element\Field;
use PhpOffice\PhpWord\Element\Table;
use PhpOffice\PhpWord\Element\TextRun;
use PhpOffice\PhpWord\SimpleType\TblWidth;
include_once 'Sample_Header.php';
// Template processor instance creation
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_40_TemplateSetComplexValue.docx');
$title = new TextRun();
$title->addText('This title has been set ', ['bold' => true, 'italic' => true, 'color' => 'blue']);
$title->addText('dynamically', ['bold' => true, 'italic' => true, 'color' => 'red', 'underline' => 'single']);
$templateProcessor->setComplexBlock('title', $title);
$inline = new TextRun();
$inline->addText('by a red italic text', ['italic' => true, 'color' => 'red']);
$templateProcessor->setComplexValue('inline', $inline);
$table = new Table(['borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP]);
$table->addRow();
$table->addCell(150)->addText('Cell A1');
$table->addCell(150)->addText('Cell A2');
$table->addCell(150)->addText('Cell A3');
$table->addRow();
$table->addCell(150)->addText('Cell B1');
$table->addCell(150)->addText('Cell B2');
$table->addCell(150)->addText('Cell B3');
$templateProcessor->setComplexBlock('table', $table);
$field = new Field('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']);
$templateProcessor->setComplexValue('field', $field);
// $link = new Link('https://github.com/PHPOffice/PHPWord');
// $templateProcessor->setComplexValue('link', $link);
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_40_TemplateSetComplexValue.docx');
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_40_TemplateSetComplexValue.docx');
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -0,0 +1,46 @@
<?php
use PhpOffice\PhpWord\Element\Chart;
use PhpOffice\PhpWord\Shared\Converter;
include_once 'Sample_Header.php';
// Template processor instance creation
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_41_TemplateSetChart.docx');
$chartTypes = ['pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
$twoSeries = ['bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
$threeSeries = ['bar', 'line'];
$categories = ['A', 'B', 'C', 'D', 'E'];
$series1 = [1, 3, 2, 5, 4];
$series2 = [3, 1, 7, 2, 6];
$series3 = [8, 3, 2, 5, 4];
$i = 0;
foreach ($chartTypes as $chartType) {
$chart = new Chart($chartType, $categories, $series1);
if (in_array($chartType, $twoSeries)) {
$chart->addSeries($categories, $series2);
}
if (in_array($chartType, $threeSeries)) {
$chart->addSeries($categories, $series3);
}
$chart->getStyle()
->setWidth(Converter::inchToEmu(3))
->setHeight(Converter::inchToEmu(3));
$templateProcessor->setChart("chart{$i}", $chart);
++$i;
}
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_41_TemplateSetChart.docx');
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_41_TemplateSetChart.docx');
if (!CLI) {
include_once 'Sample_Footer.php';
}

View File

@ -1,7 +1,7 @@
<?php
/**
* Footer file
*/
if (CLI) {
return;
}
?>
</div>
<script src="bootstrap/js/jquery.min.js"></script>

View File

@ -1,27 +1,34 @@
<?php
/**
* Header file
*/
require_once __DIR__ . '/../bootstrap.php';
use PhpOffice\PhpWord\Settings;
date_default_timezone_set('UTC');
error_reporting(E_ALL);
define('CLI', (PHP_SAPI == 'cli') ? true : false);
define('EOL', CLI ? PHP_EOL : '<br />');
define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
define('IS_INDEX', SCRIPT_FILENAME == 'index');
require_once '../src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
Settings::loadConfig();
$dompdfPath = $vendorDirPath . '/dompdf/dompdf';
if (file_exists($dompdfPath)) {
define('DOMPDF_ENABLE_AUTOLOAD', false);
Settings::setPdfRenderer(Settings::PDF_RENDERER_DOMPDF, $vendorDirPath . '/dompdf/dompdf');
}
// Set writers
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf');
$writers = ['Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'];
// Set PDF renderer
$rendererName = \PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF;
$rendererLibraryPath = ''; // DomPDF library path
if (!\PhpOffice\PhpWord\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
if (null === Settings::getPdfRendererPath()) {
$writers['PDF'] = null;
}
// Turn output escaping on
Settings::setOutputEscapingEnabled(true);
// Return to the caller script when runs by CLI
if (CLI) {
return;
@ -36,57 +43,67 @@ $pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
// Populate samples
$files = '';
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
$sampleFiles = [];
while (false !== ($sampleFile = readdir($handle))) {
$sampleFiles[] = $sampleFile;
}
sort($sampleFiles);
closedir($handle);
foreach ($sampleFiles as $file) {
if (preg_match('/^Sample_\d+_/', $file)) {
$name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
$files .= "<li><a href='{$file}'>{$name}</a></li>";
}
}
closedir($handle);
}
/**
* Write documents
* Write documents.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @param string $filename
* @param array $writers
*
* @return string
*/
function write($phpWord, $filename, $writers)
{
$result = '';
// Write documents
foreach ($writers as $writer => $extension) {
$result .= date('H:i:s') . " Write to {$writer} format";
if (!is_null($extension)) {
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$filename}.{$extension}");
rename("{$filename}.{$extension}", "results/{$filename}.{$extension}");
foreach ($writers as $format => $extension) {
$result .= date('H:i:s') . " Write to {$format} format";
if (null !== $extension) {
$targetFile = __DIR__ . "/results/{$filename}.{$extension}";
$phpWord->save($targetFile, $format);
} else {
$result .= ' ... NOT DONE!';
}
$result .= EOL;
}
$result .= getEndingNotes($writers);
$result .= getEndingNotes($writers, $filename);
return $result;
}
/**
* Get ending notes
* Get ending notes.
*
* @param array $writers
* @param mixed $filename
*
* @return string
*/
function getEndingNotes($writers)
function getEndingNotes($writers, $filename)
{
$result = '';
// Do not show execution time for index
if (!IS_INDEX) {
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
$result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
$result .= date('H:i:s') . ' Done writing file(s)' . EOL;
$result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL;
}
// Return
@ -98,7 +115,7 @@ function getEndingNotes($writers)
$result .= '<p>&nbsp;</p>';
$result .= '<p>Results: ';
foreach ($types as $type) {
if (!is_null($type)) {
if (null !== $type) {
$resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type;
if (file_exists($resultFile)) {
$result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> ";
@ -106,6 +123,12 @@ function getEndingNotes($writers)
}
}
$result .= '</p>';
$result .= '<pre>';
if (file_exists($filename . '.php')) {
$result .= highlight_file($filename . '.php', true);
}
$result .= '</pre>';
}
}
@ -142,7 +165,7 @@ function getEndingNotes($writers)
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/PHPOffice/PHPWord"><i class="fa fa-github fa-lg" title="GitHub"></i>&nbsp;</a></li>
<li><a href="http://phpword.readthedocs.org/en/develop/"><i class="fa fa-book fa-lg" title="Docs"></i>&nbsp;</a></li>
<li><a href="http://phpword.readthedocs.org/"><i class="fa fa-book fa-lg" title="Docs"></i>&nbsp;</a></li>
<li><a href="http://twitter.com/PHPWord"><i class="fa fa-twitter fa-lg" title="Twitter"></i>&nbsp;</a></li>
</ul>
</div>

View File

@ -1,30 +1,45 @@
<?php
include_once 'Sample_Header.php';
use PhpOffice\PhpWord\Settings;
$requirements = [
'php' => ['PHP 7.1', version_compare(PHP_VERSION, '7.1', '>=')],
'xml' => ['PHP extension XML', extension_loaded('xml')],
'temp' => ['Temp folder "<code>' . Settings::getTempDir() . '</code>" is writable', is_writable(Settings::getTempDir())],
'zip' => ['PHP extension ZipArchive (optional)', extension_loaded('zip')],
'gd' => ['PHP extension GD (optional)', extension_loaded('gd')],
'xmlw' => ['PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')],
'xsl' => ['PHP extension XSL (optional)', extension_loaded('xsl')],
];
if (!CLI) {
?>
?>
<div class="jumbotron">
<p>Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).</p>
<p>&nbsp;</p>
<p>
<a class="btn btn-lg btn-primary" href="https://github.com/PHPOffice/PHPWord" role="button"><i class="fa fa-github fa-lg" title="GitHub"></i> Fork us on Github!</a>
<a class="btn btn-lg btn-primary" href="http://phpword.readthedocs.org/en/develop/" role="button"><i class="fa fa-book fa-lg" title="Docs"></i> Read the Docs</a>
<a class="btn btn-lg btn-primary" href="http://phpword.readthedocs.org/" role="button"><i class="fa fa-book fa-lg" title="Docs"></i> Read the Docs</a>
</p>
</div>
<?
$requirements = array(
'php' => array('PHP 5.3.0', version_compare(phpversion(), '5.3.0', '>=')),
'zip' => array('PHP extension ZipArchive', extension_loaded('zip')),
'xml' => array('PHP extension XML', extension_loaded('xml')),
'gd' => array('PHP extension GD (optional)', extension_loaded('gd')),
);
echo "<h3>Requirements</h3>";
echo "<ul>";
foreach ($requirements as $key => $value) {
$status = $value[1] ? 'passed' : 'failed';
echo "<li>{$value[0]} ... <span class='{$status}'>{$status}</span></li>";
}
echo "</ul>";
<?php
}
if (!CLI) {
echo '<h3>Requirement check:</h3>';
echo '<ul>';
foreach ($requirements as $key => $value) {
[$label, $result] = $value;
$status = $result ? 'passed' : 'failed';
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
}
echo '</ul>';
include_once 'Sample_Footer.php';
} else {
echo 'Requirement check:' . PHP_EOL;
foreach ($requirements as $key => $value) {
[$label, $result] = $value;
$label = strip_tags($label);
$status = $result ? '32m passed' : '31m failed';
echo "{$label} ... \033[{$status}\033[0m" . PHP_EOL;
}
}

Binary file not shown.

View File

@ -0,0 +1,21 @@
{\rtf1
\ansi\ansicpg1252
\deff0
{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Times New Roman;}}
{\colortbl;\red255\green0\blue0;\red14\green0\blue0}
{\*\generator PhpWord;}
{\info{\title }{\subject }{\category }{\keywords }{\comment }{\author }{\operator }{\creatim \yr2014\mo05\dy27\hr23\min36\sec45}{\revtim \yr2014\mo05\dy27\hr23\min36\sec45}{\company }{\manager }}
\deftab720\viewkind1\uc1\pard\nowidctlpar\lang1036\kerning1\fs20
{Welcome to PhpWord}\par
\pard\nowidctlpar{\cf0\f0 Hello World!}\par
\par
\par
\pard\nowidctlpar{\cf0\f0\fs32\b\i I am styled by a font style definition.}\par
\pard\nowidctlpar{\cf0\f0 I am styled by a paragraph style definition.}\par
\pard\nowidctlpar\qc\sa100{\cf0\f0\fs32\b\i I am styled by both font and paragraph style.}\par
\pard\nowidctlpar{\cf1\f1\fs40\b\i\ul\strike\super I am inline styled.}\par
\par
{\field {\*\fldinst {HYPERLINK "https://github.com/PHPOffice/PHPWord"}}{\fldrslt {PHPWord on GitHub}}}\par
\par
}

View File

@ -0,0 +1,25 @@
<html>
<head>
<meta charset="UTF-8" />
<title>PHPWord</title>
</head>
<body>
<h1>Adding element via HTML</h1>
<p>Some well formed HTML snippet needs to be used</p>
<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>
<p>Unordered (bulleted) list:</p>
<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>
<p>Ordered (numbered) list:</p>
<ol><li>Item 1</li><li>Item 2</li></ol>
<p style="line-height:2">Double height</p>
<h2>Includes images</h2>
<img src="https://phpword.readthedocs.io/en/latest/_images/phpword.png" alt=""/>
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
<img src="http://php.net/images/logos/php-icon.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>
</body>
</html>

Binary file not shown.

0
samples/results/.gitignore vendored Normal file → Executable file
View File

17
sonar-project.properties Normal file
View File

@ -0,0 +1,17 @@
# must be unique in a given SonarQube instance
sonar.projectKey=phpoffice:phpword
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=PHPWord
sonar.projectVersion=0.16
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=src
sonar.tests=tests
sonar.php.coverage.reportPaths=build/logs/clover.xml
sonar.php.tests.reportPath=build/logs/logfile.xml
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
sonar.host.url=http://localhost:9000

View File

@ -1,45 +0,0 @@
<?php
/**
* PHPWord
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
namespace PhpOffice\PhpWord;
/**
* Autoloader
*/
class Autoloader
{
const NAMESPACE_PREFIX = 'PhpOffice\\PhpWord\\';
/**
* Register
*
* @return void
*/
public static function register()
{
spl_autoload_register(array(new self, 'autoload'));
}
/**
* Autoload
*
* @param string $class
*/
public static function autoload($class)
{
$prefixLength = strlen(self::NAMESPACE_PREFIX);
if (0 === strncmp(self::NAMESPACE_PREFIX, $class, $prefixLength)) {
$file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
$file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
if (file_exists($file)) {
require_once $file;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More