Merge branch 'develop' into add-getVariableCount-method
This commit is contained in:
commit
aa49536e3e
|
|
@ -0,0 +1,21 @@
|
||||||
|
# build config
|
||||||
|
/.scrutinizer.yml export-ignore
|
||||||
|
/.travis.yml 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
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
build:
|
||||||
|
nodes:
|
||||||
|
analysis:
|
||||||
|
tests:
|
||||||
|
override: [php-scrutinizer-run]
|
||||||
filter:
|
filter:
|
||||||
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]
|
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]
|
||||||
|
|
||||||
|
|
@ -14,7 +19,7 @@ tools:
|
||||||
config:
|
config:
|
||||||
ruleset: phpmd.xml.dist
|
ruleset: phpmd.xml.dist
|
||||||
external_code_coverage:
|
external_code_coverage:
|
||||||
enabled: true
|
enabled: false
|
||||||
timeout: 1200
|
timeout: 1200
|
||||||
php_cpd: true
|
php_cpd: true
|
||||||
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
|
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
|
||||||
|
|
|
||||||
19
.travis.yml
19
.travis.yml
|
|
@ -13,14 +13,11 @@ php:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- php: 5.6
|
- php: 7.0
|
||||||
env: COVERAGE=1
|
env: COVERAGE=1
|
||||||
allow_failures:
|
|
||||||
- php: 7.2
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- vendor
|
|
||||||
- $HOME/.composer/cache
|
- $HOME/.composer/cache
|
||||||
- .php-cs.cache
|
- .php-cs.cache
|
||||||
|
|
||||||
|
|
@ -38,9 +35,9 @@ before_script:
|
||||||
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
|
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
|
||||||
## Composer
|
## Composer
|
||||||
- composer self-update
|
- composer self-update
|
||||||
- composer install --prefer-source
|
- travis_wait composer install --prefer-source
|
||||||
## PHPDocumentor
|
## PHPDocumentor
|
||||||
- mkdir -p build/docs
|
##- mkdir -p build/docs
|
||||||
- mkdir -p build/coverage
|
- mkdir -p build/coverage
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|
@ -55,10 +52,8 @@ script:
|
||||||
## PHPLOC
|
## PHPLOC
|
||||||
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
|
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
|
||||||
## PHPDocumentor
|
## PHPDocumentor
|
||||||
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
|
##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
|
||||||
|
|
||||||
after_script:
|
after_success:
|
||||||
## PHPDocumentor
|
## Coveralls
|
||||||
- bash .travis_shell_after_success.sh
|
- if [ -n "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi
|
||||||
## Scrutinizer
|
|
||||||
- if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi
|
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "--DEBUG--"
|
|
||||||
echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
|
|
||||||
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
|
|
||||||
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
|
|
||||||
|
|
||||||
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then
|
|
||||||
|
|
||||||
echo -e "Publishing PHPDoc...\n"
|
|
||||||
|
|
||||||
cp -R build/docs $HOME/docs-latest
|
|
||||||
cp -R build/coverage $HOME/coverage-latest
|
|
||||||
|
|
||||||
cd $HOME
|
|
||||||
git config --global user.email "travis@travis-ci.org"
|
|
||||||
git config --global user.name "travis-ci"
|
|
||||||
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPWord gh-pages > /dev/null
|
|
||||||
|
|
||||||
cd gh-pages
|
|
||||||
echo "--DEBUG : Suppression"
|
|
||||||
git rm -rf ./docs/$TRAVIS_BRANCH
|
|
||||||
|
|
||||||
echo "--DEBUG : Dossier"
|
|
||||||
mkdir -p docs/$TRAVIS_BRANCH
|
|
||||||
mkdir -p coverage/$TRAVIS_BRANCH
|
|
||||||
|
|
||||||
echo "--DEBUG : Copie"
|
|
||||||
cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/
|
|
||||||
cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/
|
|
||||||
|
|
||||||
echo "--DEBUG : Git"
|
|
||||||
git add -f .
|
|
||||||
git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)"
|
|
||||||
git push -fq origin gh-pages > /dev/null
|
|
||||||
|
|
||||||
echo -e "Published PHPDoc to gh-pages.\n"
|
|
||||||
|
|
||||||
fi
|
|
||||||
51
CHANGELOG.md
51
CHANGELOG.md
|
|
@ -3,16 +3,59 @@ Change Log
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
v0.15.0 (?? ??? 2018)
|
v0.16.0 (xx xxx 2018)
|
||||||
----------------------
|
----------------------
|
||||||
### Added
|
### Added
|
||||||
- Parsing of "align" HTML attribute - @troosan #1231
|
|
||||||
- Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- fix reading of docx default style - @troosan #1238
|
- Fix regex in `cloneBlock` function @nicoder #1269
|
||||||
|
- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
### Miscelaneous
|
||||||
|
- Drop GitHub pages, switch to coveralls for code coverage analysis @czosel #1360
|
||||||
|
|
||||||
v0.14.0 (29 Dec 2017)
|
v0.14.0 (29 Dec 2017)
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
[](https://packagist.org/packages/phpoffice/phpword)
|
[](https://packagist.org/packages/phpoffice/phpword)
|
||||||
[](https://travis-ci.org/PHPOffice/PHPWord)
|
[](https://travis-ci.org/PHPOffice/PHPWord)
|
||||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
||||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
[](https://coveralls.io/github/PHPOffice/PHPWord?branch=develop)
|
||||||
[](https://packagist.org/packages/phpoffice/phpword)
|
[](https://packagist.org/packages/phpoffice/phpword)
|
||||||
[](https://packagist.org/packages/phpoffice/phpword)
|
[](https://packagist.org/packages/phpoffice/phpword)
|
||||||
[](https://gitter.im/PHPOffice/PHPWord)
|
[](https://gitter.im/PHPOffice/PHPWord)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,19 @@
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": [
|
"test": [
|
||||||
"./vendor/bin/phpunit --color=always"
|
"phpunit --color=always"
|
||||||
],
|
],
|
||||||
"test-no-coverage": [
|
"test-no-coverage": [
|
||||||
"./vendor/bin/phpunit --color=always --no-coverage"
|
"phpunit --color=always --no-coverage"
|
||||||
],
|
],
|
||||||
"check": [
|
"check": [
|
||||||
"./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff",
|
"php-cs-fixer fix --ansi --dry-run --diff",
|
||||||
"./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
|
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
|
||||||
"./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
|
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
|
||||||
"@test"
|
"@test"
|
||||||
],
|
],
|
||||||
"fix": [
|
"fix": [
|
||||||
"./vendor/bin/php-cs-fixer fix --ansi"
|
"php-cs-fixer fix --ansi"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts-descriptions": {
|
"scripts-descriptions": {
|
||||||
|
|
@ -61,19 +61,20 @@
|
||||||
"php": "^5.3.3 || ^7.0",
|
"php": "^5.3.3 || ^7.0",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"zendframework/zend-escaper": "^2.2",
|
"zendframework/zend-escaper": "^2.2",
|
||||||
"zendframework/zend-stdlib": "^2.2 || ^3.0",
|
"phpoffice/common": "^0.2.9"
|
||||||
"phpoffice/common": "^0.2"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^4.8.36 || ^5.0",
|
"ext-zip": "*",
|
||||||
"phpdocumentor/phpdocumentor":"2.*",
|
"ext-gd": "*",
|
||||||
"squizlabs/php_codesniffer": "^2.7",
|
"phpunit/phpunit": "^4.8.36 || ^7.0",
|
||||||
"friendsofphp/php-cs-fixer": "^2.0",
|
"squizlabs/php_codesniffer": "^2.9",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.2",
|
||||||
"phpmd/phpmd": "2.*",
|
"phpmd/phpmd": "2.*",
|
||||||
"phploc/phploc": "2.* || 3.* || 4.*",
|
"phploc/phploc": "2.* || 3.* || 4.*",
|
||||||
"dompdf/dompdf":"0.8.*",
|
"dompdf/dompdf":"0.8.*",
|
||||||
"tecnickcom/tcpdf": "6.*",
|
"tecnickcom/tcpdf": "6.*",
|
||||||
"mpdf/mpdf": "5.* || 6.* || 7.*"
|
"mpdf/mpdf": "5.7.4 || 6.* || 7.*",
|
||||||
|
"php-coveralls/php-coveralls": "1.1.0 || ^2.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-zip": "Allows writing OOXML and ODF",
|
"ext-zip": "Allows writing OOXML and ODF",
|
||||||
|
|
@ -89,7 +90,7 @@
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "0.15-dev"
|
"dev-develop": "0.16-dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ This is:
|
||||||
- [ ] a feature request
|
- [ ] a feature request
|
||||||
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)
|
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)
|
||||||
|
|
||||||
# Expected Behavior
|
### Expected Behavior
|
||||||
|
|
||||||
Please describe the behavior you are expecting.
|
Please describe the behavior you are expecting.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ Fixes # (issue)
|
||||||
|
|
||||||
### Checklist:
|
### Checklist:
|
||||||
|
|
||||||
- [ ] I have run `composer check` and no errors were reported
|
- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
|
||||||
- [ ] The new code is covered by unit tests
|
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
|
||||||
- [ ] I have update the documentation to describe the changes
|
- [ ] I have update the documentation to describe the changes
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ Below are the properties of the line numbering style.
|
||||||
|
|
||||||
- ``start`` Line numbering starting value
|
- ``start`` Line numbering starting value
|
||||||
- ``increment`` Line number increments
|
- ``increment`` Line number increments
|
||||||
- ``distance`` Distance between text and line numbering in twip
|
- ``distance`` Distance between text and line numbering in *twip*
|
||||||
- ``restart`` Line numbering restart setting
|
- ``restart`` Line numbering restart setting
|
||||||
continuous\|newPage\|newSection
|
continuous\|newPage\|newSection
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements.
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
| 11 | Watermark | - | v | - | - | - | - |
|
| 11 | Watermark | - | v | - | - | - | - |
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
| 12 | Object | v | v | v | v | v | v |
|
| 12 | OLEObject | v | v | v | v | v | v |
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
| 13 | TOC | v | - | - | - | - | - |
|
| 13 | TOC | v | - | - | - | - | - |
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
|
|
@ -77,11 +77,19 @@ italics, etc) or other elements, e.g. images or links. The syntaxes are as follo
|
||||||
|
|
||||||
For available styling options see :ref:`font-style` and :ref:`paragraph-style`.
|
For available styling options see :ref:`font-style` and :ref:`paragraph-style`.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
$text = $section->addText('Hello World!');
|
||||||
|
$text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime()));
|
||||||
|
|
||||||
Titles
|
Titles
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
If you want to structure your document or build table of contents, you need titles or headings.
|
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.
|
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
|
.. code-block:: php
|
||||||
|
|
||||||
|
|
@ -91,7 +99,7 @@ To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` metho
|
||||||
- ``depth``.
|
- ``depth``.
|
||||||
- ``$fontStyle``. See :ref:`font-style`.
|
- ``$fontStyle``. See :ref:`font-style`.
|
||||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||||
- ``$text``. Text to be displayed in the document.
|
- ``$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.
|
It's necessary to add a title style to your document because otherwise the title won't be detected as a real title.
|
||||||
|
|
||||||
|
|
@ -234,7 +242,7 @@ To add an image, use the ``addImage`` method to sections, headers, footers, text
|
||||||
|
|
||||||
$section->addImage($src, [$style]);
|
$section->addImage($src, [$style]);
|
||||||
|
|
||||||
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string.
|
- ``$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`.
|
- ``$style``. See :ref:`image-style`.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
@ -276,11 +284,11 @@ Objects
|
||||||
-------
|
-------
|
||||||
|
|
||||||
You can add OLE embeddings, such as Excel spreadsheets or PowerPoint
|
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
|
.. code-block:: php
|
||||||
|
|
||||||
$section->addObject($src, [$style]);
|
$section->addOLEObject($src, [$style]);
|
||||||
|
|
||||||
Table of contents
|
Table of contents
|
||||||
-----------------
|
-----------------
|
||||||
|
|
@ -300,8 +308,8 @@ Your TOC can only be generated if you have add at least one title (See "Titles")
|
||||||
Options for ``$tocStyle``:
|
Options for ``$tocStyle``:
|
||||||
|
|
||||||
- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``.
|
- ``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 twips.
|
- ``tabPos``. The position of the tab where the page number appears in *twip*.
|
||||||
- ``indent``. The indent factor of the titles in twips.
|
- ``indent``. The indent factor of the titles in *twip*.
|
||||||
|
|
||||||
Footnotes & endnotes
|
Footnotes & endnotes
|
||||||
--------------------
|
--------------------
|
||||||
|
|
@ -309,7 +317,7 @@ Footnotes & endnotes
|
||||||
You can create footnotes with ``addFootnote`` and endnotes with
|
You can create footnotes with ``addFootnote`` and endnotes with
|
||||||
``addEndnote`` in texts or textruns, but it's recommended to use textrun
|
``addEndnote`` in texts or textruns, but it's recommended to use textrun
|
||||||
to have better layout. You can use ``addText``, ``addLink``,
|
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:
|
On textrun:
|
||||||
|
|
||||||
|
|
@ -422,13 +430,13 @@ Line elements can be added to sections by using ``addLine``.
|
||||||
|
|
||||||
Available line style attributes:
|
Available line style attributes:
|
||||||
|
|
||||||
- ``weight``. Line width in twips.
|
- ``weight``. Line width in *twip*.
|
||||||
- ``color``. Defines the color of stroke.
|
- ``color``. Defines the color of stroke.
|
||||||
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
|
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
|
||||||
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
|
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
|
||||||
- ``endArrow``. End type of arrow: block, open, classic, diamond, oval.
|
- ``endArrow``. End type of arrow: block, open, classic, diamond, oval.
|
||||||
- ``width``. Line-object width in pt.
|
- ``width``. Line-object width in *pt*.
|
||||||
- ``height``. Line-object height in pt.
|
- ``height``. Line-object height in *pt*.
|
||||||
- ``flip``. Flip the line element: true, false.
|
- ``flip``. Flip the line element: true, false.
|
||||||
|
|
||||||
Chart
|
Chart
|
||||||
|
|
@ -440,7 +448,9 @@ Charts can be added using
|
||||||
|
|
||||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||||
$series = array(1, 3, 2, 5, 4);
|
$series = array(1, 3, 2, 5, 4);
|
||||||
$chart = $section->addChart('line', $categories, $series);
|
$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.
|
check out the Sample_32_Chart.php for more options and styling.
|
||||||
|
|
||||||
|
|
@ -466,3 +476,28 @@ The comment can contain formatted text. Once the comment has been added, it can
|
||||||
$text->setCommentStart($comment);
|
$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.
|
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)));
|
||||||
|
|
|
||||||
|
|
@ -217,10 +217,10 @@ The default language of the document can be change with the following.
|
||||||
|
|
||||||
$phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE));
|
$phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE));
|
||||||
|
|
||||||
``Languge`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages.
|
``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\ComplexType\Language`` class but any valid code/ID can be used.
|
A couple of language codes are provided in the ``PhpOffice\PhpWord\ComplexType\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.
|
In case you are generating an RTF document the language need to be set differently.
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
|
|
@ -255,7 +255,7 @@ The base length unit in Open Office XML is twip. Twip means "TWentieth
|
||||||
of an Inch Point", i.e. 1 twip = 1/1440 inch.
|
of an Inch Point", i.e. 1 twip = 1/1440 inch.
|
||||||
|
|
||||||
You can use PHPWord helper functions to convert inches, centimeters, or
|
You can use PHPWord helper functions to convert inches, centimeters, or
|
||||||
points to twips.
|
points to twip.
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
|
|
@ -290,3 +290,45 @@ To force an update of the fields present in the document, set updateFields to tr
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
$phpWord->getSettings()->setUpdateFields(true);
|
$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);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,5 @@ Example:
|
||||||
Using samples
|
Using samples
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
After installation, you can browse and use the samples that we've
|
More examples are provided in the ``samples`` directory.
|
||||||
provided, either by command line or using browser. If you can access
|
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.
|
||||||
your PHPWord library folder using browser, point your browser to the
|
|
||||||
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.
|
|
||||||
|
|
|
||||||
|
|
@ -11,26 +11,26 @@ Section
|
||||||
Available Section style options:
|
Available Section style options:
|
||||||
|
|
||||||
- ``borderBottomColor``. Border bottom color.
|
- ``borderBottomColor``. Border bottom color.
|
||||||
- ``borderBottomSize``. Border bottom size (in twips).
|
- ``borderBottomSize``. Border bottom size in *twip*.
|
||||||
- ``borderLeftColor``. Border left color.
|
- ``borderLeftColor``. Border left color.
|
||||||
- ``borderLeftSize``. Border left size (in twips).
|
- ``borderLeftSize``. Border left size in *twip*.
|
||||||
- ``borderRightColor``. Border right color.
|
- ``borderRightColor``. Border right color.
|
||||||
- ``borderRightSize``. Border right size (in twips).
|
- ``borderRightSize``. Border right size in *twip*.
|
||||||
- ``borderTopColor``. Border top color.
|
- ``borderTopColor``. Border top color.
|
||||||
- ``borderTopSize``. Border top size (in twips).
|
- ``borderTopSize``. Border top size in *twip*.
|
||||||
- ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage).
|
- ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage).
|
||||||
- ``colsNum``. Number of columns.
|
- ``colsNum``. Number of columns.
|
||||||
- ``colsSpace``. Spacing between columns.
|
- ``colsSpace``. Spacing between columns.
|
||||||
- ``footerHeight``. Spacing to bottom of footer.
|
- ``footerHeight``. Spacing to bottom of footer.
|
||||||
- ``gutter``. Page gutter spacing.
|
- ``gutter``. Page gutter spacing.
|
||||||
- ``headerHeight``. Spacing to top of header.
|
- ``headerHeight``. Spacing to top of header.
|
||||||
- ``marginTop``. Page margin top (in twips).
|
- ``marginTop``. Page margin top in *twip*.
|
||||||
- ``marginLeft``. Page margin left (in twips).
|
- ``marginLeft``. Page margin left in *twip*.
|
||||||
- ``marginRight``. Page margin right (in twips).
|
- ``marginRight``. Page margin right in *twip*.
|
||||||
- ``marginBottom``. Page margin bottom (in twips).
|
- ``marginBottom``. Page margin bottom in *twip*.
|
||||||
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
|
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
|
||||||
- ``pageSizeH``. Page height (in twips). Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
||||||
- ``pageSizeW``. Page width (in twips). Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
||||||
|
|
||||||
.. _font-style:
|
.. _font-style:
|
||||||
|
|
||||||
|
|
@ -59,6 +59,7 @@ Available Font style options:
|
||||||
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values
|
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more 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
|
- ``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.
|
See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes.
|
||||||
|
- ``position``. The text position, raised or lowered, in half points
|
||||||
|
|
||||||
.. _paragraph-style:
|
.. _paragraph-style:
|
||||||
|
|
||||||
|
|
@ -70,17 +71,18 @@ Available Paragraph style options:
|
||||||
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
|
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
|
||||||
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
||||||
- ``basedOn``. Parent style.
|
- ``basedOn``. Parent style.
|
||||||
- ``hanging``. Hanging by how much.
|
- ``hanging``. Hanging in *twip*.
|
||||||
- ``indent``. Indent by how much.
|
- ``indent``. Indent in *twip*.
|
||||||
- ``keepLines``. Keep all lines on one page, *true* or *false*.
|
- ``keepLines``. Keep all lines on one page, *true* or *false*.
|
||||||
- ``keepNext``. Keep paragraph with next paragraph, *true* or *false*.
|
- ``keepNext``. Keep paragraph with next paragraph, *true* or *false*.
|
||||||
- ``lineHeight``. Text line height, e.g. *1.0*, *1.5*, etc.
|
- ``lineHeight``. Text line height, e.g. *1.0*, *1.5*, etc.
|
||||||
- ``next``. Style for next paragraph.
|
- ``next``. Style for next paragraph.
|
||||||
- ``pageBreakBefore``. Start paragraph on next page, *true* or *false*.
|
- ``pageBreakBefore``. Start paragraph on next page, *true* or *false*.
|
||||||
- ``spaceBefore``. Space before paragraph.
|
- ``spaceBefore``. Space before paragraph in *twip*.
|
||||||
- ``spaceAfter``. Space after paragraph.
|
- ``spaceAfter``. Space after paragraph in *twip*.
|
||||||
- ``spacing``. Space between lines.
|
- ``spacing``. Space between lines.
|
||||||
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
|
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
|
||||||
|
- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*.
|
||||||
- ``tabs``. Set of custom tab stops.
|
- ``tabs``. Set of custom tab stops.
|
||||||
- ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*.
|
- ``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*.
|
- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*.
|
||||||
|
|
@ -100,9 +102,27 @@ Available Table style options:
|
||||||
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details.
|
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details.
|
||||||
- ``bgColor``. Background color, e.g. '9966CC'.
|
- ``bgColor``. Background color, e.g. '9966CC'.
|
||||||
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
||||||
- ``border(Top|Right|Bottom|Left)Size``. Border size in twips.
|
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
|
||||||
- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in twips.
|
- ``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 percent.
|
- ``width``. Table width in percent.
|
||||||
|
- ``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
|
||||||
|
|
||||||
|
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:
|
Available Row style options:
|
||||||
|
|
||||||
|
|
@ -114,13 +134,13 @@ Available Cell style options:
|
||||||
|
|
||||||
- ``bgColor``. Background color, e.g. '9966CC'.
|
- ``bgColor``. Background color, e.g. '9966CC'.
|
||||||
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
||||||
- ``border(Top|Right|Bottom|Left)Size``. Border size in twips.
|
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
|
||||||
- ``gridSpan``. Number of columns spanned.
|
- ``gridSpan``. Number of columns spanned.
|
||||||
- ``textDirection(btLr|tbRl)``. Direction of text.
|
- ``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``
|
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*.
|
- ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*.
|
||||||
- ``vMerge``. *restart* or *continue*.
|
- ``vMerge``. *restart* or *continue*.
|
||||||
- ``width``. Cell width in twips.
|
- ``width``. Cell width in *twip*.
|
||||||
|
|
||||||
.. _image-style:
|
.. _image-style:
|
||||||
|
|
||||||
|
|
@ -130,11 +150,15 @@ Image
|
||||||
Available Image style options:
|
Available Image style options:
|
||||||
|
|
||||||
- ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
- ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
||||||
- ``height``. Height in pixels.
|
- ``height``. Height in *pt*.
|
||||||
- ``marginLeft``. Left margin in inches, can be negative.
|
- ``marginLeft``. Left margin in inches, can be negative.
|
||||||
- ``marginTop``. Top margin in inches, can be negative.
|
- ``marginTop``. Top margin in inches, can be negative.
|
||||||
- ``width``. Width in pixels.
|
- ``width``. Width in *pt*.
|
||||||
- ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*.
|
- ``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-style:
|
||||||
|
|
||||||
|
|
@ -155,3 +179,17 @@ Available NumberingLevel style options:
|
||||||
- ``suffix``. Content between numbering symbol and paragraph text tab\|space\|nothing.
|
- ``suffix``. Content between numbering symbol and paragraph text tab\|space\|nothing.
|
||||||
- ``tabPos``. See paragraph style.
|
- ``tabPos``. See paragraph style.
|
||||||
- ``text``. Numbering level text e.g. %1 for nonbullet or bullet character.
|
- ``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*.
|
||||||
|
- ``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*.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
includes:
|
includes:
|
||||||
- vendor/phpstan/phpstan/conf/config.level1.neon
|
- vendor/phpstan/phpstan/conf/config.level1.neon
|
||||||
parameters:
|
parameters:
|
||||||
memory-limit: 200000
|
memory-limit: 20000000
|
||||||
autoload_directories:
|
autoload_directories:
|
||||||
- tests
|
- tests
|
||||||
autoload_files:
|
autoload_files:
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@
|
||||||
convertNoticesToExceptions="true"
|
convertNoticesToExceptions="true"
|
||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false">
|
||||||
syntaxCheck="false">
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="PhpWord Test Suite">
|
<testsuite name="PhpWord Test Suite">
|
||||||
<directory>./tests/PhpWord</directory>
|
<directory>./tests/PhpWord</directory>
|
||||||
|
|
@ -22,7 +21,7 @@
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<logging>
|
<logging>
|
||||||
<log type="coverage-html" target="./build/coverage" charset="UTF-8" highlight="true" />
|
<log type="coverage-html" target="./build/coverage" />
|
||||||
<log type="coverage-clover" target="./build/logs/clover.xml" />
|
<log type="coverage-clover" target="./build/logs/clover.xml" />
|
||||||
</logging>
|
</logging>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
use PhpOffice\PhpWord\Style\Font;
|
use PhpOffice\PhpWord\Style\Font;
|
||||||
use PhpOffice\PhpWord\Style\Paragraph;
|
|
||||||
|
|
||||||
include_once 'Sample_Header.php';
|
include_once 'Sample_Header.php';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ $templateProcessor->setValue('userPhone#3', '+1 428 889 775');
|
||||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||||
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
|
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
|
||||||
|
|
||||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_07_TemplateCloneRow.docx');
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
include_once 'Sample_Footer.php';
|
include_once 'Sample_Footer.php';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
use PhpOffice\PhpWord\Shared\Converter;
|
||||||
|
use PhpOffice\PhpWord\Style\TablePosition;
|
||||||
|
|
||||||
include_once 'Sample_Header.php';
|
include_once 'Sample_Header.php';
|
||||||
|
|
||||||
// New Word Document
|
// New Word Document
|
||||||
|
|
@ -27,7 +30,7 @@ $section->addTextBreak(1);
|
||||||
$section->addText('Fancy table', $header);
|
$section->addText('Fancy table', $header);
|
||||||
|
|
||||||
$fancyTableStyleName = 'Fancy Table';
|
$fancyTableStyleName = 'Fancy Table';
|
||||||
$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER);
|
$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50);
|
||||||
$fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
|
$fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
|
||||||
$fancyTableCellStyle = array('valign' => 'center');
|
$fancyTableCellStyle = array('valign' => 'center');
|
||||||
$fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
|
$fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
|
||||||
|
|
@ -113,20 +116,20 @@ $phpWord->addTableStyle('Colspan Rowspan', $styleTable);
|
||||||
$table = $section->addTable('Colspan Rowspan');
|
$table = $section->addTable('Colspan Rowspan');
|
||||||
|
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
|
$row->addCell(1000, array('vMerge' => 'restart'))->addText('A');
|
||||||
$row->addCell(null, array('vMerge' => 'restart'))->addText('A');
|
$row->addCell(1000, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B');
|
||||||
$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B');
|
$row->addCell(1000)->addText('1');
|
||||||
$row->addCell()->addText('1');
|
|
||||||
|
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
$row->addCell(null, array('vMerge' => 'continue'));
|
$row->addCell(1000, array('vMerge' => 'continue'));
|
||||||
$row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2));
|
$row->addCell(1000, array('vMerge' => 'continue', 'gridSpan' => 2));
|
||||||
$row->addCell()->addText('2');
|
$row->addCell(1000)->addText('2');
|
||||||
|
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
$row->addCell(null, array('vMerge' => 'continue'));
|
$row->addCell(1000, array('vMerge' => 'continue'));
|
||||||
$row->addCell()->addText('C');
|
$row->addCell(1000)->addText('C');
|
||||||
$row->addCell()->addText('D');
|
$row->addCell(1000)->addText('D');
|
||||||
$row->addCell()->addText('3');
|
$row->addCell(1000)->addText('3');
|
||||||
|
|
||||||
// 5. Nested table
|
// 5. Nested table
|
||||||
|
|
||||||
|
|
@ -139,6 +142,15 @@ $cell->addText('This cell contains nested table.');
|
||||||
$innerCell = $cell->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER))->addRow()->addCell();
|
$innerCell = $cell->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER))->addRow()->addCell();
|
||||||
$innerCell->addText('Inside nested table');
|
$innerCell->addText('Inside nested table');
|
||||||
|
|
||||||
|
// 6. Table with floating position
|
||||||
|
|
||||||
|
$section->addTextBreak(2);
|
||||||
|
$section->addText('Table with floating positioning.', $header);
|
||||||
|
|
||||||
|
$table = $section->addTable(array('borderSize' => 6, 'borderColor' => '999999', 'position' => array('vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1))));
|
||||||
|
$cell = $table->addRow()->addCell();
|
||||||
|
$cell->addText('This is a single cell.');
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
use PhpOffice\PhpWord\Element\Section;
|
||||||
|
use PhpOffice\PhpWord\Shared\Converter;
|
||||||
|
|
||||||
include_once 'Sample_Header.php';
|
include_once 'Sample_Header.php';
|
||||||
|
|
||||||
// New Word document
|
// New Word document
|
||||||
|
|
@ -9,45 +12,48 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||||
$section = $phpWord->addSection();
|
$section = $phpWord->addSection();
|
||||||
$section->addText('Local image without any styles:');
|
$section->addText('Local image without any styles:');
|
||||||
$section->addImage('resources/_mars.jpg');
|
$section->addImage('resources/_mars.jpg');
|
||||||
$section->addTextBreak(2);
|
|
||||||
|
|
||||||
|
printSeparator($section);
|
||||||
$section->addText('Local image with styles:');
|
$section->addText('Local image with styles:');
|
||||||
$section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER));
|
$section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER));
|
||||||
$section->addTextBreak(2);
|
|
||||||
|
|
||||||
// Remote image
|
// Remote image
|
||||||
|
printSeparator($section);
|
||||||
$source = 'http://php.net/images/logos/php-med-trans-light.gif';
|
$source = 'http://php.net/images/logos/php-med-trans-light.gif';
|
||||||
$section->addText("Remote image from: {$source}");
|
$section->addText("Remote image from: {$source}");
|
||||||
$section->addImage($source);
|
$section->addImage($source);
|
||||||
|
|
||||||
// Image from string
|
// Image from string
|
||||||
|
printSeparator($section);
|
||||||
$source = 'resources/_mars.jpg';
|
$source = 'resources/_mars.jpg';
|
||||||
$fileContent = file_get_contents($source);
|
$fileContent = file_get_contents($source);
|
||||||
$section->addText('Image from string');
|
$section->addText('Image from string');
|
||||||
$section->addImage($fileContent);
|
$section->addImage($fileContent);
|
||||||
|
|
||||||
//Wrapping style
|
//Wrapping style
|
||||||
$text = str_repeat('Hello World! ', 15);
|
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 = array('inline', 'behind', 'infront', 'square', 'tight');
|
$wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight');
|
||||||
foreach ($wrappingStyles as $wrappingStyle) {
|
foreach ($wrappingStyles as $wrappingStyle) {
|
||||||
$section->addTextBreak(5);
|
|
||||||
$section->addText("Wrapping style {$wrappingStyle}");
|
$section->addText("Wrapping style {$wrappingStyle}");
|
||||||
$section->addImage(
|
$section->addImage(
|
||||||
'resources/_earth.jpg',
|
'resources/_earth.jpg',
|
||||||
array(
|
array(
|
||||||
'positioning' => 'relative',
|
'positioning' => 'relative',
|
||||||
'marginTop' => -1,
|
'marginTop' => -1,
|
||||||
'marginLeft' => 1,
|
'marginLeft' => 1,
|
||||||
'width' => 80,
|
'width' => 80,
|
||||||
'height' => 80,
|
'height' => 80,
|
||||||
'wrappingStyle' => $wrappingStyle,
|
'wrappingStyle' => $wrappingStyle,
|
||||||
|
'wrapDistanceRight' => Converter::cmToPoint(1),
|
||||||
|
'wrapDistanceBottom' => Converter::cmToPoint(1),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$section->addText($text);
|
$section->addText($text);
|
||||||
|
printSeparator($section);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Absolute positioning
|
//Absolute positioning
|
||||||
$section->addTextBreak(3);
|
|
||||||
$section->addText('Absolute positioning: see top right corner of page');
|
$section->addText('Absolute positioning: see top right corner of page');
|
||||||
$section->addImage(
|
$section->addImage(
|
||||||
'resources/_mars.jpg',
|
'resources/_mars.jpg',
|
||||||
|
|
@ -64,7 +70,7 @@ $section->addImage(
|
||||||
);
|
);
|
||||||
|
|
||||||
//Relative positioning
|
//Relative positioning
|
||||||
$section->addTextBreak(3);
|
printSeparator($section);
|
||||||
$section->addText('Relative positioning: Horizontal position center relative to column,');
|
$section->addText('Relative positioning: Horizontal position center relative to column,');
|
||||||
$section->addText('Vertical position top relative to line');
|
$section->addText('Vertical position top relative to line');
|
||||||
$section->addImage(
|
$section->addImage(
|
||||||
|
|
@ -80,6 +86,14 @@ $section->addImage(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function printSeparator(Section $section)
|
||||||
|
{
|
||||||
|
$section->addTextBreak();
|
||||||
|
$lineStyle = array('weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center');
|
||||||
|
$section->addLine($lineStyle);
|
||||||
|
$section->addTextBreak(2);
|
||||||
|
}
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ $listItemRun->addText(' in bold', array('bold' => true));
|
||||||
$listItemRun = $section->addListItemRun();
|
$listItemRun = $section->addListItemRun();
|
||||||
$listItemRun->addText('List item 2');
|
$listItemRun->addText('List item 2');
|
||||||
$listItemRun->addText(' in italic', array('italic' => true));
|
$listItemRun->addText(' in italic', array('italic' => true));
|
||||||
|
$footnote = $listItemRun->addFootnote();
|
||||||
|
$footnote->addText('this is a footnote on a list item');
|
||||||
$listItemRun = $section->addListItemRun();
|
$listItemRun = $section->addListItemRun();
|
||||||
$listItemRun->addText('List item 3');
|
$listItemRun->addText('List item 3');
|
||||||
$listItemRun->addText(' underlined', array('underline' => 'dash'));
|
$listItemRun->addText(' underlined', array('underline' => 'dash'));
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||||
$section = $phpWord->addSection();
|
$section = $phpWord->addSection();
|
||||||
$section->addText('You can open this OLE object by double clicking on the icon:');
|
$section->addText('You can open this OLE object by double clicking on the icon:');
|
||||||
$section->addTextBreak(2);
|
$section->addTextBreak(2);
|
||||||
$section->addObject('resources/_sheet.xls');
|
$section->addOLEObject('resources/_sheet.xls');
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,14 @@ $section = $phpWord->addSection();
|
||||||
// Define styles
|
// Define styles
|
||||||
$fontStyle12 = array('spaceAfter' => 60, 'size' => 12);
|
$fontStyle12 = array('spaceAfter' => 60, 'size' => 12);
|
||||||
$fontStyle10 = array('size' => 10);
|
$fontStyle10 = array('size' => 10);
|
||||||
|
$phpWord->addTitleStyle(null, array('size' => 22, 'bold' => true));
|
||||||
$phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true));
|
$phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true));
|
||||||
$phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666'));
|
$phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666'));
|
||||||
$phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true));
|
$phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true));
|
||||||
$phpWord->addTitleStyle(4, array('size' => 12));
|
$phpWord->addTitleStyle(4, array('size' => 12));
|
||||||
|
|
||||||
// Add text elements
|
// Add text elements
|
||||||
$section->addText('Table of contents 1');
|
$section->addTitle('Table of contents 1', 0);
|
||||||
$section->addTextBreak(2);
|
$section->addTextBreak(2);
|
||||||
|
|
||||||
// Add TOC #1
|
// Add TOC #1
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ $templateProcessor->deleteBlock('DELETEME');
|
||||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||||
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
||||||
|
|
||||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_23_TemplateBlock.docx');
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
include_once 'Sample_Footer.php';
|
include_once 'Sample_Footer.php';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,25 @@ include_once 'Sample_Header.php';
|
||||||
// New Word Document
|
// 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 = new \PhpOffice\PhpWord\PhpWord();
|
||||||
|
$phpWord->addParagraphStyle('Heading2', array('alignment' => 'center'));
|
||||||
|
|
||||||
$section = $phpWord->addSection();
|
$section = $phpWord->addSection();
|
||||||
$html = '<h1>Adding element via HTML</h1>';
|
$html = '<h1>Adding element via HTML</h1>';
|
||||||
$html .= '<p>Some well formed HTML snippet needs to be used</p>';
|
$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>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/">Read the docs</a></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 .= '<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 .= '<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 .= '<p style="margin-top: 240pt;">Ordered (numbered) list:</p>';
|
||||||
$html .= '<ol>
|
$html .= '<ol>
|
||||||
<li><p style="font-weight: bold;">List 1 item 1</p></li>
|
<li><p style="font-weight: bold;">List 1 item 1</p></li>
|
||||||
|
|
@ -29,10 +37,12 @@ $html .= '<ol>
|
||||||
<ol>
|
<ol>
|
||||||
<li>List 2 item 1</li>
|
<li>List 2 item 1</li>
|
||||||
<li>List 2 item 2</li>
|
<li>List 2 item 2</li>
|
||||||
<ol>
|
<li>
|
||||||
<li>sub list 1</li>
|
<ol>
|
||||||
<li>sub list 2</li>
|
<li>sub list 1</li>
|
||||||
</ol>
|
<li>sub list 2</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
<li>List 2 item 3</li>
|
<li>List 2 item 3</li>
|
||||||
<ol>
|
<ol>
|
||||||
<li>sub list 1, restarts with a</li>
|
<li>sub list 1, restarts with a</li>
|
||||||
|
|
@ -65,10 +75,20 @@ $html .= '<table align="center" style="width: 50%; border: 6px #0000FF double;">
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td style="border-style: dotted;">1</td><td colspan="2">2</td></tr>
|
<tr><td style="border-style: dotted;">1</td><td colspan="2">2</td></tr>
|
||||||
<tr><td>4</td><td>5</td><td>6</td></tr>
|
<tr><td>This is <b>bold</b> text</td><td></td><td>6</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>';
|
</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>';
|
||||||
|
|
||||||
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
|
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,26 @@ include_once 'Sample_Header.php';
|
||||||
// New Word document
|
// 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 = new \PhpOffice\PhpWord\PhpWord();
|
||||||
|
PhpOffice\PhpWord\Style::addTitleStyle(1, array('size' => 14));
|
||||||
|
|
||||||
// New section
|
// New section
|
||||||
$section = $phpWord->addSection();
|
$section = $phpWord->addSection();
|
||||||
|
$section->addTitle('This page demos fields');
|
||||||
|
|
||||||
// Add Field elements
|
// Add Field elements
|
||||||
// See Element/Field.php for all options
|
// See Element/Field.php for all options
|
||||||
$section->addText('Date field:');
|
$section->addText('Date field:');
|
||||||
$section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat'));
|
$section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat'));
|
||||||
|
|
||||||
|
$section->addText('Style Ref field:');
|
||||||
|
$section->addField('STYLEREF', array('StyleIdentifier' => 'Heading 1'));
|
||||||
|
|
||||||
$section->addText('Page field:');
|
$section->addText('Page field:');
|
||||||
$section->addField('PAGE', array('format' => 'Arabic'));
|
$section->addField('PAGE', array('format' => 'Arabic'));
|
||||||
|
|
||||||
$section->addText('Number of pages field:');
|
$section->addText('Number of pages field:');
|
||||||
$section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat'));
|
$section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat'));
|
||||||
|
$section->addTextBreak();
|
||||||
|
|
||||||
$textrun = $section->addTextRun();
|
$textrun = $section->addTextRun();
|
||||||
$textrun->addText('An index field is ');
|
$textrun->addText('An index field is ');
|
||||||
|
|
@ -43,6 +49,19 @@ $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleTy
|
||||||
$textrun->addText('This is the date of lunar calendar ');
|
$textrun->addText('This is the date of lunar calendar ');
|
||||||
$textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar'));
|
$textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar'));
|
||||||
$textrun->addText(' written in a textrun.');
|
$textrun->addText(' written in a textrun.');
|
||||||
|
$section->addTextBreak();
|
||||||
|
|
||||||
|
$macroText = new TextRun();
|
||||||
|
$macroText->addText('Double click', array('bold' => true));
|
||||||
|
$macroText->addText(' to ');
|
||||||
|
$macroText->addText('zoom to 100%', array('italic' => true));
|
||||||
|
|
||||||
|
$section->addText('A macro button with styled text:');
|
||||||
|
$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), $macroText);
|
||||||
|
$section->addTextBreak();
|
||||||
|
|
||||||
|
$section->addText('A macro button with simple text:');
|
||||||
|
$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), 'double click to zoom');
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,23 @@ $section = $phpWord->addSection();
|
||||||
$section->addTitle('2D charts', 1);
|
$section->addTitle('2D charts', 1);
|
||||||
$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous'));
|
$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous'));
|
||||||
|
|
||||||
$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar');
|
$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column');
|
||||||
$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar');
|
$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column');
|
||||||
$threeSeries = array('bar', 'line');
|
$threeSeries = array('bar', 'line');
|
||||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||||
$series1 = array(1, 3, 2, 5, 4);
|
$series1 = array(1, 3, 2, 5, 4);
|
||||||
$series2 = array(3, 1, 7, 2, 6);
|
$series2 = array(3, 1, 7, 2, 6);
|
||||||
$series3 = array(8, 3, 2, 5, 4);
|
$series3 = array(8, 3, 2, 5, 4);
|
||||||
|
$showGridLines = false;
|
||||||
|
$showAxisLabels = false;
|
||||||
|
|
||||||
foreach ($chartTypes as $chartType) {
|
foreach ($chartTypes as $chartType) {
|
||||||
$section->addTitle(ucfirst($chartType), 2);
|
$section->addTitle(ucfirst($chartType), 2);
|
||||||
$chart = $section->addChart($chartType, $categories, $series1);
|
$chart = $section->addChart($chartType, $categories, $series1);
|
||||||
$chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2));
|
$chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2));
|
||||||
|
$chart->getStyle()->setShowGridX($showGridLines);
|
||||||
|
$chart->getStyle()->setShowGridY($showGridLines);
|
||||||
|
$chart->getStyle()->setShowAxisLabels($showAxisLabels);
|
||||||
if (in_array($chartType, $twoSeries)) {
|
if (in_array($chartType, $twoSeries)) {
|
||||||
$chart->addSeries($categories, $series2);
|
$chart->addSeries($categories, $series2);
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +49,14 @@ $section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous
|
||||||
|
|
||||||
$chartTypes = array('pie', 'bar', 'column', 'line', 'area');
|
$chartTypes = array('pie', 'bar', 'column', 'line', 'area');
|
||||||
$multiSeries = array('bar', 'column', 'line', 'area');
|
$multiSeries = array('bar', 'column', 'line', 'area');
|
||||||
$style = array('width' => Converter::cmToEmu(5), 'height' => Converter::cmToEmu(4), '3d' => true);
|
$style = array(
|
||||||
|
'width' => Converter::cmToEmu(5),
|
||||||
|
'height' => Converter::cmToEmu(4),
|
||||||
|
'3d' => true,
|
||||||
|
'showAxisLabels' => $showAxisLabels,
|
||||||
|
'showGridX' => $showGridLines,
|
||||||
|
'showGridY' => $showGridLines,
|
||||||
|
);
|
||||||
foreach ($chartTypes as $chartType) {
|
foreach ($chartTypes as $chartType) {
|
||||||
$section->addTitle(ucfirst($chartType), 2);
|
$section->addTitle(ucfirst($chartType), 2);
|
||||||
$chart = $section->addChart($chartType, $categories, $series1, $style);
|
$chart = $section->addChart($chartType, $categories, $series1, $style);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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 ', 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)));
|
||||||
|
|
||||||
|
// Save file
|
||||||
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
|
if (!CLI) {
|
||||||
|
include_once 'Sample_Footer.php';
|
||||||
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ function write($phpWord, $filename, $writers)
|
||||||
$result .= EOL;
|
$result .= EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result .= getEndingNotes($writers);
|
$result .= getEndingNotes($writers, $filename);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
@ -92,10 +92,10 @@ function write($phpWord, $filename, $writers)
|
||||||
* Get ending notes
|
* Get ending notes
|
||||||
*
|
*
|
||||||
* @param array $writers
|
* @param array $writers
|
||||||
*
|
* @param mixed $filename
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getEndingNotes($writers)
|
function getEndingNotes($writers, $filename)
|
||||||
{
|
{
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -11,5 +11,15 @@
|
||||||
<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>
|
<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>
|
<p>Ordered (numbered) list:</p>
|
||||||
<ol><li>Item 1</li><li>Item 2</li></ol>
|
<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="https://localhost/gev/desarrollo/actividades/pruebas_14/5b064503587f7.jpeg" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
|
||||||
|
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b064503589db.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
|
||||||
|
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b0645035aac8.jpeg" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -27,14 +27,14 @@ abstract class AbstractCollection
|
||||||
/**
|
/**
|
||||||
* Items
|
* Items
|
||||||
*
|
*
|
||||||
* @var array
|
* @var \PhpOffice\PhpWord\Element\AbstractContainer[]
|
||||||
*/
|
*/
|
||||||
private $items = array();
|
private $items = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get items
|
* Get items
|
||||||
*
|
*
|
||||||
* @return array
|
* @return \PhpOffice\PhpWord\Element\AbstractContainer[]
|
||||||
*/
|
*/
|
||||||
public function getItems()
|
public function getItems()
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +45,7 @@ abstract class AbstractCollection
|
||||||
* Get item by index
|
* Get item by index
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int $index
|
||||||
* @return mixed
|
* @return \PhpOffice\PhpWord\Element\AbstractContainer
|
||||||
*/
|
*/
|
||||||
public function getItem($index)
|
public function getItem($index)
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +60,7 @@ abstract class AbstractCollection
|
||||||
* Set item.
|
* Set item.
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int $index
|
||||||
* @param mixed $item
|
* @param \PhpOffice\PhpWord\Element\AbstractContainer $item
|
||||||
*/
|
*/
|
||||||
public function setItem($index, $item)
|
public function setItem($index, $item)
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +72,7 @@ abstract class AbstractCollection
|
||||||
/**
|
/**
|
||||||
* Add new item
|
* Add new item
|
||||||
*
|
*
|
||||||
* @param mixed $item
|
* @param \PhpOffice\PhpWord\Element\AbstractContainer $item
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function addItem($item)
|
public function addItem($item)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpWord\ComplexType;
|
||||||
|
|
||||||
|
use PhpOffice\PhpWord\SimpleType\TblWidth as TblWidthSimpleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see http://www.datypic.com/sc/ooxml/t-w_CT_TblWidth.html
|
||||||
|
*/
|
||||||
|
final class TblWidth
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $type;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $value If omitted, then its value shall be assumed to be 0
|
||||||
|
* @param string $type If omitted, then its value shall be assumed to be dxa
|
||||||
|
*/
|
||||||
|
public function __construct($value = 0, $type = TblWidthSimpleType::TWIP)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
TblWidthSimpleType::validate($type);
|
||||||
|
$this->type = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace PhpOffice\PhpWord\Element;
|
||||||
* @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9)
|
* @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9)
|
||||||
* @method PageBreak addPageBreak()
|
* @method PageBreak addPageBreak()
|
||||||
* @method Table addTable(mixed $style = null)
|
* @method Table addTable(mixed $style = null)
|
||||||
* @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false)
|
* @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false, $name = null)
|
||||||
* @method OLEObject addOLEObject(string $source, mixed $style = null)
|
* @method OLEObject addOLEObject(string $source, mixed $style = null)
|
||||||
* @method TextBox addTextBox(mixed $style = null)
|
* @method TextBox addTextBox(mixed $style = null)
|
||||||
* @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null)
|
* @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null)
|
||||||
|
|
@ -54,7 +54,7 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Elements collection
|
* Elements collection
|
||||||
*
|
*
|
||||||
* @var array
|
* @var \PhpOffice\PhpWord\Element\AbstractElement[]
|
||||||
*/
|
*/
|
||||||
protected $elements = array();
|
protected $elements = array();
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
{
|
{
|
||||||
$elements = array(
|
$elements = array(
|
||||||
'Text', 'TextRun', 'Bookmark', 'Link', 'PreserveText', 'TextBreak',
|
'Text', 'TextRun', 'Bookmark', 'Link', 'PreserveText', 'TextBreak',
|
||||||
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object',
|
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object', 'OLEObject',
|
||||||
'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field',
|
'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field',
|
||||||
'Line', 'Shape', 'Title', 'TOC', 'PageBreak',
|
'Line', 'Shape', 'Title', 'TOC', 'PageBreak',
|
||||||
'Chart', 'FormField', 'SDT', 'Comment',
|
'Chart', 'FormField', 'SDT', 'Comment',
|
||||||
|
|
@ -157,13 +157,48 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get all elements
|
* Get all elements
|
||||||
*
|
*
|
||||||
* @return array
|
* @return \PhpOffice\PhpWord\Element\AbstractElement[]
|
||||||
*/
|
*/
|
||||||
public function getElements()
|
public function getElements()
|
||||||
{
|
{
|
||||||
return $this->elements;
|
return $this->elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the element at the requested position
|
||||||
|
*
|
||||||
|
* @param int $index
|
||||||
|
* @return \PhpOffice\PhpWord\Element\AbstractElement|null
|
||||||
|
*/
|
||||||
|
public function getElement($index)
|
||||||
|
{
|
||||||
|
if (array_key_exists($index, $this->elements)) {
|
||||||
|
return $this->elements[$index];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the element at requested index
|
||||||
|
*
|
||||||
|
* @param int|\PhpOffice\PhpWord\Element\AbstractElement $toRemove
|
||||||
|
*/
|
||||||
|
public function removeElement($toRemove)
|
||||||
|
{
|
||||||
|
if (is_int($toRemove) && array_key_exists($toRemove, $this->elements)) {
|
||||||
|
unset($this->elements[$toRemove]);
|
||||||
|
} elseif ($toRemove instanceof \PhpOffice\PhpWord\Element\AbstractElement) {
|
||||||
|
foreach ($this->elements as $key => $element) {
|
||||||
|
if ($element->getElementId() === $toRemove->getElementId()) {
|
||||||
|
unset($this->elements[$key]);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count elements
|
* Count elements
|
||||||
*
|
*
|
||||||
|
|
@ -207,7 +242,7 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'),
|
'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'),
|
||||||
'CheckBox' => array('Section', 'Header', 'Footer', 'Cell', 'TextRun'),
|
'CheckBox' => array('Section', 'Header', 'Footer', 'Cell', 'TextRun'),
|
||||||
'TextBox' => array('Section', 'Header', 'Footer', 'Cell'),
|
'TextBox' => array('Section', 'Header', 'Footer', 'Cell'),
|
||||||
'Footnote' => array('Section', 'TextRun', 'Cell'),
|
'Footnote' => array('Section', 'TextRun', 'Cell', 'ListItemRun'),
|
||||||
'Endnote' => array('Section', 'TextRun', 'Cell'),
|
'Endnote' => array('Section', 'TextRun', 'Cell'),
|
||||||
'PreserveText' => array('Section', 'Header', 'Footer', 'Cell'),
|
'PreserveText' => array('Section', 'Header', 'Footer', 'Cell'),
|
||||||
'Title' => array('Section', 'Cell'),
|
'Title' => array('Section', 'Cell'),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -93,6 +93,20 @@ abstract class AbstractElement
|
||||||
*/
|
*/
|
||||||
private $nestedLevel = 0;
|
private $nestedLevel = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reference to the parent
|
||||||
|
*
|
||||||
|
* @var \PhpOffice\PhpWord\Element\AbstractElement
|
||||||
|
*/
|
||||||
|
private $parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* changed element info
|
||||||
|
*
|
||||||
|
* @var TrackChange
|
||||||
|
*/
|
||||||
|
private $trackChange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent container type
|
* Parent container type
|
||||||
*
|
*
|
||||||
|
|
@ -321,6 +335,11 @@ abstract class AbstractElement
|
||||||
$this->commentRangeEnd->setEndElement($this);
|
$this->commentRangeEnd->setEndElement($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return $this->parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parent container
|
* Set parent container
|
||||||
*
|
*
|
||||||
|
|
@ -328,9 +347,10 @@ abstract class AbstractElement
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
||||||
*/
|
*/
|
||||||
public function setParentContainer(AbstractElement $container)
|
public function setParentContainer(self $container)
|
||||||
{
|
{
|
||||||
$this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1);
|
$this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1);
|
||||||
|
$this->parent = $container;
|
||||||
|
|
||||||
// Set nested level
|
// Set nested level
|
||||||
$this->nestedLevel = $container->getNestedLevel();
|
$this->nestedLevel = $container->getNestedLevel();
|
||||||
|
|
@ -425,6 +445,38 @@ abstract class AbstractElement
|
||||||
return $style;
|
return $style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the trackChange information
|
||||||
|
*
|
||||||
|
* @param TrackChange $trackChange
|
||||||
|
*/
|
||||||
|
public function setTrackChange(TrackChange $trackChange)
|
||||||
|
{
|
||||||
|
$this->trackChange = $trackChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the trackChange information
|
||||||
|
*
|
||||||
|
* @return TrackChange
|
||||||
|
*/
|
||||||
|
public function getTrackChange()
|
||||||
|
{
|
||||||
|
return $this->trackChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set changed
|
||||||
|
*
|
||||||
|
* @param string $type INSERTED|DELETED
|
||||||
|
* @param string $author
|
||||||
|
* @param null|int|\DateTime $date allways in UTC
|
||||||
|
*/
|
||||||
|
public function setChangeInfo($type, $author, $date = null)
|
||||||
|
{
|
||||||
|
$this->trackChange = new TrackChange($type, $author, $date);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set enum value
|
* Set enum value
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ class Bookmark extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function __construct($name)
|
public function __construct($name = '')
|
||||||
{
|
{
|
||||||
$this->name = CommonText::toUTF8($name);
|
$this->name = CommonText::toUTF8($name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -61,11 +61,12 @@ class Chart extends AbstractElement
|
||||||
* @param array $categories
|
* @param array $categories
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* @param array $style
|
* @param array $style
|
||||||
|
* @param null|mixed $seriesName
|
||||||
*/
|
*/
|
||||||
public function __construct($type, $categories, $values, $style = null)
|
public function __construct($type, $categories, $values, $style = null, $seriesName = null)
|
||||||
{
|
{
|
||||||
$this->setType($type);
|
$this->setType($type);
|
||||||
$this->addSeries($categories, $values);
|
$this->addSeries($categories, $values, $seriesName);
|
||||||
$this->style = $this->setNewStyle(new ChartStyle(), $style, true);
|
$this->style = $this->setNewStyle(new ChartStyle(), $style, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,7 +87,7 @@ class Chart extends AbstractElement
|
||||||
*/
|
*/
|
||||||
public function setType($value)
|
public function setType($value)
|
||||||
{
|
{
|
||||||
$enum = array('pie', 'doughnut', 'line', 'bar', 'column', 'area', 'radar', 'scatter');
|
$enum = array('pie', 'doughnut', 'line', 'bar', 'stacked_bar', 'percent_stacked_bar', 'column', 'stacked_column', 'percent_stacked_column', 'area', 'radar', 'scatter');
|
||||||
$this->type = $this->setEnumVal($value, $enum, 'pie');
|
$this->type = $this->setEnumVal($value, $enum, 'pie');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,10 +96,15 @@ class Chart extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param array $categories
|
* @param array $categories
|
||||||
* @param array $values
|
* @param array $values
|
||||||
|
* @param null|mixed $name
|
||||||
*/
|
*/
|
||||||
public function addSeries($categories, $values)
|
public function addSeries($categories, $values, $name = null)
|
||||||
{
|
{
|
||||||
$this->series[] = array('categories' => $categories, 'values' => $values);
|
$this->series[] = array(
|
||||||
|
'categories' => $categories,
|
||||||
|
'values' => $values,
|
||||||
|
'name' => $name,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -55,12 +55,12 @@ class Comment extends TrackChange
|
||||||
* Create a new Comment Element
|
* Create a new Comment Element
|
||||||
*
|
*
|
||||||
* @param string $author
|
* @param string $author
|
||||||
* @param \DateTime $date
|
* @param null|\DateTime $date
|
||||||
* @param string $initials
|
* @param string $initials
|
||||||
*/
|
*/
|
||||||
public function __construct($author, $date = null, $initials = null)
|
public function __construct($author, $date = null, $initials = null)
|
||||||
{
|
{
|
||||||
parent::__construct($author, $date);
|
parent::__construct(null, $author, $date);
|
||||||
$this->initials = $initials;
|
$this->initials = $initials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -48,12 +48,28 @@ class Field extends AbstractElement
|
||||||
),
|
),
|
||||||
'DATE' => array(
|
'DATE' => array(
|
||||||
'properties' => array(
|
'properties' => array(
|
||||||
'dateformat' => array('d-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd',
|
'dateformat' => array(
|
||||||
'd-MMM-yy', 'd/M/yyyy', 'd MMM. yy', 'd/M/yy', 'MMM-yy', 'd-M-yyy H:mm', 'd-M-yyyy H:mm:ss',
|
/* Generic formats */
|
||||||
'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', ),
|
'yyyy-MM-dd', 'yyyy-MM', 'MMM-yy', 'MMM-yyyy', 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss',
|
||||||
|
/* Day-Month-Year formats */
|
||||||
|
'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-MMM-yy', 'd MMM. yy',
|
||||||
|
'd-M-yy', 'd-M-yy h:mm', 'd-M-yy h:mm:ss', 'd-M-yy h:mm am/pm', 'd-M-yy h:mm:ss am/pm', 'd-M-yy HH:mm', 'd-M-yy HH:mm:ss',
|
||||||
|
'd/M/yy', 'd/M/yy h:mm', 'd/M/yy h:mm:ss', 'd/M/yy h:mm am/pm', 'd/M/yy h:mm:ss am/pm', 'd/M/yy HH:mm', 'd/M/yy HH:mm:ss',
|
||||||
|
'd-M-yyyy', 'd-M-yyyy h:mm', 'd-M-yyyy h:mm:ss', 'd-M-yyyy h:mm am/pm', 'd-M-yyyy h:mm:ss am/pm', 'd-M-yyyy HH:mm', 'd-M-yyyy HH:mm:ss',
|
||||||
|
'd/M/yyyy', 'd/M/yyyy h:mm', 'd/M/yyyy h:mm:ss', 'd/M/yyyy h:mm am/pm', 'd/M/yyyy h:mm:ss am/pm', 'd/M/yyyy HH:mm', 'd/M/yyyy HH:mm:ss',
|
||||||
|
/* Month-Day-Year formats */
|
||||||
|
'dddd, MMMM d yyyy', 'MMMM d yyyy', 'MMM-d-yy', 'MMM. d yy',
|
||||||
|
'M-d-yy', 'M-d-yy h:mm', 'M-d-yy h:mm:ss', 'M-d-yy h:mm am/pm', 'M-d-yy h:mm:ss am/pm', 'M-d-yy HH:mm', 'M-d-yy HH:mm:ss',
|
||||||
|
'M/d/yy', 'M/d/yy h:mm', 'M/d/yy h:mm:ss', 'M/d/yy h:mm am/pm', 'M/d/yy h:mm:ss am/pm', 'M/d/yy HH:mm', 'M/d/yy HH:mm:ss',
|
||||||
|
'M-d-yyyy', 'M-d-yyyy h:mm', 'M-d-yyyy h:mm:ss', 'M-d-yyyy h:mm am/pm', 'M-d-yyyy h:mm:ss am/pm', 'M-d-yyyy HH:mm', 'M-d-yyyy HH:mm:ss',
|
||||||
|
'M/d/yyyy', 'M/d/yyyy h:mm', 'M/d/yyyy h:mm:ss', 'M/d/yyyy h:mm am/pm', 'M/d/yyyy h:mm:ss am/pm', 'M/d/yyyy HH:mm', 'M/d/yyyy HH:mm:ss',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'),
|
'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'),
|
||||||
),
|
),
|
||||||
|
'MACROBUTTON' => array(
|
||||||
|
'properties' => array('macroname' => ''),
|
||||||
|
),
|
||||||
'XE' => array(
|
'XE' => array(
|
||||||
'properties' => array(),
|
'properties' => array(),
|
||||||
'options' => array('Bold', 'Italic'),
|
'options' => array('Bold', 'Italic'),
|
||||||
|
|
@ -62,6 +78,10 @@ class Field extends AbstractElement
|
||||||
'properties' => array(),
|
'properties' => array(),
|
||||||
'options' => array('PreserveFormat'),
|
'options' => array('PreserveFormat'),
|
||||||
),
|
),
|
||||||
|
'STYLEREF' => array(
|
||||||
|
'properties' => array('StyleIdentifier' => ''),
|
||||||
|
'options' => array('PreserveFormat'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -92,6 +112,13 @@ class Field extends AbstractElement
|
||||||
*/
|
*/
|
||||||
protected $options = array();
|
protected $options = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font style
|
||||||
|
*
|
||||||
|
* @var \PhpOffice\PhpWord\Style\Font
|
||||||
|
*/
|
||||||
|
protected $fontStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Field Element
|
* Create a new Field Element
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -65,6 +65,13 @@ class Image extends AbstractElement
|
||||||
*/
|
*/
|
||||||
private $watermark;
|
private $watermark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of image
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image type
|
* Image type
|
||||||
*
|
*
|
||||||
|
|
@ -127,15 +134,17 @@ class Image extends AbstractElement
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @param bool $watermark
|
* @param bool $watermark
|
||||||
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
||||||
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
||||||
*/
|
*/
|
||||||
public function __construct($source, $style = null, $watermark = false)
|
public function __construct($source, $style = null, $watermark = false, $name = null)
|
||||||
{
|
{
|
||||||
$this->source = $source;
|
$this->source = $source;
|
||||||
$this->setIsWatermark($watermark);
|
|
||||||
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
|
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
|
||||||
|
$this->setIsWatermark($watermark);
|
||||||
|
$this->setName($name);
|
||||||
|
|
||||||
$this->checkImage();
|
$this->checkImage();
|
||||||
}
|
}
|
||||||
|
|
@ -170,6 +179,26 @@ class Image extends AbstractElement
|
||||||
return $this->sourceType;
|
return $this->sourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the image name
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setName($value)
|
||||||
|
{
|
||||||
|
$this->name = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get image name
|
||||||
|
*
|
||||||
|
* @return null|string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get image media ID
|
* Get image media ID
|
||||||
*
|
*
|
||||||
|
|
@ -313,7 +342,7 @@ class Image extends AbstractElement
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
if ($zip->open($zipFilename) !== false) {
|
if ($zip->open($zipFilename) !== false) {
|
||||||
if ($zip->locateName($imageFilename)) {
|
if ($zip->locateName($imageFilename) !== false) {
|
||||||
$isTemp = true;
|
$isTemp = true;
|
||||||
$zip->extractTo(Settings::getTempDir(), $imageFilename);
|
$zip->extractTo(Settings::getTempDir(), $imageFilename);
|
||||||
$actualSource = Settings::getTempDir() . DIRECTORY_SEPARATOR . $imageFilename;
|
$actualSource = Settings::getTempDir() . DIRECTORY_SEPARATOR . $imageFilename;
|
||||||
|
|
@ -334,6 +363,10 @@ class Image extends AbstractElement
|
||||||
// Read image binary data and convert to hex/base64 string
|
// Read image binary data and convert to hex/base64 string
|
||||||
if ($this->sourceType == self::SOURCE_GD) {
|
if ($this->sourceType == self::SOURCE_GD) {
|
||||||
$imageResource = call_user_func($this->imageCreateFunc, $actualSource);
|
$imageResource = call_user_func($this->imageCreateFunc, $actualSource);
|
||||||
|
if ($this->imageType === 'image/png') {
|
||||||
|
// PNG images need to preserve alpha channel information
|
||||||
|
imagesavealpha($imageResource, true);
|
||||||
|
}
|
||||||
ob_start();
|
ob_start();
|
||||||
call_user_func($this->imageFunc, $imageResource);
|
call_user_func($this->imageFunc, $imageResource);
|
||||||
$imageBinary = ob_get_contents();
|
$imageBinary = ob_get_contents();
|
||||||
|
|
@ -454,7 +487,7 @@ class Image extends AbstractElement
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
if ($zip->open($zipFilename) !== false) {
|
if ($zip->open($zipFilename) !== false) {
|
||||||
if ($zip->locateName($imageFilename)) {
|
if ($zip->locateName($imageFilename) !== false) {
|
||||||
$imageContent = $zip->getFromName($imageFilename);
|
$imageContent = $zip->getFromName($imageFilename);
|
||||||
if ($imageContent !== false) {
|
if ($imageContent !== false) {
|
||||||
file_put_contents($tempFilename, $imageContent);
|
file_put_contents($tempFilename, $imageContent);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ListItem extends AbstractElement
|
||||||
|
|
||||||
// Version >= 0.10.0 will pass numbering style name. Older version will use old method
|
// Version >= 0.10.0 will pass numbering style name. Older version will use old method
|
||||||
if (!is_null($listStyle) && is_string($listStyle)) {
|
if (!is_null($listStyle) && is_string($listStyle)) {
|
||||||
$this->style = new ListItemStyle($listStyle);
|
$this->style = new ListItemStyle($listStyle); // @codeCoverageIgnore
|
||||||
} else {
|
} else {
|
||||||
$this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true);
|
$this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ class OLEObject extends AbstractElement
|
||||||
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
|
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
|
||||||
$this->icon = realpath(__DIR__ . "/../resources/{$ext}.png");
|
$this->icon = realpath(__DIR__ . "/../resources/{$ext}.png");
|
||||||
|
|
||||||
return $this;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidObjectException();
|
throw new InvalidObjectException();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ class PreserveText extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Text content
|
* Text content
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string|array
|
||||||
*/
|
*/
|
||||||
private $text;
|
private $text;
|
||||||
|
|
||||||
|
|
@ -64,8 +64,6 @@ class PreserveText extends AbstractElement
|
||||||
if (isset($matches[0])) {
|
if (isset($matches[0])) {
|
||||||
$this->text = $matches;
|
$this->text = $matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -91,7 +89,7 @@ class PreserveText extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get Text content
|
* Get Text content
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string|array
|
||||||
*/
|
*/
|
||||||
public function getText()
|
public function getText()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -135,18 +135,40 @@ class Table extends AbstractElement
|
||||||
public function countColumns()
|
public function countColumns()
|
||||||
{
|
{
|
||||||
$columnCount = 0;
|
$columnCount = 0;
|
||||||
if (is_array($this->rows)) {
|
|
||||||
$rowCount = count($this->rows);
|
$rowCount = count($this->rows);
|
||||||
for ($i = 0; $i < $rowCount; $i++) {
|
for ($i = 0; $i < $rowCount; $i++) {
|
||||||
/** @var \PhpOffice\PhpWord\Element\Row $row Type hint */
|
/** @var \PhpOffice\PhpWord\Element\Row $row Type hint */
|
||||||
$row = $this->rows[$i];
|
$row = $this->rows[$i];
|
||||||
$cellCount = count($row->getCells());
|
$cellCount = count($row->getCells());
|
||||||
if ($columnCount < $cellCount) {
|
if ($columnCount < $cellCount) {
|
||||||
$columnCount = $cellCount;
|
$columnCount = $cellCount;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $columnCount;
|
return $columnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first declared cell width for each column
|
||||||
|
*
|
||||||
|
* @return int[]
|
||||||
|
*/
|
||||||
|
public function findFirstDefinedCellWidths()
|
||||||
|
{
|
||||||
|
$cellWidths = array();
|
||||||
|
|
||||||
|
foreach ($this->rows as $row) {
|
||||||
|
$cells = $row->getCells();
|
||||||
|
if (count($cells) <= count($cellWidths)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$cellWidths = array();
|
||||||
|
foreach ($cells as $cell) {
|
||||||
|
$cellWidths[] = $cell->getWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cellWidths;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ class Title extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Title Text content
|
* Title Text content
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string|TextRun
|
||||||
*/
|
*/
|
||||||
private $text;
|
private $text;
|
||||||
|
|
||||||
|
|
@ -56,18 +56,24 @@ class Title extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Create a new Title Element
|
* Create a new Title Element
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param string|TextRun $text
|
||||||
* @param int $depth
|
* @param int $depth
|
||||||
*/
|
*/
|
||||||
public function __construct($text, $depth = 1)
|
public function __construct($text, $depth = 1)
|
||||||
{
|
{
|
||||||
$this->text = CommonText::toUTF8($text);
|
if (is_string($text)) {
|
||||||
$this->depth = $depth;
|
$this->text = CommonText::toUTF8($text);
|
||||||
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
|
} elseif ($text instanceof TextRun) {
|
||||||
$this->style = "Heading{$this->depth}";
|
$this->text = $text;
|
||||||
|
} else {
|
||||||
|
throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
$this->depth = $depth;
|
||||||
|
$styleName = $depth === 0 ? 'Title' : "Heading_{$this->depth}";
|
||||||
|
if (array_key_exists($styleName, Style::getStyles())) {
|
||||||
|
$this->style = str_replace('_', '', $styleName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -20,14 +20,25 @@ namespace PhpOffice\PhpWord\Element;
|
||||||
/**
|
/**
|
||||||
* TrackChange element
|
* TrackChange element
|
||||||
* @see http://datypic.com/sc/ooxml/t-w_CT_TrackChange.html
|
* @see http://datypic.com/sc/ooxml/t-w_CT_TrackChange.html
|
||||||
|
* @see http://datypic.com/sc/ooxml/t-w_CT_RunTrackChange.html
|
||||||
*/
|
*/
|
||||||
class TrackChange extends AbstractContainer
|
class TrackChange extends AbstractContainer
|
||||||
{
|
{
|
||||||
|
const INSERTED = 'INSERTED';
|
||||||
|
const DELETED = 'DELETED';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Container type
|
* @var string Container type
|
||||||
*/
|
*/
|
||||||
protected $container = 'TrackChange';
|
protected $container = 'TrackChange';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of change, (insert or delete), not applicable for PhpOffice\PhpWord\Element\Comment
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $changeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author
|
* Author
|
||||||
*
|
*
|
||||||
|
|
@ -45,13 +56,17 @@ class TrackChange extends AbstractContainer
|
||||||
/**
|
/**
|
||||||
* Create a new TrackChange Element
|
* Create a new TrackChange Element
|
||||||
*
|
*
|
||||||
|
* @param string $changeType
|
||||||
* @param string $author
|
* @param string $author
|
||||||
* @param \DateTime $date
|
* @param null|int|\DateTime $date
|
||||||
*/
|
*/
|
||||||
public function __construct($author, \DateTime $date = null)
|
public function __construct($changeType = null, $author = null, $date = null)
|
||||||
{
|
{
|
||||||
|
$this->changeType = $changeType;
|
||||||
$this->author = $author;
|
$this->author = $author;
|
||||||
$this->date = $date;
|
if ($date !== null) {
|
||||||
|
$this->date = ($date instanceof \DateTime) ? $date : new \DateTime('@' . $date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,4 +88,14 @@ class TrackChange extends AbstractContainer
|
||||||
{
|
{
|
||||||
return $this->date;
|
return $this->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Change type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getChangeType()
|
||||||
|
{
|
||||||
|
return $this->changeType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PhpOffice\PhpWord\Metadata;
|
namespace PhpOffice\PhpWord\Metadata;
|
||||||
|
|
||||||
use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder;
|
use PhpOffice\Common\Microsoft\PasswordEncoder;
|
||||||
use PhpOffice\PhpWord\SimpleType\DocProtect;
|
use PhpOffice\PhpWord\SimpleType\DocProtect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,7 +113,7 @@ class Protection
|
||||||
/**
|
/**
|
||||||
* Set password
|
* Set password
|
||||||
*
|
*
|
||||||
* @param $password
|
* @param string $password
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setPassword($password)
|
public function setPassword($password)
|
||||||
|
|
@ -136,7 +136,7 @@ class Protection
|
||||||
/**
|
/**
|
||||||
* Set count for hash iterations
|
* Set count for hash iterations
|
||||||
*
|
*
|
||||||
* @param $spinCount
|
* @param int $spinCount
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setSpinCount($spinCount)
|
public function setSpinCount($spinCount)
|
||||||
|
|
@ -159,7 +159,7 @@ class Protection
|
||||||
/**
|
/**
|
||||||
* Set algorithm
|
* Set algorithm
|
||||||
*
|
*
|
||||||
* @param $algorithm
|
* @param string $algorithm
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setAlgorithm($algorithm)
|
public function setAlgorithm($algorithm)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -130,6 +130,32 @@ class Settings
|
||||||
*/
|
*/
|
||||||
private $decimalSymbol = '.';
|
private $decimalSymbol = '.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically hyphenate document contents when displayed
|
||||||
|
*
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private $autoHyphenation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum number of consecutively hyphenated lines
|
||||||
|
*
|
||||||
|
* @var int|null
|
||||||
|
*/
|
||||||
|
private $consecutiveHyphenLimit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The allowed amount of whitespace before hyphenation is applied
|
||||||
|
* @var float|null
|
||||||
|
*/
|
||||||
|
private $hyphenationZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not hyphenate words in all capital letters
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private $doNotHyphenateCaps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Protection
|
* @return Protection
|
||||||
*/
|
*/
|
||||||
|
|
@ -387,4 +413,68 @@ class Settings
|
||||||
{
|
{
|
||||||
$this->decimalSymbol = $decimalSymbol;
|
$this->decimalSymbol = $decimalSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|null
|
||||||
|
*/
|
||||||
|
public function hasAutoHyphenation()
|
||||||
|
{
|
||||||
|
return $this->autoHyphenation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $autoHyphenation
|
||||||
|
*/
|
||||||
|
public function setAutoHyphenation($autoHyphenation)
|
||||||
|
{
|
||||||
|
$this->autoHyphenation = (bool) $autoHyphenation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public function getConsecutiveHyphenLimit()
|
||||||
|
{
|
||||||
|
return $this->consecutiveHyphenLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $consecutiveHyphenLimit
|
||||||
|
*/
|
||||||
|
public function setConsecutiveHyphenLimit($consecutiveHyphenLimit)
|
||||||
|
{
|
||||||
|
$this->consecutiveHyphenLimit = (int) $consecutiveHyphenLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float|null
|
||||||
|
*/
|
||||||
|
public function getHyphenationZone()
|
||||||
|
{
|
||||||
|
return $this->hyphenationZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param float $hyphenationZone Measurement unit is twip
|
||||||
|
*/
|
||||||
|
public function setHyphenationZone($hyphenationZone)
|
||||||
|
{
|
||||||
|
$this->hyphenationZone = $hyphenationZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null|bool
|
||||||
|
*/
|
||||||
|
public function hasDoNotHyphenateCaps()
|
||||||
|
{
|
||||||
|
return $this->doNotHyphenateCaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $doNotHyphenateCaps
|
||||||
|
*/
|
||||||
|
public function setDoNotHyphenateCaps($doNotHyphenateCaps)
|
||||||
|
{
|
||||||
|
$this->doNotHyphenateCaps = (bool) $doNotHyphenateCaps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -35,10 +35,10 @@ use PhpOffice\PhpWord\Exception\Exception;
|
||||||
* @method int addChart(Element\Chart $chart)
|
* @method int addChart(Element\Chart $chart)
|
||||||
* @method int addComment(Element\Comment $comment)
|
* @method int addComment(Element\Comment $comment)
|
||||||
*
|
*
|
||||||
* @method Style\Paragraph addParagraphStyle(string $styleName, array $styles)
|
* @method Style\Paragraph addParagraphStyle(string $styleName, mixed $styles)
|
||||||
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null)
|
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null)
|
||||||
* @method Style\Font addLinkStyle(string $styleName, mixed $styles)
|
* @method Style\Font addLinkStyle(string $styleName, mixed $styles)
|
||||||
* @method Style\Font addTitleStyle(int $depth, mixed $fontStyle, mixed $paragraphStyle = null)
|
* @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null)
|
||||||
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null)
|
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null)
|
||||||
* @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles)
|
* @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles)
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,8 +52,17 @@ class PhpWord
|
||||||
* @const string|int
|
* @const string|int
|
||||||
*/
|
*/
|
||||||
const DEFAULT_FONT_NAME = Settings::DEFAULT_FONT_NAME;
|
const DEFAULT_FONT_NAME = Settings::DEFAULT_FONT_NAME;
|
||||||
|
/**
|
||||||
|
* @deprecated 0.11.0 Use Settings constants
|
||||||
|
*/
|
||||||
const DEFAULT_FONT_SIZE = Settings::DEFAULT_FONT_SIZE;
|
const DEFAULT_FONT_SIZE = Settings::DEFAULT_FONT_SIZE;
|
||||||
|
/**
|
||||||
|
* @deprecated 0.11.0 Use Settings constants
|
||||||
|
*/
|
||||||
const DEFAULT_FONT_COLOR = Settings::DEFAULT_FONT_COLOR;
|
const DEFAULT_FONT_COLOR = Settings::DEFAULT_FONT_COLOR;
|
||||||
|
/**
|
||||||
|
* @deprecated 0.11.0 Use Settings constants
|
||||||
|
*/
|
||||||
const DEFAULT_FONT_CONTENT_TYPE = Settings::DEFAULT_FONT_CONTENT_TYPE;
|
const DEFAULT_FONT_CONTENT_TYPE = Settings::DEFAULT_FONT_CONTENT_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,6 +94,10 @@ class PhpWord
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
// Reset Media and styles
|
||||||
|
Media::resetElements();
|
||||||
|
Style::resetStyles();
|
||||||
|
|
||||||
// Collection
|
// Collection
|
||||||
$collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts', 'Comments');
|
$collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts', 'Comments');
|
||||||
foreach ($collections as $collection) {
|
foreach ($collections as $collection) {
|
||||||
|
|
@ -212,6 +225,21 @@ class PhpWord
|
||||||
return $this->sections;
|
return $this->sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the section at the requested position
|
||||||
|
*
|
||||||
|
* @param int $index
|
||||||
|
* @return \PhpOffice\PhpWord\Element\Section|null
|
||||||
|
*/
|
||||||
|
public function getSection($index)
|
||||||
|
{
|
||||||
|
if (array_key_exists($index, $this->sections)) {
|
||||||
|
return $this->sections[$index];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new section
|
* Create new section
|
||||||
*
|
*
|
||||||
|
|
@ -227,6 +255,17 @@ class PhpWord
|
||||||
return $section;
|
return $section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts the sections using the callable passed
|
||||||
|
*
|
||||||
|
* @see http://php.net/manual/en/function.usort.php for usage
|
||||||
|
* @param callable $sorter
|
||||||
|
*/
|
||||||
|
public function sortSections($sorter)
|
||||||
|
{
|
||||||
|
usort($this->sections, $sorter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get default font name
|
* Get default font name
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @see https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2017 PHPWord contributors
|
* @copyright 2010-2018 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue