Enable php-cs-fixer in build & fix resulting warnings (#1099)
* enable php 7.1 build * upgrade to dompdf/dompdf 0.8.* * update phpunit & hide output during tests * run code coverage analysis on 1 build only * Add php-cs * Update Copyright
This commit is contained in:
parent
0beeb275fe
commit
0459670a9c
|
|
@ -19,3 +19,4 @@ vendor
|
||||||
phpword.ini
|
phpword.ini
|
||||||
/.buildpath
|
/.buildpath
|
||||||
/.project
|
/.project
|
||||||
|
/.php_cs.cache
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->notName('pclzip.lib.php')
|
||||||
|
->notName('OLERead.php')
|
||||||
|
->in('samples')
|
||||||
|
->in('src')
|
||||||
|
->in('tests');
|
||||||
|
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setFinder($finder)
|
||||||
|
->setRules(array(
|
||||||
|
'array_syntax' => array('syntax' => 'long'),
|
||||||
|
'binary_operator_spaces' => array('align_double_arrow' => true),
|
||||||
|
'blank_line_after_namespace' => true,
|
||||||
|
'blank_line_after_opening_tag' => false,
|
||||||
|
'blank_line_before_return' => true,
|
||||||
|
'braces' => true,
|
||||||
|
'cast_spaces' => true,
|
||||||
|
'class_definition' => true,
|
||||||
|
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
|
||||||
|
'combine_consecutive_unsets' => true,
|
||||||
|
'concat_space' => array('spacing' => 'one'),
|
||||||
|
'declare_equal_normalize' => true,
|
||||||
|
'declare_strict_types' => false, // Too early to adopt strict types
|
||||||
|
'dir_constant' => true,
|
||||||
|
'elseif' => true,
|
||||||
|
'encoding' => true,
|
||||||
|
'ereg_to_preg' => true,
|
||||||
|
'full_opening_tag' => true,
|
||||||
|
'function_declaration' => true,
|
||||||
|
'function_typehint_space' => true,
|
||||||
|
'general_phpdoc_annotation_remove' => false, // No use for that
|
||||||
|
'hash_to_slash_comment' => true,
|
||||||
|
'header_comment' => false, // We don't use common header in all our files
|
||||||
|
'heredoc_to_nowdoc' => false, // Not sure about this one
|
||||||
|
'is_null' => false, // Risky
|
||||||
|
'include' => true,
|
||||||
|
'indentation_type' => true,
|
||||||
|
'line_ending' => true,
|
||||||
|
'linebreak_after_opening_tag' => true,
|
||||||
|
'lowercase_cast' => true,
|
||||||
|
'lowercase_constants' => true,
|
||||||
|
'lowercase_keywords' => true,
|
||||||
|
'mb_str_functions' => false, // No, too dangerous to change that
|
||||||
|
'method_argument_space' => true,
|
||||||
|
'method_separation' => true,
|
||||||
|
'modernize_types_casting' => true,
|
||||||
|
'native_function_casing' => true,
|
||||||
|
'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now
|
||||||
|
'new_with_braces' => true,
|
||||||
|
'no_alias_functions' => true,
|
||||||
|
'no_blank_lines_after_class_opening' => true,
|
||||||
|
'no_blank_lines_after_phpdoc' => true,
|
||||||
|
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
|
||||||
|
'no_closing_tag' => true,
|
||||||
|
'no_empty_comment' => true,
|
||||||
|
'no_empty_phpdoc' => true,
|
||||||
|
'no_empty_statement' => true,
|
||||||
|
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'),
|
||||||
|
'no_leading_import_slash' => true,
|
||||||
|
'no_leading_namespace_whitespace' => true,
|
||||||
|
'no_mixed_echo_print' => true,
|
||||||
|
'no_multiline_whitespace_around_double_arrow' => true,
|
||||||
|
'no_multiline_whitespace_before_semicolons' => true,
|
||||||
|
'no_php4_constructor' => true,
|
||||||
|
'no_short_bool_cast' => true,
|
||||||
|
'no_short_echo_tag' => true,
|
||||||
|
'no_singleline_whitespace_before_semicolons' => true,
|
||||||
|
'no_spaces_after_function_name' => true,
|
||||||
|
'no_spaces_around_offset' => true,
|
||||||
|
'no_spaces_inside_parenthesis' => true,
|
||||||
|
'no_trailing_comma_in_list_call' => true,
|
||||||
|
'no_trailing_comma_in_singleline_array' => true,
|
||||||
|
'no_trailing_whitespace' => true,
|
||||||
|
'no_trailing_whitespace_in_comment' => true,
|
||||||
|
'no_unneeded_control_parentheses' => true,
|
||||||
|
'no_unreachable_default_argument_value' => true,
|
||||||
|
'no_unused_imports' => true,
|
||||||
|
'no_useless_else' => true,
|
||||||
|
'no_useless_return' => true,
|
||||||
|
'no_whitespace_before_comma_in_array' => true,
|
||||||
|
'no_whitespace_in_blank_line' => true,
|
||||||
|
'normalize_index_brace' => true,
|
||||||
|
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
|
||||||
|
'not_operator_with_successor_space' => false, // idem
|
||||||
|
'object_operator_without_whitespace' => true,
|
||||||
|
'ordered_class_elements' => false, // We prefer to keep some freedom
|
||||||
|
'ordered_imports' => true,
|
||||||
|
'php_unit_construct' => true,
|
||||||
|
'php_unit_dedicate_assert' => true,
|
||||||
|
'php_unit_fqcn_annotation' => true,
|
||||||
|
'php_unit_strict' => false, // We sometime actually need assertEquals
|
||||||
|
'phpdoc_add_missing_param_annotation' => true,
|
||||||
|
'phpdoc_align' => false, // Waste of time
|
||||||
|
'phpdoc_annotation_without_dot' => true,
|
||||||
|
'phpdoc_indent' => true,
|
||||||
|
'phpdoc_inline_tag' => true,
|
||||||
|
'phpdoc_no_access' => true,
|
||||||
|
'phpdoc_no_alias_tag' => true,
|
||||||
|
'phpdoc_no_empty_return' => true,
|
||||||
|
'phpdoc_no_package' => true,
|
||||||
|
'phpdoc_no_useless_inheritdoc' => true,
|
||||||
|
'phpdoc_order' => true,
|
||||||
|
'phpdoc_return_self_reference' => true,
|
||||||
|
'phpdoc_scalar' => true,
|
||||||
|
'phpdoc_separation' => false,
|
||||||
|
'phpdoc_single_line_var_spacing' => true,
|
||||||
|
'phpdoc_summary' => false,
|
||||||
|
'phpdoc_to_comment' => true,
|
||||||
|
'phpdoc_trim' => true,
|
||||||
|
'phpdoc_types' => true,
|
||||||
|
'phpdoc_var_without_name' => true,
|
||||||
|
'pow_to_exponentiation' => false,
|
||||||
|
'pre_increment' => false,
|
||||||
|
'protected_to_private' => true,
|
||||||
|
'psr0' => true,
|
||||||
|
'psr4' => true,
|
||||||
|
'random_api_migration' => false, // This breaks our unit tests
|
||||||
|
'return_type_declaration' => true,
|
||||||
|
'self_accessor' => true,
|
||||||
|
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
|
||||||
|
'short_scalar_cast' => true,
|
||||||
|
'silenced_deprecation_error' => true,
|
||||||
|
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
|
||||||
|
'single_blank_line_at_eof' => true,
|
||||||
|
'single_blank_line_before_namespace' => true,
|
||||||
|
'single_class_element_per_statement' => true,
|
||||||
|
'single_import_per_statement' => true,
|
||||||
|
'single_line_after_imports' => true,
|
||||||
|
'single_quote' => true,
|
||||||
|
'space_after_semicolon' => true,
|
||||||
|
'standardize_not_equals' => true,
|
||||||
|
'strict_comparison' => false, // No, too dangerous to change that
|
||||||
|
'strict_param' => false, // No, too dangerous to change that
|
||||||
|
'switch_case_semicolon_to_colon' => true,
|
||||||
|
'switch_case_space' => true,
|
||||||
|
'ternary_operator_spaces' => true,
|
||||||
|
'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6
|
||||||
|
'trailing_comma_in_multiline_array' => true,
|
||||||
|
'trim_array_spaces' => false,
|
||||||
|
'unary_operator_spaces' => true,
|
||||||
|
'visibility_required' => true,
|
||||||
|
'whitespace_after_comma_in_array' => true,
|
||||||
|
));
|
||||||
30
.travis.yml
30
.travis.yml
|
|
@ -8,12 +8,21 @@ php:
|
||||||
- 5.5
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
## - hhvm
|
- 7.1
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
include:
|
||||||
|
- php: 5.6
|
||||||
|
env: COVERAGE=1
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: 7.0
|
- php: 7.0
|
||||||
## - php: hhvm
|
- php: 7.1
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- vendor
|
||||||
|
- $HOME/.composer/cache
|
||||||
|
- .php-cs.cache
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|
@ -25,6 +34,8 @@ before_install:
|
||||||
- sudo apt-get install -y graphviz
|
- sudo apt-get install -y graphviz
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
## Deactivate xdebug if we don't do code coverage
|
||||||
|
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
|
||||||
## Composer
|
## Composer
|
||||||
- composer self-update
|
- composer self-update
|
||||||
- composer install --prefer-source
|
- composer install --prefer-source
|
||||||
|
|
@ -34,19 +45,20 @@ before_script:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
## PHP_CodeSniffer
|
## PHP_CodeSniffer
|
||||||
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
|
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
|
||||||
|
## PHP-CS-Fixer
|
||||||
|
- if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
|
||||||
## PHP Mess Detector
|
## PHP Mess Detector
|
||||||
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
|
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
|
||||||
## PHPUnit
|
## PHPUnit
|
||||||
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
|
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi)
|
||||||
## PHPLOC
|
## PHPLOC
|
||||||
- ./vendor/bin/phploc src/
|
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
|
||||||
## PHPDocumentor
|
## PHPDocumentor
|
||||||
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig"
|
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
## PHPDocumentor
|
## PHPDocumentor
|
||||||
- bash .travis_shell_after_success.sh
|
- bash .travis_shell_after_success.sh
|
||||||
## Scrutinizer
|
## Scrutinizer
|
||||||
- wget https://scrutinizer-ci.com/ocular.phar
|
- 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
|
||||||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
|
||||||
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
|
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
|
||||||
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
|
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
|
||||||
|
|
||||||
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then
|
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then
|
||||||
|
|
||||||
echo -e "Publishing PHPDoc...\n"
|
echo -e "Publishing PHPDoc...\n"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,14 @@
|
||||||
"phpoffice/common": "^0.2"
|
"phpoffice/common": "^0.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "3.7.*",
|
"phpunit/phpunit": "4.8.*",
|
||||||
"phpdocumentor/phpdocumentor":"2.*",
|
"phpdocumentor/phpdocumentor":"2.*",
|
||||||
"squizlabs/php_codesniffer": "1.*",
|
"twig/twig":"1.27",
|
||||||
|
"squizlabs/php_codesniffer": "^2.7",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.0",
|
||||||
"phpmd/phpmd": "2.*",
|
"phpmd/phpmd": "2.*",
|
||||||
"phploc/phploc": "2.*",
|
"phploc/phploc": "2.*",
|
||||||
"dompdf/dompdf":"0.6.*",
|
"dompdf/dompdf":"0.8.*",
|
||||||
"tecnickcom/tcpdf": "6.*",
|
"tecnickcom/tcpdf": "6.*",
|
||||||
"mpdf/mpdf": "5.*"
|
"mpdf/mpdf": "5.*"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -135,12 +135,12 @@ Text breaks are empty new lines. To add text breaks, use the following syntax. A
|
||||||
Page breaks
|
Page breaks
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
There are two ways to insert a page breaks, using the ``addPageBreak``
|
There are two ways to insert a page break, using the ``addPageBreak``
|
||||||
method or using the ``pageBreakBefore`` style of paragraph.
|
method or using the ``pageBreakBefore`` style of paragraph.
|
||||||
|
|
||||||
:: code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
\\$section->addPageBreak();
|
$section->addPageBreak();
|
||||||
|
|
||||||
Lists
|
Lists
|
||||||
-----
|
-----
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## PHP_CodeSniffer
|
||||||
|
./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
|
||||||
|
|
||||||
|
## PHP-CS-Fixer
|
||||||
|
./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run
|
||||||
|
|
||||||
|
## PHP Mess Detector
|
||||||
|
./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
|
||||||
|
|
||||||
|
## PHPUnit
|
||||||
|
./vendor/bin/phpunit -c ./ --no-coverage
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
use PhpOffice\PhpWord\Style\Paragraph;
|
|
||||||
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';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ $phpWord->addParagraphStyle(
|
||||||
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
||||||
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
||||||
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,62 @@
|
||||||
<?php
|
<?php
|
||||||
include_once 'Sample_Header.php';
|
include_once 'Sample_Header.php';
|
||||||
|
|
||||||
// Template processor instance creation
|
// Template processor instance creation
|
||||||
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
||||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
|
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
|
||||||
|
|
||||||
// Variables on different parts of document
|
// Variables on different parts of document
|
||||||
$templateProcessor->setValue('weekday', date('l')); // On section/content
|
$templateProcessor->setValue('weekday', date('l')); // On section/content
|
||||||
$templateProcessor->setValue('time', date('H:i')); // On footer
|
$templateProcessor->setValue('time', date('H:i')); // On footer
|
||||||
$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header
|
$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header
|
||||||
|
|
||||||
// Simple table
|
// Simple table
|
||||||
$templateProcessor->cloneRow('rowValue', 10);
|
$templateProcessor->cloneRow('rowValue', 10);
|
||||||
|
|
||||||
$templateProcessor->setValue('rowValue#1', 'Sun');
|
$templateProcessor->setValue('rowValue#1', 'Sun');
|
||||||
$templateProcessor->setValue('rowValue#2', 'Mercury');
|
$templateProcessor->setValue('rowValue#2', 'Mercury');
|
||||||
$templateProcessor->setValue('rowValue#3', 'Venus');
|
$templateProcessor->setValue('rowValue#3', 'Venus');
|
||||||
$templateProcessor->setValue('rowValue#4', 'Earth');
|
$templateProcessor->setValue('rowValue#4', 'Earth');
|
||||||
$templateProcessor->setValue('rowValue#5', 'Mars');
|
$templateProcessor->setValue('rowValue#5', 'Mars');
|
||||||
$templateProcessor->setValue('rowValue#6', 'Jupiter');
|
$templateProcessor->setValue('rowValue#6', 'Jupiter');
|
||||||
$templateProcessor->setValue('rowValue#7', 'Saturn');
|
$templateProcessor->setValue('rowValue#7', 'Saturn');
|
||||||
$templateProcessor->setValue('rowValue#8', 'Uranus');
|
$templateProcessor->setValue('rowValue#8', 'Uranus');
|
||||||
$templateProcessor->setValue('rowValue#9', 'Neptun');
|
$templateProcessor->setValue('rowValue#9', 'Neptun');
|
||||||
$templateProcessor->setValue('rowValue#10', 'Pluto');
|
$templateProcessor->setValue('rowValue#10', 'Pluto');
|
||||||
|
|
||||||
$templateProcessor->setValue('rowNumber#1', '1');
|
$templateProcessor->setValue('rowNumber#1', '1');
|
||||||
$templateProcessor->setValue('rowNumber#2', '2');
|
$templateProcessor->setValue('rowNumber#2', '2');
|
||||||
$templateProcessor->setValue('rowNumber#3', '3');
|
$templateProcessor->setValue('rowNumber#3', '3');
|
||||||
$templateProcessor->setValue('rowNumber#4', '4');
|
$templateProcessor->setValue('rowNumber#4', '4');
|
||||||
$templateProcessor->setValue('rowNumber#5', '5');
|
$templateProcessor->setValue('rowNumber#5', '5');
|
||||||
$templateProcessor->setValue('rowNumber#6', '6');
|
$templateProcessor->setValue('rowNumber#6', '6');
|
||||||
$templateProcessor->setValue('rowNumber#7', '7');
|
$templateProcessor->setValue('rowNumber#7', '7');
|
||||||
$templateProcessor->setValue('rowNumber#8', '8');
|
$templateProcessor->setValue('rowNumber#8', '8');
|
||||||
$templateProcessor->setValue('rowNumber#9', '9');
|
$templateProcessor->setValue('rowNumber#9', '9');
|
||||||
$templateProcessor->setValue('rowNumber#10', '10');
|
$templateProcessor->setValue('rowNumber#10', '10');
|
||||||
|
|
||||||
// Table with a spanned cell
|
// Table with a spanned cell
|
||||||
$templateProcessor->cloneRow('userId', 3);
|
$templateProcessor->cloneRow('userId', 3);
|
||||||
|
|
||||||
$templateProcessor->setValue('userId#1', '1');
|
$templateProcessor->setValue('userId#1', '1');
|
||||||
$templateProcessor->setValue('userFirstName#1', 'James');
|
$templateProcessor->setValue('userFirstName#1', 'James');
|
||||||
$templateProcessor->setValue('userName#1', 'Taylor');
|
$templateProcessor->setValue('userName#1', 'Taylor');
|
||||||
$templateProcessor->setValue('userPhone#1', '+1 428 889 773');
|
$templateProcessor->setValue('userPhone#1', '+1 428 889 773');
|
||||||
|
|
||||||
$templateProcessor->setValue('userId#2', '2');
|
$templateProcessor->setValue('userId#2', '2');
|
||||||
$templateProcessor->setValue('userFirstName#2', 'Robert');
|
$templateProcessor->setValue('userFirstName#2', 'Robert');
|
||||||
$templateProcessor->setValue('userName#2', 'Bell');
|
$templateProcessor->setValue('userName#2', 'Bell');
|
||||||
$templateProcessor->setValue('userPhone#2', '+1 428 889 774');
|
$templateProcessor->setValue('userPhone#2', '+1 428 889 774');
|
||||||
|
|
||||||
$templateProcessor->setValue('userId#3', '3');
|
$templateProcessor->setValue('userId#3', '3');
|
||||||
$templateProcessor->setValue('userFirstName#3', 'Michael');
|
$templateProcessor->setValue('userFirstName#3', 'Michael');
|
||||||
$templateProcessor->setValue('userName#3', 'Ray');
|
$templateProcessor->setValue('userName#3', 'Ray');
|
||||||
$templateProcessor->setValue('userPhone#3', '+1 428 889 775');
|
$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'));
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
include_once 'Sample_Footer.php';
|
include_once 'Sample_Footer.php';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ $section->addText(
|
||||||
'Below are the samples on how to control your paragraph '
|
'Below are the samples on how to control your paragraph '
|
||||||
. 'pagination. See "Line and Page Break" tab on paragraph properties '
|
. 'pagination. See "Line and Page Break" tab on paragraph properties '
|
||||||
. 'window to see the attribute set by these controls.',
|
. 'window to see the attribute set by these controls.',
|
||||||
array('bold' => true),
|
array('bold' => true),
|
||||||
array('space' => array('before' => 360, 'after' => 480))
|
array('space' => array('before' => 360, 'after' => 480))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ for ($i = 1; $i <= 8; $i++) {
|
||||||
$table->addCell(2000)->addText("Cell {$i}");
|
$table->addCell(2000)->addText("Cell {$i}");
|
||||||
$table->addCell(2000)->addText("Cell {$i}");
|
$table->addCell(2000)->addText("Cell {$i}");
|
||||||
$table->addCell(2000)->addText("Cell {$i}");
|
$table->addCell(2000)->addText("Cell {$i}");
|
||||||
$text = (0== $i % 2) ? 'X' : '';
|
$text = (0 == $i % 2) ? 'X' : '';
|
||||||
$table->addCell(500)->addText($text);
|
$table->addCell(500)->addText($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 3. colspan (gridSpan) and rowspan (vMerge)
|
* 3. colspan (gridSpan) and rowspan (vMerge)
|
||||||
* ---------------------
|
* ---------------------
|
||||||
* | | B | |
|
* | | B | |
|
||||||
|
|
@ -93,7 +93,7 @@ $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered);
|
||||||
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
|
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
|
||||||
$table->addCell(null, $cellRowContinue);
|
$table->addCell(null, $cellRowContinue);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 4. colspan (gridSpan) and rowspan (vMerge)
|
* 4. colspan (gridSpan) and rowspan (vMerge)
|
||||||
* ---------------------
|
* ---------------------
|
||||||
* | | B | 1 |
|
* | | B | 1 |
|
||||||
|
|
@ -104,6 +104,7 @@ $table->addCell(null, $cellRowContinue);
|
||||||
* ---------------------
|
* ---------------------
|
||||||
* @see https://github.com/PHPOffice/PHPWord/issues/806
|
* @see https://github.com/PHPOffice/PHPWord/issues/806
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$section->addPageBreak();
|
$section->addPageBreak();
|
||||||
$section->addText('Table with colspan and rowspan', $header);
|
$section->addText('Table with colspan and rowspan', $header);
|
||||||
|
|
||||||
|
|
@ -114,12 +115,12 @@ $table = $section->addTable('Colspan Rowspan');
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
|
|
||||||
$row->addCell(null, array('vMerge' => 'restart'))->addText('A');
|
$row->addCell(null, array('vMerge' => 'restart'))->addText('A');
|
||||||
$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart',))->addText('B');
|
$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B');
|
||||||
$row->addCell()->addText('1');
|
$row->addCell()->addText('1');
|
||||||
|
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
$row->addCell(null, array('vMerge' => 'continue'));
|
$row->addCell(null, array('vMerge' => 'continue'));
|
||||||
$row->addCell(null, array('vMerge' => 'continue','gridSpan' => 2,));
|
$row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2));
|
||||||
$row->addCell()->addText('2');
|
$row->addCell()->addText('2');
|
||||||
$row = $table->addRow();
|
$row = $table->addRow();
|
||||||
$row->addCell(null, array('vMerge' => 'continue'));
|
$row->addCell(null, array('vMerge' => 'continue'));
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ $section->addImage($source);
|
||||||
// Image from string
|
// Image from string
|
||||||
$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
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ $image->setCommentRangeStart($commentOnImage);
|
||||||
$section->addTextBreak(2);
|
$section->addTextBreak(2);
|
||||||
|
|
||||||
// We can also do things the other way round, link the comment to the element
|
// We can also do things the other way round, link the comment to the element
|
||||||
$anotherText = $section->addText("another text");
|
$anotherText = $section->addText('another text');
|
||||||
|
|
||||||
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
||||||
$comment1->addText('Test', array('bold' => true));
|
$comment1->addText('Test', array('bold' => true));
|
||||||
|
|
@ -55,7 +55,6 @@ $comment1->setStartElement($anotherText);
|
||||||
$comment1->setEndElement($anotherText);
|
$comment1->setEndElement($anotherText);
|
||||||
$phpWord->addComment($comment1);
|
$phpWord->addComment($comment1);
|
||||||
|
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ function getEndingNotes($writers)
|
||||||
|
|
||||||
// Do not show execution time for index
|
// Do not show execution time for index
|
||||||
if (!IS_INDEX) {
|
if (!IS_INDEX) {
|
||||||
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
|
$result .= date('H:i:s') . ' Done writing file(s)' . EOL;
|
||||||
$result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
|
$result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ $requirements = array(
|
||||||
'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')),
|
'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')),
|
||||||
);
|
);
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
?>
|
?>
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<p>Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).</p>
|
<p>Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).</p>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
@ -25,14 +25,14 @@ if (!CLI) {
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if (!CLI) {
|
if (!CLI) {
|
||||||
echo "<h3>Requirement check:</h3>";
|
echo '<h3>Requirement check:</h3>';
|
||||||
echo "<ul>";
|
echo '<ul>';
|
||||||
foreach ($requirements as $key => $value) {
|
foreach ($requirements as $key => $value) {
|
||||||
list($label, $result) = $value;
|
list($label, $result) = $value;
|
||||||
$status = $result ? 'passed' : 'failed';
|
$status = $result ? 'passed' : 'failed';
|
||||||
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
|
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
|
||||||
}
|
}
|
||||||
echo "</ul>";
|
echo '</ul>';
|
||||||
include_once 'Sample_Footer.php';
|
include_once 'Sample_Footer.php';
|
||||||
} else {
|
} else {
|
||||||
echo 'Requirement check:' . PHP_EOL;
|
echo 'Requirement check:' . PHP_EOL;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -51,9 +51,9 @@ abstract class AbstractCollection
|
||||||
{
|
{
|
||||||
if (array_key_exists($index, $this->items)) {
|
if (array_key_exists($index, $this->items)) {
|
||||||
return $this->items[$index];
|
return $this->items[$index];
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,7 +61,6 @@ abstract class AbstractCollection
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int $index
|
||||||
* @param mixed $item
|
* @param mixed $item
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setItem($index, $item)
|
public function setItem($index, $item)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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\ComplexType;
|
namespace PhpOffice\PhpWord\ComplexType;
|
||||||
|
|
||||||
use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
||||||
|
|
@ -25,7 +26,6 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
||||||
*/
|
*/
|
||||||
final class FootnoteProperties
|
final class FootnoteProperties
|
||||||
{
|
{
|
||||||
|
|
||||||
const RESTART_NUMBER_CONTINUOUS = 'continuous';
|
const RESTART_NUMBER_CONTINUOUS = 'continuous';
|
||||||
const RESTART_NUMBER_EACH_SECTION = 'eachSect';
|
const RESTART_NUMBER_EACH_SECTION = 'eachSect';
|
||||||
const RESTART_NUMBER_EACH_PAGE = 'eachPage';
|
const RESTART_NUMBER_EACH_PAGE = 'eachPage';
|
||||||
|
|
@ -52,7 +52,7 @@ final class FootnoteProperties
|
||||||
/**
|
/**
|
||||||
* Footnote and Endnote Numbering Starting Value
|
* Footnote and Endnote Numbering Starting Value
|
||||||
*
|
*
|
||||||
* @var double
|
* @var float
|
||||||
*/
|
*/
|
||||||
private $numStart;
|
private $numStart;
|
||||||
|
|
||||||
|
|
@ -86,14 +86,15 @@ final class FootnoteProperties
|
||||||
self::POSITION_PAGE_BOTTOM,
|
self::POSITION_PAGE_BOTTOM,
|
||||||
self::POSITION_BENEATH_TEXT,
|
self::POSITION_BENEATH_TEXT,
|
||||||
self::POSITION_SECTION_END,
|
self::POSITION_SECTION_END,
|
||||||
self::POSITION_DOC_END
|
self::POSITION_DOC_END,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (in_array($pos, $position)) {
|
if (in_array($pos, $position)) {
|
||||||
$this->pos = $pos;
|
$this->pos = $pos;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible");
|
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $position) . ' possible');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,13 +118,14 @@ final class FootnoteProperties
|
||||||
{
|
{
|
||||||
NumberFormat::validate($numFmt);
|
NumberFormat::validate($numFmt);
|
||||||
$this->numFmt = $numFmt;
|
$this->numFmt = $numFmt;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Footnote Numbering Format
|
* Get the Footnote Numbering Format
|
||||||
*
|
*
|
||||||
* @return double
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getNumStart()
|
public function getNumStart()
|
||||||
{
|
{
|
||||||
|
|
@ -133,12 +135,13 @@ final class FootnoteProperties
|
||||||
/**
|
/**
|
||||||
* Set the Footnote Numbering Format
|
* Set the Footnote Numbering Format
|
||||||
*
|
*
|
||||||
* @param double $numStart
|
* @param float $numStart
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setNumStart($numStart)
|
public function setNumStart($numStart)
|
||||||
{
|
{
|
||||||
$this->numStart = $numStart;
|
$this->numStart = $numStart;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,14 +167,15 @@ final class FootnoteProperties
|
||||||
$restartNumbers = array(
|
$restartNumbers = array(
|
||||||
self::RESTART_NUMBER_CONTINUOUS,
|
self::RESTART_NUMBER_CONTINUOUS,
|
||||||
self::RESTART_NUMBER_EACH_SECTION,
|
self::RESTART_NUMBER_EACH_SECTION,
|
||||||
self::RESTART_NUMBER_EACH_PAGE
|
self::RESTART_NUMBER_EACH_PAGE,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (in_array($numRestart, $restartNumbers)) {
|
if (in_array($numRestart, $restartNumbers)) {
|
||||||
$this->numRestart= $numRestart;
|
$this->numRestart = $numRestart;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible");
|
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $restartNumbers) . ' possible');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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\ComplexType;
|
namespace PhpOffice\PhpWord\ComplexType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,7 +24,6 @@ namespace PhpOffice\PhpWord\ComplexType;
|
||||||
*/
|
*/
|
||||||
final class ProofState
|
final class ProofState
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Completed
|
* Check Completed
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,8 +60,9 @@ final class ProofState
|
||||||
if ($spelling == self::CLEAN || $spelling == self::DIRTY) {
|
if ($spelling == self::CLEAN || $spelling == self::DIRTY) {
|
||||||
$this->spelling = $spelling;
|
$this->spelling = $spelling;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
|
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,8 +88,9 @@ final class ProofState
|
||||||
if ($grammar == self::CLEAN || $grammar == self::DIRTY) {
|
if ($grammar == self::CLEAN || $grammar == self::DIRTY) {
|
||||||
$this->grammar = $grammar;
|
$this->grammar = $grammar;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
|
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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\ComplexType;
|
namespace PhpOffice\PhpWord\ComplexType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,46 +24,45 @@ namespace PhpOffice\PhpWord\ComplexType;
|
||||||
*/
|
*/
|
||||||
final class TrackChangesView
|
final class TrackChangesView
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Visual Indicator Of Markup Area
|
* Display Visual Indicator Of Markup Area
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $markup;
|
private $markup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Comments
|
* Display Comments
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $comments;
|
private $comments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Content Revisions
|
* Display Content Revisions
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $insDel;
|
private $insDel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Formatting Revisions
|
* Display Formatting Revisions
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $formatting;
|
private $formatting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Ink Annotations
|
* Display Ink Annotations
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $inkAnnotations;
|
private $inkAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Display Visual Indicator Of Markup Area
|
* Get Display Visual Indicator Of Markup Area
|
||||||
*
|
*
|
||||||
* @return boolean True if markup is shown
|
* @return bool True if markup is shown
|
||||||
*/
|
*/
|
||||||
public function hasMarkup()
|
public function hasMarkup()
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +72,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Set Display Visual Indicator Of Markup Area
|
* Set Display Visual Indicator Of Markup Area
|
||||||
*
|
*
|
||||||
* @param boolean $markup
|
* @param bool $markup
|
||||||
* Set to true to show markup
|
* Set to true to show markup
|
||||||
*/
|
*/
|
||||||
public function setMarkup($markup)
|
public function setMarkup($markup)
|
||||||
|
|
@ -83,7 +83,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Get Display Comments
|
* Get Display Comments
|
||||||
*
|
*
|
||||||
* @return boolean True if comments are shown
|
* @return bool True if comments are shown
|
||||||
*/
|
*/
|
||||||
public function hasComments()
|
public function hasComments()
|
||||||
{
|
{
|
||||||
|
|
@ -93,7 +93,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Set Display Comments
|
* Set Display Comments
|
||||||
*
|
*
|
||||||
* @param boolean $comments
|
* @param bool $comments
|
||||||
* Set to true to show comments
|
* Set to true to show comments
|
||||||
*/
|
*/
|
||||||
public function setComments($comments)
|
public function setComments($comments)
|
||||||
|
|
@ -104,7 +104,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Get Display Content Revisions
|
* Get Display Content Revisions
|
||||||
*
|
*
|
||||||
* @return boolean True if content revisions are shown
|
* @return bool True if content revisions are shown
|
||||||
*/
|
*/
|
||||||
public function hasInsDel()
|
public function hasInsDel()
|
||||||
{
|
{
|
||||||
|
|
@ -114,7 +114,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Set Display Content Revisions
|
* Set Display Content Revisions
|
||||||
*
|
*
|
||||||
* @param boolean $insDel
|
* @param bool $insDel
|
||||||
* Set to true to show content revisions
|
* Set to true to show content revisions
|
||||||
*/
|
*/
|
||||||
public function setInsDel($insDel)
|
public function setInsDel($insDel)
|
||||||
|
|
@ -125,7 +125,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Get Display Formatting Revisions
|
* Get Display Formatting Revisions
|
||||||
*
|
*
|
||||||
* @return boolean True if formatting revisions are shown
|
* @return bool True if formatting revisions are shown
|
||||||
*/
|
*/
|
||||||
public function hasFormatting()
|
public function hasFormatting()
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Set Display Formatting Revisions
|
* Set Display Formatting Revisions
|
||||||
*
|
*
|
||||||
* @param boolean|null $formatting
|
* @param bool|null $formatting
|
||||||
* Set to true to show formatting revisions
|
* Set to true to show formatting revisions
|
||||||
*/
|
*/
|
||||||
public function setFormatting($formatting = null)
|
public function setFormatting($formatting = null)
|
||||||
|
|
@ -146,7 +146,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Get Display Ink Annotations
|
* Get Display Ink Annotations
|
||||||
*
|
*
|
||||||
* @return boolean True if ink annotations are shown
|
* @return bool True if ink annotations are shown
|
||||||
*/
|
*/
|
||||||
public function hasInkAnnotations()
|
public function hasInkAnnotations()
|
||||||
{
|
{
|
||||||
|
|
@ -156,7 +156,7 @@ final class TrackChangesView
|
||||||
/**
|
/**
|
||||||
* Set Display Ink Annotations
|
* Set Display Ink Annotations
|
||||||
*
|
*
|
||||||
* @param boolean $inkAnnotations
|
* @param bool $inkAnnotations
|
||||||
* Set to true to show ink annotations
|
* Set to true to show ink annotations
|
||||||
*/
|
*/
|
||||||
public function setInkAnnotations($inkAnnotations)
|
public function setInkAnnotations($inkAnnotations)
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace PhpOffice\PhpWord\Element;
|
||||||
* @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)
|
||||||
* @method Object addObject(string $source, mixed $style = null)
|
* @method \PhpOffice\PhpWord\Element\Object addObject(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)
|
||||||
* @method Line addLine(mixed $lineStyle = null)
|
* @method Line addLine(mixed $lineStyle = null)
|
||||||
|
|
@ -83,7 +83,7 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object',
|
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object',
|
||||||
'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',
|
||||||
);
|
);
|
||||||
$functions = array();
|
$functions = array();
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
|
|
@ -105,9 +105,8 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
for ($i = 1; $i <= $count; $i++) {
|
for ($i = 1; $i <= $count; $i++) {
|
||||||
$this->addElement($element, $fontStyle, $paragraphStyle);
|
$this->addElement($element, $fontStyle, $paragraphStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// All other elements
|
|
||||||
} else {
|
} else {
|
||||||
|
// All other elements
|
||||||
array_unshift($args, $element); // Prepend element name to the beginning of args array
|
array_unshift($args, $element); // Prepend element name to the beginning of args array
|
||||||
return call_user_func_array(array($this, 'addElement'), $args);
|
return call_user_func_array(array($this, 'addElement'), $args);
|
||||||
}
|
}
|
||||||
|
|
@ -181,9 +180,8 @@ abstract class AbstractContainer extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
*
|
*
|
||||||
* @return bool
|
|
||||||
*
|
|
||||||
* @throws \BadMethodCallException
|
* @throws \BadMethodCallException
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function checkValidity($method)
|
private function checkValidity($method)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ abstract class AbstractElement
|
||||||
/**
|
/**
|
||||||
* Unique Id for element
|
* Unique Id for element
|
||||||
*
|
*
|
||||||
* @var int
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $elementId;
|
protected $elementId;
|
||||||
|
|
||||||
|
|
@ -142,7 +142,6 @@ abstract class AbstractElement
|
||||||
* Set PhpWord as reference.
|
* Set PhpWord as reference.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setPhpWord(PhpWord $phpWord = null)
|
public function setPhpWord(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
|
|
@ -164,7 +163,6 @@ abstract class AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $docPart
|
* @param string $docPart
|
||||||
* @param int $docPartId
|
* @param int $docPartId
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setDocPart($docPart, $docPartId = 1)
|
public function setDocPart($docPart, $docPartId = 1)
|
||||||
{
|
{
|
||||||
|
|
@ -221,7 +219,6 @@ abstract class AbstractElement
|
||||||
* Set element index.
|
* Set element index.
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setElementIndex($value)
|
public function setElementIndex($value)
|
||||||
{
|
{
|
||||||
|
|
@ -231,7 +228,7 @@ abstract class AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get element unique ID
|
* Get element unique ID
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getElementId()
|
public function getElementId()
|
||||||
{
|
{
|
||||||
|
|
@ -240,8 +237,6 @@ abstract class AbstractElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set element unique ID from 6 first digit of md5.
|
* Set element unique ID from 6 first digit of md5.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setElementId()
|
public function setElementId()
|
||||||
{
|
{
|
||||||
|
|
@ -262,7 +257,6 @@ abstract class AbstractElement
|
||||||
* Set relation Id.
|
* Set relation Id.
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setRelationId($value)
|
public function setRelationId($value)
|
||||||
{
|
{
|
||||||
|
|
@ -297,9 +291,9 @@ abstract class AbstractElement
|
||||||
public function setCommentRangeStart(Comment $value)
|
public function setCommentRangeStart(Comment $value)
|
||||||
{
|
{
|
||||||
if ($this instanceof Comment) {
|
if ($this instanceof Comment) {
|
||||||
throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
|
throw new \InvalidArgumentException('Cannot set a Comment on a Comment');
|
||||||
}
|
}
|
||||||
$this->commentRangeStart= $value;
|
$this->commentRangeStart = $value;
|
||||||
$this->commentRangeStart->setStartElement($this);
|
$this->commentRangeStart->setStartElement($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,14 +311,13 @@ abstract class AbstractElement
|
||||||
* Set comment end
|
* Set comment end
|
||||||
*
|
*
|
||||||
* @param Comment $value
|
* @param Comment $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setCommentRangeEnd(Comment $value)
|
public function setCommentRangeEnd(Comment $value)
|
||||||
{
|
{
|
||||||
if ($this instanceof Comment) {
|
if ($this instanceof Comment) {
|
||||||
throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
|
throw new \InvalidArgumentException('Cannot set a Comment on a Comment');
|
||||||
}
|
}
|
||||||
$this->commentRangeEnd= $value;
|
$this->commentRangeEnd = $value;
|
||||||
$this->commentRangeEnd->setEndElement($this);
|
$this->commentRangeEnd->setEndElement($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,7 +327,6 @@ abstract class AbstractElement
|
||||||
* Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
|
* Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setParentContainer(AbstractElement $container)
|
public function setParentContainer(AbstractElement $container)
|
||||||
{
|
{
|
||||||
|
|
@ -363,8 +355,6 @@ abstract class AbstractElement
|
||||||
*
|
*
|
||||||
* - Image element needs to be passed to Media object
|
* - Image element needs to be passed to Media object
|
||||||
* - Icon needs to be set for Object element
|
* - Icon needs to be set for Object element
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setMediaRelation()
|
private function setMediaRelation()
|
||||||
{
|
{
|
||||||
|
|
@ -391,8 +381,6 @@ abstract class AbstractElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set relation Id for elements that will be registered in the Collection subnamespaces.
|
* Set relation Id for elements that will be registered in the Collection subnamespaces.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setCollectionRelation()
|
private function setCollectionRelation()
|
||||||
{
|
{
|
||||||
|
|
@ -411,7 +399,7 @@ abstract class AbstractElement
|
||||||
*/
|
*/
|
||||||
public function isInSection()
|
public function isInSection()
|
||||||
{
|
{
|
||||||
return ($this->docPart == 'Section');
|
return $this->docPart == 'Section';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -441,9 +429,8 @@ abstract class AbstractElement
|
||||||
* @param array $enum
|
* @param array $enum
|
||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
*
|
*
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @todo Merge with the same method in AbstractStyle
|
* @todo Merge with the same method in AbstractStyle
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,6 @@ class Chart extends AbstractElement
|
||||||
* Set type.
|
* Set type.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setType($value)
|
public function setType($value)
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +95,6 @@ class Chart extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param array $categories
|
* @param array $categories
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function addSeries($categories, $values)
|
public function addSeries($categories, $values)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element;
|
||||||
* Field element
|
* Field element
|
||||||
*
|
*
|
||||||
* @since 0.11.0
|
* @since 0.11.0
|
||||||
* @link http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html
|
* @see http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html
|
||||||
*/
|
*/
|
||||||
class Field extends AbstractElement
|
class Field extends AbstractElement
|
||||||
{
|
{
|
||||||
|
|
@ -32,36 +32,36 @@ class Field extends AbstractElement
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fieldsArray = array(
|
protected $fieldsArray = array(
|
||||||
'PAGE'=>array(
|
'PAGE' => array(
|
||||||
'properties'=>array(
|
'properties' => array(
|
||||||
'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
|
'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
|
||||||
),
|
),
|
||||||
'options'=>array('PreserveFormat')
|
'options' => array('PreserveFormat'),
|
||||||
),
|
),
|
||||||
'NUMPAGES'=>array(
|
'NUMPAGES' => array(
|
||||||
'properties'=>array(
|
'properties' => array(
|
||||||
'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText',
|
'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText',
|
||||||
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'),
|
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper', ),
|
||||||
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%')
|
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%'),
|
||||||
),
|
),
|
||||||
'options'=>array('PreserveFormat')
|
'options' => array('PreserveFormat'),
|
||||||
),
|
),
|
||||||
'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-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd',
|
||||||
'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',
|
'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',
|
||||||
'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss')
|
'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', ),
|
||||||
),
|
),
|
||||||
'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat')
|
'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'),
|
||||||
),
|
),
|
||||||
'XE'=>array(
|
'XE' => array(
|
||||||
'properties' => array(),
|
'properties' => array(),
|
||||||
'options' => array('Bold', 'Italic')
|
'options' => array('Bold', 'Italic'),
|
||||||
),
|
),
|
||||||
'INDEX'=>array(
|
'INDEX' => array(
|
||||||
'properties' => array(),
|
'properties' => array(),
|
||||||
'options' => array('PreserveFormat')
|
'options' => array('PreserveFormat'),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,9 +113,8 @@ class Field extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setType($type = null)
|
public function setType($type = null)
|
||||||
{
|
{
|
||||||
|
|
@ -126,6 +125,7 @@ class Field extends AbstractElement
|
||||||
throw new \InvalidArgumentException("Invalid type '$type'");
|
throw new \InvalidArgumentException("Invalid type '$type'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,9 +144,8 @@ class Field extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
*
|
*
|
||||||
* @return self
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setProperties($properties = array())
|
public function setProperties($properties = array())
|
||||||
{
|
{
|
||||||
|
|
@ -158,6 +157,7 @@ class Field extends AbstractElement
|
||||||
}
|
}
|
||||||
$this->properties = array_merge($this->properties, $properties);
|
$this->properties = array_merge($this->properties, $properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->properties;
|
return $this->properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,9 +176,8 @@ class Field extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*
|
*
|
||||||
* @return self
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setOptions($options = array())
|
public function setOptions($options = array())
|
||||||
{
|
{
|
||||||
|
|
@ -190,6 +189,7 @@ class Field extends AbstractElement
|
||||||
}
|
}
|
||||||
$this->options = array_merge($this->options, $options);
|
$this->options = array_merge($this->options, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->options;
|
return $this->options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,9 +208,8 @@ class Field extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string | TextRun $text
|
* @param string | TextRun $text
|
||||||
*
|
*
|
||||||
* @return string | TextRun
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
* @return string | TextRun
|
||||||
*/
|
*/
|
||||||
public function setText($text)
|
public function setText($text)
|
||||||
{
|
{
|
||||||
|
|
@ -218,9 +217,10 @@ class Field extends AbstractElement
|
||||||
if (is_string($text) || $text instanceof TextRun) {
|
if (is_string($text) || $text instanceof TextRun) {
|
||||||
$this->text = $text;
|
$this->text = $text;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException("Invalid text");
|
throw new \InvalidArgumentException('Invalid text');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->text;
|
return $this->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -26,11 +26,11 @@ class Footer extends AbstractContainer
|
||||||
* Header/footer types constants
|
* Header/footer types constants
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @link http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type
|
* @see http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type
|
||||||
*/
|
*/
|
||||||
const AUTO = 'default'; // default and odd pages
|
const AUTO = 'default'; // default and odd pages
|
||||||
const FIRST = 'first';
|
const FIRST = 'first';
|
||||||
const EVEN = 'even';
|
const EVEN = 'even';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Container type
|
* @var string Container type
|
||||||
|
|
@ -64,7 +64,6 @@ class Footer extends AbstractContainer
|
||||||
* @since 0.10.0
|
* @since 0.10.0
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setType($value = self::AUTO)
|
public function setType($value = self::AUTO)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element;
|
||||||
* Form field element
|
* Form field element
|
||||||
*
|
*
|
||||||
* @since 0.12.0
|
* @since 0.12.0
|
||||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html
|
* @see http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html
|
||||||
*/
|
*/
|
||||||
class FormField extends Text
|
class FormField extends Text
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,7 +61,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Is watermark
|
* Is watermark
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $watermark;
|
private $watermark;
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Is memory image
|
* Is memory image
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $memoryImage;
|
private $memoryImage;
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Image media index
|
* Image media index
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $mediaIndex;
|
private $mediaIndex;
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ class Image extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @param boolean $watermark
|
* @param bool $watermark
|
||||||
*
|
*
|
||||||
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
||||||
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
||||||
|
|
@ -183,7 +183,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get is watermark
|
* Get is watermark
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isWatermark()
|
public function isWatermark()
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +193,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Set is watermark
|
* Set is watermark
|
||||||
*
|
*
|
||||||
* @param boolean $value
|
* @param bool $value
|
||||||
*/
|
*/
|
||||||
public function setIsWatermark($value)
|
public function setIsWatermark($value)
|
||||||
{
|
{
|
||||||
|
|
@ -243,7 +243,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get is memory image
|
* Get is memory image
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isMemImage()
|
public function isMemImage()
|
||||||
{
|
{
|
||||||
|
|
@ -264,7 +264,6 @@ class Image extends AbstractElement
|
||||||
* Set target file name.
|
* Set target file name.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setTarget($value)
|
public function setTarget($value)
|
||||||
{
|
{
|
||||||
|
|
@ -274,7 +273,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get media index
|
* Get media index
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getMediaIndex()
|
public function getMediaIndex()
|
||||||
{
|
{
|
||||||
|
|
@ -284,8 +283,7 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Set media index.
|
* Set media index.
|
||||||
*
|
*
|
||||||
* @param integer $value
|
* @param int $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setMediaIndex($value)
|
public function setMediaIndex($value)
|
||||||
{
|
{
|
||||||
|
|
@ -368,8 +366,6 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Check memory image, supported type, image functions, and proportional width/height.
|
* Check memory image, supported type, image functions, and proportional width/height.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
||||||
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
||||||
*/
|
*/
|
||||||
|
|
@ -380,7 +376,7 @@ class Image extends AbstractElement
|
||||||
// Check image data
|
// Check image data
|
||||||
if ($this->sourceType == self::SOURCE_ARCHIVE) {
|
if ($this->sourceType == self::SOURCE_ARCHIVE) {
|
||||||
$imageData = $this->getArchiveImageSize($this->source);
|
$imageData = $this->getArchiveImageSize($this->source);
|
||||||
} else if ($this->sourceType == self::SOURCE_STRING) {
|
} elseif ($this->sourceType == self::SOURCE_STRING) {
|
||||||
$imageData = $this->getStringImageSize($this->source);
|
$imageData = $this->getStringImageSize($this->source);
|
||||||
} else {
|
} else {
|
||||||
$imageData = @getimagesize($this->source);
|
$imageData = @getimagesize($this->source);
|
||||||
|
|
@ -407,8 +403,6 @@ class Image extends AbstractElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set source type.
|
* Set source type.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setSourceType()
|
private function setSourceType()
|
||||||
{
|
{
|
||||||
|
|
@ -443,9 +437,9 @@ class Image extends AbstractElement
|
||||||
*
|
*
|
||||||
* @param string $source
|
* @param string $source
|
||||||
*
|
*
|
||||||
* @return array|null
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
|
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
private function getArchiveImageSize($source)
|
private function getArchiveImageSize($source)
|
||||||
{
|
{
|
||||||
|
|
@ -483,19 +477,19 @@ class Image extends AbstractElement
|
||||||
*/
|
*/
|
||||||
private function getStringImageSize($source)
|
private function getStringImageSize($source)
|
||||||
{
|
{
|
||||||
|
$result = false;
|
||||||
if (!function_exists('getimagesizefromstring')) {
|
if (!function_exists('getimagesizefromstring')) {
|
||||||
$uri = 'data://application/octet-stream;base64,' . base64_encode($source);
|
$uri = 'data://application/octet-stream;base64,' . base64_encode($source);
|
||||||
return @getimagesize($uri);
|
$result = @getimagesize($uri);
|
||||||
} else {
|
} else {
|
||||||
return @getimagesizefromstring($source);
|
$result = @getimagesizefromstring($source);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set image functions and extensions.
|
* Set image functions and extensions.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setFunctions()
|
private function setFunctions()
|
||||||
{
|
{
|
||||||
|
|
@ -530,9 +524,8 @@ class Image extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Set proportional width/height if one dimension not available.
|
* Set proportional width/height if one dimension not available.
|
||||||
*
|
*
|
||||||
* @param integer $actualWidth
|
* @param int $actualWidth
|
||||||
* @param integer $actualHeight
|
* @param int $actualHeight
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setProportionalSize($actualWidth, $actualHeight)
|
private function setProportionalSize($actualWidth, $actualHeight)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -75,6 +75,7 @@ class Link extends AbstractElement
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param mixed $fontStyle
|
* @param mixed $fontStyle
|
||||||
* @param mixed $paragraphStyle
|
* @param mixed $paragraphStyle
|
||||||
|
* @param bool $internal
|
||||||
*/
|
*/
|
||||||
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
|
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -74,10 +74,10 @@ class ListItemRun extends TextRun
|
||||||
return $this->style;
|
return $this->style;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ListItem depth.
|
* Get ListItem depth.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDepth()
|
public function getDepth()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -84,9 +84,9 @@ class Object extends AbstractElement
|
||||||
$this->icon = realpath(__DIR__ . "/../resources/{$ext}.png");
|
$this->icon = realpath(__DIR__ . "/../resources/{$ext}.png");
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} else {
|
|
||||||
throw new InvalidObjectException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new InvalidObjectException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,7 +133,6 @@ class Object extends AbstractElement
|
||||||
* Set Image Relation ID.
|
* Set Image Relation ID.
|
||||||
*
|
*
|
||||||
* @param int $rId
|
* @param int $rId
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setImageRelationId($rId)
|
public function setImageRelationId($rId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -47,7 +47,6 @@ class PreserveText extends AbstractElement
|
||||||
*/
|
*/
|
||||||
private $paragraphStyle;
|
private $paragraphStyle;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Preserve Text Element
|
* Create a new Preserve Text Element
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -73,7 +73,6 @@ class Section extends AbstractContainer
|
||||||
* Set section style.
|
* Set section style.
|
||||||
*
|
*
|
||||||
* @param array $style
|
* @param array $style
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setStyle($style = null)
|
public function setStyle($style = null)
|
||||||
{
|
{
|
||||||
|
|
@ -172,7 +171,7 @@ class Section extends AbstractContainer
|
||||||
* If any of the Header instances have a type of Header::FIRST then this method returns true.
|
* If any of the Header instances have a type of Header::FIRST then this method returns true.
|
||||||
* False otherwise.
|
* False otherwise.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasDifferentFirstPage()
|
public function hasDifferentFirstPage()
|
||||||
{
|
{
|
||||||
|
|
@ -186,6 +185,7 @@ class Section extends AbstractContainer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,11 +195,11 @@ class Section extends AbstractContainer
|
||||||
* @since 0.10.0
|
* @since 0.10.0
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param boolean $header
|
* @param bool $header
|
||||||
*
|
|
||||||
* @return Header|Footer
|
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
*
|
||||||
|
* @return Header|Footer
|
||||||
*/
|
*/
|
||||||
private function addHeaderFooter($type = Header::AUTO, $header = true)
|
private function addHeaderFooter($type = Header::AUTO, $header = true)
|
||||||
{
|
{
|
||||||
|
|
@ -215,10 +215,10 @@ class Section extends AbstractContainer
|
||||||
$container->setPhpWord($this->phpWord);
|
$container->setPhpWord($this->phpWord);
|
||||||
|
|
||||||
$collection[$index] = $container;
|
$collection[$index] = $container;
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
} else {
|
|
||||||
throw new \Exception('Invalid header/footer type.');
|
|
||||||
}
|
}
|
||||||
|
throw new \Exception('Invalid header/footer type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -290,8 +290,8 @@ class Section extends AbstractContainer
|
||||||
{
|
{
|
||||||
if (empty($this->footers)) {
|
if (empty($this->footers)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
return $this->footers[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->footers[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -54,14 +54,13 @@ class TOC extends AbstractElement
|
||||||
*/
|
*/
|
||||||
private $maxDepth = 9;
|
private $maxDepth = 9;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Table-of-Contents Element
|
* Create a new Table-of-Contents Element
|
||||||
*
|
*
|
||||||
* @param mixed $fontStyle
|
* @param mixed $fontStyle
|
||||||
* @param array $tocStyle
|
* @param array $tocStyle
|
||||||
* @param integer $minDepth
|
* @param int $minDepth
|
||||||
* @param integer $maxDepth
|
* @param int $maxDepth
|
||||||
*/
|
*/
|
||||||
public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
|
public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +131,6 @@ class TOC extends AbstractElement
|
||||||
* Set max depth.
|
* Set max depth.
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setMaxDepth($value)
|
public function setMaxDepth($value)
|
||||||
{
|
{
|
||||||
|
|
@ -153,7 +151,6 @@ class TOC extends AbstractElement
|
||||||
* Set min depth.
|
* Set min depth.
|
||||||
*
|
*
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setMinDepth($value)
|
public function setMinDepth($value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -121,7 +121,6 @@ class Table extends AbstractElement
|
||||||
* Set table width.
|
* Set table width.
|
||||||
*
|
*
|
||||||
* @param int $width
|
* @param int $width
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setWidth($width)
|
public function setWidth($width)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -105,12 +105,12 @@ class Text extends AbstractElement
|
||||||
public function setParagraphStyle($style = null)
|
public function setParagraphStyle($style = null)
|
||||||
{
|
{
|
||||||
if (is_array($style)) {
|
if (is_array($style)) {
|
||||||
$this->paragraphStyle = new Paragraph;
|
$this->paragraphStyle = new Paragraph();
|
||||||
$this->paragraphStyle->setStyleByArray($style);
|
$this->paragraphStyle->setStyleByArray($style);
|
||||||
} elseif ($style instanceof Paragraph) {
|
} elseif ($style instanceof Paragraph) {
|
||||||
$this->paragraphStyle = $style;
|
$this->paragraphStyle = $style;
|
||||||
} elseif (null === $style) {
|
} elseif (null === $style) {
|
||||||
$this->paragraphStyle = new Paragraph;
|
$this->paragraphStyle = new Paragraph();
|
||||||
} else {
|
} else {
|
||||||
$this->paragraphStyle = $style;
|
$this->paragraphStyle = $style;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -74,6 +74,7 @@ class TextBreak extends AbstractElement
|
||||||
$this->fontStyle = $style;
|
$this->fontStyle = $style;
|
||||||
$this->setParagraphStyle($paragraphStyle);
|
$this->setParagraphStyle($paragraphStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->fontStyle;
|
return $this->fontStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,13 +97,14 @@ class TextBreak extends AbstractElement
|
||||||
public function setParagraphStyle($style = null)
|
public function setParagraphStyle($style = null)
|
||||||
{
|
{
|
||||||
if (is_array($style)) {
|
if (is_array($style)) {
|
||||||
$this->paragraphStyle = new Paragraph;
|
$this->paragraphStyle = new Paragraph();
|
||||||
$this->paragraphStyle->setStyleByArray($style);
|
$this->paragraphStyle->setStyleByArray($style);
|
||||||
} elseif ($style instanceof Paragraph) {
|
} elseif ($style instanceof Paragraph) {
|
||||||
$this->paragraphStyle = $style;
|
$this->paragraphStyle = $style;
|
||||||
} else {
|
} else {
|
||||||
$this->paragraphStyle = $style;
|
$this->paragraphStyle = $style;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->paragraphStyle;
|
return $this->paragraphStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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 Title extends AbstractElement
|
||||||
/**
|
/**
|
||||||
* Get depth
|
* Get depth
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDepth()
|
public function getDepth()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -49,9 +49,9 @@ class TrackChange extends AbstractContainer
|
||||||
*/
|
*/
|
||||||
public function __construct($author, \DateTime $date)
|
public function __construct($author, \DateTime $date)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->author = $author;
|
$this->author = $author;
|
||||||
$this->date = $date;
|
$this->date = $date;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,9 +28,9 @@ class Rtf extends AbstractEscaper
|
||||||
{
|
{
|
||||||
if (20 > $code || $code >= 80) {
|
if (20 > $code || $code >= 80) {
|
||||||
return '{\u' . $code . '}';
|
return '{\u' . $code . '}';
|
||||||
} else {
|
|
||||||
return chr($code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return chr($code);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function escapeMultibyteCharacter($code)
|
protected function escapeMultibyteCharacter($code)
|
||||||
|
|
@ -40,6 +40,7 @@ class Rtf extends AbstractEscaper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
|
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||||
|
* @param string $input
|
||||||
*/
|
*/
|
||||||
protected function escapeSingleValue($input)
|
protected function escapeSingleValue($input)
|
||||||
{
|
{
|
||||||
|
|
@ -57,9 +58,9 @@ class Rtf extends AbstractEscaper
|
||||||
if (0 == count($bytes)) {
|
if (0 == count($bytes)) {
|
||||||
if ($asciiCode < 224) {
|
if ($asciiCode < 224) {
|
||||||
$numberOfBytes = 2;
|
$numberOfBytes = 2;
|
||||||
} else if ($asciiCode < 240) {
|
} elseif ($asciiCode < 240) {
|
||||||
$numberOfBytes = 3;
|
$numberOfBytes = 3;
|
||||||
} else if ($asciiCode < 248) {
|
} elseif ($asciiCode < 248) {
|
||||||
$numberOfBytes = 4;
|
$numberOfBytes = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -23,10 +23,10 @@ namespace PhpOffice\PhpWord\Exception;
|
||||||
final class CopyFileException extends Exception
|
final class CopyFileException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $source The fully qualified source file name.
|
* @param string $source The fully qualified source file name
|
||||||
* @param string $destination The fully qualified destination file name.
|
* @param string $destination The fully qualified destination file name
|
||||||
* @param integer $code The user defined exception code.
|
* @param int $code The user defined exception code
|
||||||
* @param \Exception $previous The previous exception used for the exception chaining.
|
* @param \Exception $previous The previous exception used for the exception chaining
|
||||||
*/
|
*/
|
||||||
final public function __construct($source, $destination, $code = 0, \Exception $previous = null)
|
final public function __construct($source, $destination, $code = 0, \Exception $previous = null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@ namespace PhpOffice\PhpWord\Exception;
|
||||||
final class CreateTemporaryFileException extends Exception
|
final class CreateTemporaryFileException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param integer $code The user defined exception code.
|
* @param int $code The user defined exception code
|
||||||
* @param \Exception $previous The previous exception used for the exception chaining.
|
* @param \Exception $previous The previous exception used for the exception chaining
|
||||||
*/
|
*/
|
||||||
final public function __construct($code = 0, \Exception $previous = null)
|
final public function __construct($code = 0, \Exception $previous = null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,9 +29,9 @@ abstract class IOFactory
|
||||||
* @param PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return WriterInterface
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||||
|
*
|
||||||
|
* @return WriterInterface
|
||||||
*/
|
*/
|
||||||
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
|
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
|
||||||
{
|
{
|
||||||
|
|
@ -49,9 +49,9 @@ abstract class IOFactory
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return ReaderInterface
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @return ReaderInterface
|
||||||
*/
|
*/
|
||||||
public static function createReader($name = 'Word2007')
|
public static function createReader($name = 'Word2007')
|
||||||
{
|
{
|
||||||
|
|
@ -65,19 +65,19 @@ abstract class IOFactory
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
*
|
*
|
||||||
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||||
|
*
|
||||||
|
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
|
||||||
*/
|
*/
|
||||||
private static function createObject($type, $name, $phpWord = null)
|
private static function createObject($type, $name, $phpWord = null)
|
||||||
{
|
{
|
||||||
$class = "PhpOffice\\PhpWord\\{$type}\\{$name}";
|
$class = "PhpOffice\\PhpWord\\{$type}\\{$name}";
|
||||||
if (class_exists($class) && self::isConcreteClass($class)) {
|
if (class_exists($class) && self::isConcreteClass($class)) {
|
||||||
return new $class($phpWord);
|
return new $class($phpWord);
|
||||||
} else {
|
|
||||||
throw new Exception("\"{$name}\" is not a valid {$type}.");
|
|
||||||
}
|
}
|
||||||
|
throw new Exception("\"{$name}\" is not a valid {$type}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PhpWord from file
|
* Loads PhpWord from file
|
||||||
*
|
*
|
||||||
|
|
@ -89,8 +89,10 @@ abstract class IOFactory
|
||||||
{
|
{
|
||||||
/** @var \PhpOffice\PhpWord\Reader\ReaderInterface $reader */
|
/** @var \PhpOffice\PhpWord\Reader\ReaderInterface $reader */
|
||||||
$reader = self::createReader($readerName);
|
$reader = self::createReader($readerName);
|
||||||
|
|
||||||
return $reader->load($filename);
|
return $reader->load($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if it's a concrete class (not abstract nor interface)
|
* Check if it's a concrete class (not abstract nor interface)
|
||||||
*
|
*
|
||||||
|
|
@ -100,6 +102,7 @@ abstract class IOFactory
|
||||||
private static function isConcreteClass($class)
|
private static function isConcreteClass($class)
|
||||||
{
|
{
|
||||||
$reflection = new \ReflectionClass($class);
|
$reflection = new \ReflectionClass($class);
|
||||||
|
|
||||||
return !$reflection->isAbstract() && !$reflection->isInterface();
|
return !$reflection->isAbstract() && !$reflection->isInterface();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,9 +43,9 @@ class Media
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||||
*
|
*
|
||||||
* @return integer
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function addElement($container, $mediaType, $source, Image $image = null)
|
public static function addElement($container, $mediaType, $source, Image $image = null)
|
||||||
{
|
{
|
||||||
|
|
@ -83,12 +83,10 @@ class Media
|
||||||
$image->setTarget($target);
|
$image->setTarget($target);
|
||||||
$image->setMediaIndex($mediaTypeCount);
|
$image->setMediaIndex($mediaTypeCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
case 'object':
|
case 'object':
|
||||||
$target = "{$container}_oleObject{$mediaTypeCount}.bin";
|
$target = "{$container}_oleObject{$mediaTypeCount}.bin";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
case 'link':
|
case 'link':
|
||||||
$target = $source;
|
$target = $source;
|
||||||
|
|
@ -100,15 +98,17 @@ class Media
|
||||||
$mediaData['type'] = $mediaType;
|
$mediaData['type'] = $mediaType;
|
||||||
$mediaData['rID'] = $rId;
|
$mediaData['rID'] = $rId;
|
||||||
self::$elements[$container][$mediaId] = $mediaData;
|
self::$elements[$container][$mediaId] = $mediaData;
|
||||||
|
|
||||||
return $rId;
|
return $rId;
|
||||||
} else {
|
|
||||||
$mediaData = self::$elements[$container][$mediaId];
|
|
||||||
if (!is_null($image)) {
|
|
||||||
$image->setTarget($mediaData['target']);
|
|
||||||
$image->setMediaIndex($mediaData['mediaIndex']);
|
|
||||||
}
|
|
||||||
return $mediaData['rID'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mediaData = self::$elements[$container][$mediaId];
|
||||||
|
if (!is_null($image)) {
|
||||||
|
$image->setTarget($mediaData['target']);
|
||||||
|
$image->setMediaIndex($mediaData['mediaIndex']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mediaData['rID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -116,7 +116,7 @@ class Media
|
||||||
*
|
*
|
||||||
* @param string $container section|headerx|footerx|footnote|endnote
|
* @param string $container section|headerx|footerx|footnote|endnote
|
||||||
* @param string $mediaType image|object|link
|
* @param string $mediaType image|object|link
|
||||||
* @return integer
|
* @return int
|
||||||
* @since 0.10.0
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
public static function countElements($container, $mediaType = null)
|
public static function countElements($container, $mediaType = null)
|
||||||
|
|
@ -157,13 +157,15 @@ class Media
|
||||||
$elements[$key] = $val;
|
$elements[$key] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $elements;
|
return $elements;
|
||||||
} else {
|
|
||||||
if (!isset(self::$elements[$container])) {
|
|
||||||
return $elements;
|
|
||||||
}
|
|
||||||
return self::getElementsByType($container, $type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$elements[$container])) {
|
||||||
|
return $elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::getElementsByType($container, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -208,7 +210,7 @@ class Media
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -224,7 +226,7 @@ class Media
|
||||||
*
|
*
|
||||||
* @param string $linkSrc
|
* @param string $linkSrc
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -256,7 +258,7 @@ class Media
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -270,11 +272,11 @@ class Media
|
||||||
*
|
*
|
||||||
* @deprecated 0.10.0
|
* @deprecated 0.10.0
|
||||||
*
|
*
|
||||||
* @param integer $headerCount
|
* @param int $headerCount
|
||||||
* @param string $src
|
* @param string $src
|
||||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -290,7 +292,7 @@ class Media
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -318,11 +320,11 @@ class Media
|
||||||
*
|
*
|
||||||
* @deprecated 0.10.0
|
* @deprecated 0.10.0
|
||||||
*
|
*
|
||||||
* @param integer $footerCount
|
* @param int $footerCount
|
||||||
* @param string $src
|
* @param string $src
|
||||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
@ -338,7 +340,7 @@ class Media
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata;
|
||||||
* Compatibility setting class
|
* Compatibility setting class
|
||||||
*
|
*
|
||||||
* @since 0.12.0
|
* @since 0.12.0
|
||||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html
|
* @see http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html
|
||||||
*/
|
*/
|
||||||
class Compatibility
|
class Compatibility
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +33,7 @@ class Compatibility
|
||||||
* 15 = 2013
|
* 15 = 2013
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
* @link http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx
|
* @see http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private $ooxmlVersion = 12;
|
private $ooxmlVersion = 12;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -119,17 +119,17 @@ class DocInfo
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->creator = '';
|
$this->creator = '';
|
||||||
$this->lastModifiedBy = $this->creator;
|
$this->lastModifiedBy = $this->creator;
|
||||||
$this->created = time();
|
$this->created = time();
|
||||||
$this->modified = time();
|
$this->modified = time();
|
||||||
$this->title = '';
|
$this->title = '';
|
||||||
$this->subject = '';
|
$this->subject = '';
|
||||||
$this->description = '';
|
$this->description = '';
|
||||||
$this->keywords = '';
|
$this->keywords = '';
|
||||||
$this->category = '';
|
$this->category = '';
|
||||||
$this->company = '';
|
$this->company = '';
|
||||||
$this->manager = '';
|
$this->manager = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -399,7 +399,7 @@ class DocInfo
|
||||||
* Check if a Custom Property is defined
|
* Check if a Custom Property is defined
|
||||||
*
|
*
|
||||||
* @param string $propertyName
|
* @param string $propertyName
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isCustomPropertySet($propertyName)
|
public function isCustomPropertySet($propertyName)
|
||||||
{
|
{
|
||||||
|
|
@ -416,9 +416,9 @@ class DocInfo
|
||||||
{
|
{
|
||||||
if ($this->isCustomPropertySet($propertyName)) {
|
if ($this->isCustomPropertySet($propertyName)) {
|
||||||
return $this->customProperties[$propertyName]['value'];
|
return $this->customProperties[$propertyName]['value'];
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -431,9 +431,9 @@ class DocInfo
|
||||||
{
|
{
|
||||||
if ($this->isCustomPropertySet($propertyName)) {
|
if ($this->isCustomPropertySet($propertyName)) {
|
||||||
return $this->customProperties[$propertyName]['type'];
|
return $this->customProperties[$propertyName]['type'];
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -456,7 +456,7 @@ class DocInfo
|
||||||
self::PROPERTY_TYPE_FLOAT,
|
self::PROPERTY_TYPE_FLOAT,
|
||||||
self::PROPERTY_TYPE_STRING,
|
self::PROPERTY_TYPE_STRING,
|
||||||
self::PROPERTY_TYPE_DATE,
|
self::PROPERTY_TYPE_DATE,
|
||||||
self::PROPERTY_TYPE_BOOLEAN
|
self::PROPERTY_TYPE_BOOLEAN,
|
||||||
);
|
);
|
||||||
if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) {
|
if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) {
|
||||||
if ($propertyValue === null) {
|
if ($propertyValue === null) {
|
||||||
|
|
@ -474,8 +474,9 @@ class DocInfo
|
||||||
|
|
||||||
$this->customProperties[$propertyName] = array(
|
$this->customProperties[$propertyName] = array(
|
||||||
'value' => $propertyValue,
|
'value' => $propertyValue,
|
||||||
'type' => $propertyType
|
'type' => $propertyType,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata;
|
||||||
* Document protection class
|
* Document protection class
|
||||||
*
|
*
|
||||||
* @since 0.12.0
|
* @since 0.12.0
|
||||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html
|
* @see http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html
|
||||||
* @todo Password!
|
* @todo Password!
|
||||||
*/
|
*/
|
||||||
class Protection
|
class Protection
|
||||||
|
|
@ -30,7 +30,7 @@ class Protection
|
||||||
* Editing restriction readOnly|comments|trackedChanges|forms
|
* Editing restriction readOnly|comments|trackedChanges|forms
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @link http://www.datypic.com/sc/ooxml/a-w_edit-1.html
|
* @see http://www.datypic.com/sc/ooxml/a-w_edit-1.html
|
||||||
*/
|
*/
|
||||||
private $editing;
|
private $editing;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,30 +10,30 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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\ComplexType\ProofState;
|
use PhpOffice\PhpWord\ComplexType\ProofState;
|
||||||
use PhpOffice\PhpWord\SimpleType\Zoom;
|
|
||||||
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
|
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
|
||||||
|
use PhpOffice\PhpWord\SimpleType\Zoom;
|
||||||
use PhpOffice\PhpWord\Style\Language;
|
use PhpOffice\PhpWord\Style\Language;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting class
|
* Setting class
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html
|
* @see http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html
|
||||||
*/
|
*/
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magnification Setting
|
* Magnification Setting
|
||||||
*
|
*
|
||||||
* @link http://www.datypic.com/sc/ooxml/e-w_zoom-1.html
|
* @see http://www.datypic.com/sc/ooxml/e-w_zoom-1.html
|
||||||
* @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom
|
* @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom
|
||||||
*/
|
*/
|
||||||
private $zoom = 100;
|
private $zoom = 100;
|
||||||
|
|
@ -41,14 +41,14 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Hide spelling errors
|
* Hide spelling errors
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $hideSpellingErrors = false;
|
private $hideSpellingErrors = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide grammatical errors
|
* Hide grammatical errors
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $hideGrammaticalErrors = false;
|
private $hideGrammaticalErrors = false;
|
||||||
|
|
||||||
|
|
@ -62,21 +62,21 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Track Revisions to Document
|
* Track Revisions to Document
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $trackRevisions = false;
|
private $trackRevisions = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do Not Use Move Syntax When Tracking Revisions
|
* Do Not Use Move Syntax When Tracking Revisions
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $doNotTrackMoves = false;
|
private $doNotTrackMoves = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do Not Track Formatting Revisions When Tracking Revisions
|
* Do Not Track Formatting Revisions When Tracking Revisions
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $doNotTrackFormatting = false;
|
private $doNotTrackFormatting = false;
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ class Settings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme Font Languages
|
* Theme Font Languages
|
||||||
*
|
*
|
||||||
* @var Language
|
* @var Language
|
||||||
*/
|
*/
|
||||||
private $themeFontLang;
|
private $themeFontLang;
|
||||||
|
|
@ -123,6 +123,7 @@ class Settings
|
||||||
if ($this->documentProtection == null) {
|
if ($this->documentProtection == null) {
|
||||||
$this->documentProtection = new Protection();
|
$this->documentProtection = new Protection();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->documentProtection;
|
return $this->documentProtection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,6 +143,7 @@ class Settings
|
||||||
if ($this->proofState == null) {
|
if ($this->proofState == null) {
|
||||||
$this->proofState = new ProofState();
|
$this->proofState = new ProofState();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->proofState;
|
return $this->proofState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +158,7 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Are spelling errors hidden
|
* Are spelling errors hidden
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasHideSpellingErrors()
|
public function hasHideSpellingErrors()
|
||||||
{
|
{
|
||||||
|
|
@ -166,7 +168,7 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Hide spelling errors
|
* Hide spelling errors
|
||||||
*
|
*
|
||||||
* @param boolean $hideSpellingErrors
|
* @param bool $hideSpellingErrors
|
||||||
*/
|
*/
|
||||||
public function setHideSpellingErrors($hideSpellingErrors)
|
public function setHideSpellingErrors($hideSpellingErrors)
|
||||||
{
|
{
|
||||||
|
|
@ -176,7 +178,7 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Are grammatical errors hidden
|
* Are grammatical errors hidden
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasHideGrammaticalErrors()
|
public function hasHideGrammaticalErrors()
|
||||||
{
|
{
|
||||||
|
|
@ -186,7 +188,7 @@ class Settings
|
||||||
/**
|
/**
|
||||||
* Hide grammatical errors
|
* Hide grammatical errors
|
||||||
*
|
*
|
||||||
* @param boolean $hideGrammaticalErrors
|
* @param bool $hideGrammaticalErrors
|
||||||
*/
|
*/
|
||||||
public function setHideGrammaticalErrors($hideGrammaticalErrors)
|
public function setHideGrammaticalErrors($hideGrammaticalErrors)
|
||||||
{
|
{
|
||||||
|
|
@ -194,7 +196,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasEvenAndOddHeaders()
|
public function hasEvenAndOddHeaders()
|
||||||
{
|
{
|
||||||
|
|
@ -202,7 +204,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $evenAndOddHeaders
|
* @param bool $evenAndOddHeaders
|
||||||
*/
|
*/
|
||||||
public function setEvenAndOddHeaders($evenAndOddHeaders)
|
public function setEvenAndOddHeaders($evenAndOddHeaders)
|
||||||
{
|
{
|
||||||
|
|
@ -230,7 +232,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasTrackRevisions()
|
public function hasTrackRevisions()
|
||||||
{
|
{
|
||||||
|
|
@ -238,7 +240,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $trackRevisions
|
* @param bool $trackRevisions
|
||||||
*/
|
*/
|
||||||
public function setTrackRevisions($trackRevisions)
|
public function setTrackRevisions($trackRevisions)
|
||||||
{
|
{
|
||||||
|
|
@ -246,7 +248,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasDoNotTrackMoves()
|
public function hasDoNotTrackMoves()
|
||||||
{
|
{
|
||||||
|
|
@ -254,7 +256,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $doNotTrackMoves
|
* @param bool $doNotTrackMoves
|
||||||
*/
|
*/
|
||||||
public function setDoNotTrackMoves($doNotTrackMoves)
|
public function setDoNotTrackMoves($doNotTrackMoves)
|
||||||
{
|
{
|
||||||
|
|
@ -262,7 +264,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasDoNotTrackFormatting()
|
public function hasDoNotTrackFormatting()
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +272,7 @@ class Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $doNotTrackFormatting
|
* @param bool $doNotTrackFormatting
|
||||||
*/
|
*/
|
||||||
public function setDoNotTrackFormatting($doNotTrackFormatting)
|
public function setDoNotTrackFormatting($doNotTrackFormatting)
|
||||||
{
|
{
|
||||||
|
|
@ -301,7 +303,7 @@ class Settings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Language
|
* Returns the Language
|
||||||
*
|
*
|
||||||
* @return Language
|
* @return Language
|
||||||
*/
|
*/
|
||||||
public function getThemeFontLang()
|
public function getThemeFontLang()
|
||||||
|
|
@ -311,7 +313,7 @@ class Settings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the Language for this document
|
* sets the Language for this document
|
||||||
*
|
*
|
||||||
* @param Language $themeFontLang
|
* @param Language $themeFontLang
|
||||||
*/
|
*/
|
||||||
public function setThemeFontLang($themeFontLang)
|
public function setThemeFontLang($themeFontLang)
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -108,9 +108,9 @@ class PhpWord
|
||||||
* @param mixed $function
|
* @param mixed $function
|
||||||
* @param mixed $args
|
* @param mixed $args
|
||||||
*
|
*
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @throws \BadMethodCallException
|
* @throws \BadMethodCallException
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __call($function, $args)
|
public function __call($function, $args)
|
||||||
{
|
{
|
||||||
|
|
@ -241,7 +241,6 @@ class PhpWord
|
||||||
* Set default font name.
|
* Set default font name.
|
||||||
*
|
*
|
||||||
* @param string $fontName
|
* @param string $fontName
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setDefaultFontName($fontName)
|
public function setDefaultFontName($fontName)
|
||||||
{
|
{
|
||||||
|
|
@ -251,7 +250,7 @@ class PhpWord
|
||||||
/**
|
/**
|
||||||
* Get default font size
|
* Get default font size
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDefaultFontSize()
|
public function getDefaultFontSize()
|
||||||
{
|
{
|
||||||
|
|
@ -262,7 +261,6 @@ class PhpWord
|
||||||
* Set default font size.
|
* Set default font size.
|
||||||
*
|
*
|
||||||
* @param int $fontSize
|
* @param int $fontSize
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setDefaultFontSize($fontSize)
|
public function setDefaultFontSize($fontSize)
|
||||||
{
|
{
|
||||||
|
|
@ -285,21 +283,20 @@ class PhpWord
|
||||||
*
|
*
|
||||||
* @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead.
|
* @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead.
|
||||||
*
|
*
|
||||||
* @param string $filename Fully qualified filename.
|
* @param string $filename Fully qualified filename
|
||||||
*
|
|
||||||
* @return TemplateProcessor
|
|
||||||
*
|
*
|
||||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||||
*
|
*
|
||||||
|
* @return TemplateProcessor
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function loadTemplate($filename)
|
public function loadTemplate($filename)
|
||||||
{
|
{
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
return new TemplateProcessor($filename);
|
return new TemplateProcessor($filename);
|
||||||
} else {
|
|
||||||
throw new Exception("Template file {$filename} not found.");
|
|
||||||
}
|
}
|
||||||
|
throw new Exception("Template file {$filename} not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -325,7 +322,7 @@ class PhpWord
|
||||||
$writer = IOFactory::createWriter($this, $format);
|
$writer = IOFactory::createWriter($this, $format);
|
||||||
|
|
||||||
if ($download === true) {
|
if ($download === true) {
|
||||||
header("Content-Description: File Transfer");
|
header('Content-Description: File Transfer');
|
||||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||||
header('Content-Type: ' . $mime[$format]);
|
header('Content-Type: ' . $mime[$format]);
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,6 +62,7 @@ abstract class AbstractReader implements ReaderInterface
|
||||||
public function setReadDataOnly($value = true)
|
public function setReadDataOnly($value = true)
|
||||||
{
|
{
|
||||||
$this->readDataOnly = $value;
|
$this->readDataOnly = $value;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,21 +71,21 @@ abstract class AbstractReader implements ReaderInterface
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
*
|
*
|
||||||
* @return resource
|
|
||||||
*
|
|
||||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||||
|
*
|
||||||
|
* @return resource
|
||||||
*/
|
*/
|
||||||
protected function openFile($filename)
|
protected function openFile($filename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($filename) || !is_readable($filename)) {
|
if (!file_exists($filename) || !is_readable($filename)) {
|
||||||
throw new Exception("Could not open " . $filename . " for reading! File does not exist.");
|
throw new Exception("Could not open $filename for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$this->fileHandle = fopen($filename, 'r');
|
$this->fileHandle = fopen($filename, 'r');
|
||||||
if ($this->fileHandle === false) {
|
if ($this->fileHandle === false) {
|
||||||
throw new Exception("Could not open file " . $filename . " for reading.");
|
throw new Exception("Could not open file $filename for reading.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ namespace PhpOffice\PhpWord\Reader;
|
||||||
|
|
||||||
use PhpOffice\Common\Drawing;
|
use PhpOffice\Common\Drawing;
|
||||||
use PhpOffice\PhpWord\PhpWord;
|
use PhpOffice\PhpWord\PhpWord;
|
||||||
use PhpOffice\PhpWord\Style;
|
|
||||||
use PhpOffice\PhpWord\Shared\OLERead;
|
use PhpOffice\PhpWord\Shared\OLERead;
|
||||||
|
use PhpOffice\PhpWord\Style;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reader for Word97
|
* Reader for Word97
|
||||||
|
|
@ -164,13 +164,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$arrayCP[$inc] = self::getInt4d($data, $posMem);
|
$arrayCP[$inc] = self::getInt4d($data, $posMem);
|
||||||
$posMem += 4;
|
$posMem += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arrayCP;
|
return $arrayCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @see http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
|
||||||
* @link http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
|
* @see https://igor.io/2012/09/24/binary-parsing.html
|
||||||
* @link https://igor.io/2012/09/24/binary-parsing.html
|
* @param string $data
|
||||||
*/
|
*/
|
||||||
private function readFib($data)
|
private function readFib($data)
|
||||||
{
|
{
|
||||||
|
|
@ -1095,6 +1096,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos);
|
$this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos);
|
||||||
$pos += 4;
|
$pos += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $pos;
|
return $pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1107,11 +1109,11 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$this->readRecordPlcfSed();
|
$this->readRecordPlcfSed();
|
||||||
|
|
||||||
// reading paragraphs
|
// reading paragraphs
|
||||||
//@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86
|
//@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86
|
||||||
$this->readRecordPlcfBtePapx();
|
$this->readRecordPlcfBtePapx();
|
||||||
|
|
||||||
// reading character formattings
|
// reading character formattings
|
||||||
//@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94
|
//@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94
|
||||||
$this->readRecordPlcfBteChpx();
|
$this->readRecordPlcfBteChpx();
|
||||||
|
|
||||||
$this->generatePhpWord();
|
$this->generatePhpWord();
|
||||||
|
|
@ -1119,7 +1121,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section and information about them
|
* Section and information about them
|
||||||
* @link : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx
|
* @see : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private function readRecordPlcfSed()
|
private function readRecordPlcfSed()
|
||||||
{
|
{
|
||||||
|
|
@ -1133,7 +1135,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$posMem += 4;
|
$posMem += 4;
|
||||||
|
|
||||||
// PlcfSed : aSed
|
// PlcfSed : aSed
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx
|
||||||
$numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12);
|
$numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12);
|
||||||
|
|
||||||
$aSed = array();
|
$aSed = array();
|
||||||
|
|
@ -1164,7 +1166,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the fonts that are used in the document
|
* Specifies the fonts that are used in the document
|
||||||
* @link : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx
|
* @see : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private function readRecordSttbfFfn()
|
private function readRecordSttbfFfn()
|
||||||
{
|
{
|
||||||
|
|
@ -1215,7 +1217,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
$this->arrayFonts[] = array(
|
$this->arrayFonts[] = array(
|
||||||
'main' => $xszFfn,
|
'main' => $xszFfn,
|
||||||
'alt' => $xszAlt,
|
'alt' => $xszAlt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1223,7 +1225,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paragraph and information about them
|
* Paragraph and information about them
|
||||||
* @link http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx
|
* @see http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private function readRecordPlcfBtePapx()
|
private function readRecordPlcfBtePapx()
|
||||||
{
|
{
|
||||||
|
|
@ -1247,7 +1249,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
$arrayRGB = array();
|
$arrayRGB = array();
|
||||||
for ($inc = 1; $inc <= $numRun; $inc++) {
|
for ($inc = 1; $inc <= $numRun; $inc++) {
|
||||||
// @link http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx
|
// @see http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx
|
||||||
$arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
|
$arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset);
|
||||||
$offset += 1;
|
$offset += 1;
|
||||||
// reserved
|
// reserved
|
||||||
|
|
@ -1426,7 +1428,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
} else {
|
} else {
|
||||||
if ($istd > 0) {
|
if ($istd > 0) {
|
||||||
// @todo : Determining Properties of a Paragraph Style
|
// @todo : Determining Properties of a Paragraph Style
|
||||||
# @link http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx
|
# @see http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
@ -1435,7 +1437,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character formatting properties to text in a document
|
* Character formatting properties to text in a document
|
||||||
* @link http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx
|
* @see http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private function readRecordPlcfBteChpx()
|
private function readRecordPlcfBteChpx()
|
||||||
{
|
{
|
||||||
|
|
@ -1453,7 +1455,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$offset = $offsetBase;
|
$offset = $offsetBase;
|
||||||
|
|
||||||
// ChpxFkp
|
// ChpxFkp
|
||||||
// @link : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx
|
// @see : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx
|
||||||
$numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511);
|
$numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511);
|
||||||
$arrayRGFC = array();
|
$arrayRGFC = array();
|
||||||
for ($inc = 0; $inc <= $numRGFC; $inc++) {
|
for ($inc = 0; $inc <= $numRGFC; $inc++) {
|
||||||
|
|
@ -1471,12 +1473,12 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
foreach ($arrayRGB as $keyRGB => $rgb) {
|
foreach ($arrayRGB as $keyRGB => $rgb) {
|
||||||
$oStyle = new \stdClass();
|
$oStyle = new \stdClass();
|
||||||
$oStyle->pos_start = $start;
|
$oStyle->pos_start = $start;
|
||||||
$oStyle->pos_len = (int)ceil((($arrayRGFC[$keyRGB] -1) - $arrayRGFC[$keyRGB -1]) / 2);
|
$oStyle->pos_len = (int) ceil((($arrayRGFC[$keyRGB] - 1) - $arrayRGFC[$keyRGB - 1]) / 2);
|
||||||
$start += $oStyle->pos_len;
|
$start += $oStyle->pos_len;
|
||||||
|
|
||||||
if ($rgb > 0) {
|
if ($rgb > 0) {
|
||||||
// Chp Structure
|
// Chp Structure
|
||||||
// @link : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
|
// @see : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
|
||||||
$posRGB = $offsetBase + $rgb * 2;
|
$posRGB = $offsetBase + $rgb * 2;
|
||||||
|
|
||||||
$cb = self::getInt1d($this->dataWorkDocument, $posRGB);
|
$cb = self::getInt1d($this->dataWorkDocument, $posRGB);
|
||||||
|
|
@ -1500,12 +1502,13 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$oSprm->f = ($sprm / 512) & 0x0001;
|
$oSprm->f = ($sprm / 512) & 0x0001;
|
||||||
$oSprm->sgc = ($sprm / 1024) & 0x0007;
|
$oSprm->sgc = ($sprm / 1024) & 0x0007;
|
||||||
$oSprm->spra = ($sprm / 8192);
|
$oSprm->spra = ($sprm / 8192);
|
||||||
|
|
||||||
return $oSprm;
|
return $oSprm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @param integer $pos
|
* @param int $pos
|
||||||
* @param \stdClass $oSprm
|
* @param \stdClass $oSprm
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -1558,16 +1561,17 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'length' => $length,
|
'length' => $length,
|
||||||
'operand' => $operand,
|
'operand' => $operand,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $data integer
|
* @param $data int
|
||||||
* @param $pos integer
|
* @param $pos int
|
||||||
|
* @param $cbNum int
|
||||||
* @return \stdClass
|
* @return \stdClass
|
||||||
* @link http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
|
* @see http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
|
||||||
*/
|
*/
|
||||||
private function readPrl($data, $pos, $cbNum)
|
private function readPrl($data, $pos, $cbNum)
|
||||||
{
|
{
|
||||||
|
|
@ -1732,7 +1736,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// sprmCIco
|
// sprmCIco
|
||||||
//@link http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx
|
//@see http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx
|
||||||
case 0x42:
|
case 0x42:
|
||||||
switch (dechex($operand)) {
|
switch (dechex($operand)) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
|
@ -1787,7 +1791,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
break;
|
break;
|
||||||
// sprmCHps
|
// sprmCHps
|
||||||
case 0x43:
|
case 0x43:
|
||||||
$oStylePrl->styleFont['size'] = dechex($operand/2);
|
$oStylePrl->styleFont['size'] = dechex($operand / 2);
|
||||||
break;
|
break;
|
||||||
// sprmCIss
|
// sprmCIss
|
||||||
case 0x48:
|
case 0x48:
|
||||||
|
|
@ -1838,7 +1842,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
case 0x61:
|
case 0x61:
|
||||||
break;
|
break;
|
||||||
// sprmCShd80
|
// sprmCShd80
|
||||||
//@link http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx
|
//@see http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx
|
||||||
case 0x66:
|
case 0x66:
|
||||||
// $operand = self::getInt2d($data, $pos);
|
// $operand = self::getInt2d($data, $pos);
|
||||||
$pos += 2;
|
$pos += 2;
|
||||||
|
|
@ -1848,7 +1852,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
// $icoFore = ($operand >> 11) && bindec('11111');
|
// $icoFore = ($operand >> 11) && bindec('11111');
|
||||||
break;
|
break;
|
||||||
// sprmCCv
|
// sprmCCv
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx
|
||||||
case 0x70:
|
case 0x70:
|
||||||
$red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
|
$red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
|
||||||
$pos += 1;
|
$pos += 1;
|
||||||
|
|
@ -1857,7 +1861,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
|
$blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
|
||||||
$pos += 1;
|
$pos += 1;
|
||||||
$pos += 1;
|
$pos += 1;
|
||||||
$oStylePrl->styleFont['color'] = $red.$green.$blue;
|
$oStylePrl->styleFont['color'] = $red . $green . $blue;
|
||||||
$cbNum -= 4;
|
$cbNum -= 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -1950,7 +1954,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
// HFD > clsid
|
// HFD > clsid
|
||||||
$sprmCPicLocation += 16;
|
$sprmCPicLocation += 16;
|
||||||
// HFD > hyperlink
|
// HFD > hyperlink
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx
|
||||||
$streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation);
|
$streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation);
|
||||||
$sprmCPicLocation += 4;
|
$sprmCPicLocation += 4;
|
||||||
$data = self::getInt4d($this->dataData, $sprmCPicLocation);
|
$data = self::getInt4d($this->dataData, $sprmCPicLocation);
|
||||||
|
|
@ -2018,8 +2022,8 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}*/
|
}*/
|
||||||
} else {
|
} else {
|
||||||
// Pictures
|
// Pictures
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx
|
||||||
// PICF : lcb
|
// PICF : lcb
|
||||||
$sprmCPicLocation += 4;
|
$sprmCPicLocation += 4;
|
||||||
// PICF : cbHeader
|
// PICF : cbHeader
|
||||||
|
|
@ -2106,13 +2110,13 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$sprmCPicLocation += $shapeRH['recLen'];
|
$sprmCPicLocation += $shapeRH['recLen'];
|
||||||
}
|
}
|
||||||
// picture : rgfb
|
// picture : rgfb
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx
|
||||||
$fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
|
$fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
|
||||||
while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) {
|
while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) {
|
||||||
$sprmCPicLocation += 8;
|
$sprmCPicLocation += 8;
|
||||||
switch ($fileBlockRH['recType']) {
|
switch ($fileBlockRH['recType']) {
|
||||||
// OfficeArtFBSE
|
// OfficeArtFBSE
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx
|
||||||
case 0xF007:
|
case 0xF007:
|
||||||
// btWin32
|
// btWin32
|
||||||
$sprmCPicLocation += 1;
|
$sprmCPicLocation += 1;
|
||||||
|
|
@ -2147,7 +2151,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// embeddedBlip
|
// embeddedBlip
|
||||||
//@link : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx
|
//@see : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx
|
||||||
$embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
|
$embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation);
|
||||||
switch ($embeddedBlipRH['recType']) {
|
switch ($embeddedBlipRH['recType']) {
|
||||||
case self::OFFICEARTBLIPJPG:
|
case self::OFFICEARTBLIPJPG:
|
||||||
|
|
@ -2192,13 +2196,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
$oStylePrl->length = $pos - $posStart;
|
$oStylePrl->length = $pos - $posStart;
|
||||||
|
|
||||||
return $oStylePrl;
|
return $oStylePrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a record header
|
* Read a record header
|
||||||
* @param string $stream
|
* @param string $stream
|
||||||
* @param integer $pos
|
* @param int $pos
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function loadRecordHeader($stream, $pos)
|
private function loadRecordHeader($stream, $pos)
|
||||||
|
|
@ -2206,11 +2211,12 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
$rec = self::getInt2d($stream, $pos);
|
$rec = self::getInt2d($stream, $pos);
|
||||||
$recType = self::getInt2d($stream, $pos + 2);
|
$recType = self::getInt2d($stream, $pos + 2);
|
||||||
$recLen = self::getInt4d($stream, $pos + 4);
|
$recLen = self::getInt4d($stream, $pos + 4);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'recVer' => ($rec >> 0) & bindec('1111'),
|
'recVer' => ($rec >> 0) & bindec('1111'),
|
||||||
'recInstance' => ($rec >> 4) & bindec('111111111111'),
|
'recInstance' => ($rec >> 4) & bindec('111111111111'),
|
||||||
'recType' => $recType,
|
'recType' => $recType,
|
||||||
'recLen' => $recLen,
|
'recLen' => $recLen,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2273,7 +2279,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
}
|
}
|
||||||
if (ord($sText[0]) == 1) {
|
if (ord($sText[0]) == 1) {
|
||||||
if (isset($oCharacters->style->image)) {
|
if (isset($oCharacters->style->image)) {
|
||||||
$fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc').'.'.$oCharacters->style->image['format'];
|
$fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc') . '.' . $oCharacters->style->image['format'];
|
||||||
file_put_contents($fileImage, $oCharacters->style->image['data']);
|
file_put_contents($fileImage, $oCharacters->style->image['data']);
|
||||||
$oSection->addImage($fileImage, array('width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height']));
|
$oSection->addImage($fileImage, array('width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height']));
|
||||||
// print_r('>addImage<'.$fileImage.'>'.EOL);
|
// print_r('>addImage<'.$fileImage.'>'.EOL);
|
||||||
|
|
@ -2308,7 +2314,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
*/
|
*/
|
||||||
public static function getInt2d($data, $pos)
|
public static function getInt2d($data, $pos)
|
||||||
{
|
{
|
||||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8);
|
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2320,7 +2326,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
*/
|
*/
|
||||||
public static function getInt3d($data, $pos)
|
public static function getInt3d($data, $pos)
|
||||||
{
|
{
|
||||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16);
|
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2342,6 +2348,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
||||||
} else {
|
} else {
|
||||||
$ord24 = ($or24 & 127) << 24;
|
$ord24 = ($or24 & 127) << 24;
|
||||||
}
|
}
|
||||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $ord24;
|
|
||||||
|
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ class ODText extends AbstractReader implements ReaderInterface
|
||||||
|
|
||||||
$readerParts = array(
|
$readerParts = array(
|
||||||
'content.xml' => 'Content',
|
'content.xml' => 'Content',
|
||||||
'meta.xml' => 'Meta',
|
'meta.xml' => 'Meta',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($readerParts as $xmlFile => $partName) {
|
foreach ($readerParts as $xmlFile => $partName) {
|
||||||
|
|
@ -58,7 +58,6 @@ class ODText extends AbstractReader implements ReaderInterface
|
||||||
* @param string $partName
|
* @param string $partName
|
||||||
* @param string $docFile
|
* @param string $docFile
|
||||||
* @param string $xmlFile
|
* @param string $xmlFile
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
|
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -31,7 +31,6 @@ class Content extends AbstractPart
|
||||||
* Read content.xml.
|
* Read content.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
@ -48,11 +47,9 @@ class Content extends AbstractPart
|
||||||
$depth = $xmlReader->getAttribute('text:outline-level', $node);
|
$depth = $xmlReader->getAttribute('text:outline-level', $node);
|
||||||
$section->addTitle($node->nodeValue, $depth);
|
$section->addTitle($node->nodeValue, $depth);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'text:p': // Paragraph
|
case 'text:p': // Paragraph
|
||||||
$section->addText($node->nodeValue);
|
$section->addText($node->nodeValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'text:list': // List
|
case 'text:list': // List
|
||||||
$listItems = $xmlReader->getElements('text:list-item/text:p', $node);
|
$listItems = $xmlReader->getElements('text:list-item/text:p', $node);
|
||||||
foreach ($listItems as $listItem) {
|
foreach ($listItems as $listItem) {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -31,7 +31,6 @@ class Meta extends AbstractPart
|
||||||
* Read meta.xml.
|
* Read meta.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
* @todo Process property type
|
* @todo Process property type
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
|
|
@ -70,9 +69,8 @@ class Meta extends AbstractPart
|
||||||
if (in_array($property, array('Category', 'Company', 'Manager'))) {
|
if (in_array($property, array('Category', 'Company', 'Manager'))) {
|
||||||
$method = "set{$property}";
|
$method = "set{$property}";
|
||||||
$docProps->$method($propertyNode->nodeValue);
|
$docProps->$method($propertyNode->nodeValue);
|
||||||
|
|
||||||
// Set other custom properties
|
|
||||||
} else {
|
} else {
|
||||||
|
// Set other custom properties
|
||||||
$docProps->setCustomProperty($property, $propertyNode->nodeValue);
|
$docProps->setCustomProperty($property, $propertyNode->nodeValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -131,7 +131,6 @@ class Document
|
||||||
* - Pushes every other character into the text queue
|
* - Pushes every other character into the text queue
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
* @todo Use `fread` stream for scalability
|
* @todo Use `fread` stream for scalability
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
|
|
@ -153,7 +152,7 @@ class Document
|
||||||
|
|
||||||
// Walk each characters
|
// Walk each characters
|
||||||
while ($this->offset < $this->length) {
|
while ($this->offset < $this->length) {
|
||||||
$char = $this->rtf[$this->offset];
|
$char = $this->rtf[$this->offset];
|
||||||
$ascii = ord($char);
|
$ascii = ord($char);
|
||||||
|
|
||||||
if (isset($markers[$ascii])) { // Marker found: {, }, \, LF, or CR
|
if (isset($markers[$ascii])) { // Marker found: {, }, \, LF, or CR
|
||||||
|
|
@ -163,7 +162,7 @@ class Document
|
||||||
if (false === $this->isControl) { // Non control word: Push character
|
if (false === $this->isControl) { // Non control word: Push character
|
||||||
$this->pushText($char);
|
$this->pushText($char);
|
||||||
} else {
|
} else {
|
||||||
if (preg_match("/^[a-zA-Z0-9-]?$/", $char)) { // No delimiter: Buffer control
|
if (preg_match('/^[a-zA-Z0-9-]?$/', $char)) { // No delimiter: Buffer control
|
||||||
$this->control .= $char;
|
$this->control .= $char;
|
||||||
$this->isFirst = false;
|
$this->isFirst = false;
|
||||||
} else { // Delimiter found: Parse buffered control
|
} else { // Delimiter found: Parse buffered control
|
||||||
|
|
@ -184,8 +183,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark opening braket `{` character.
|
* Mark opening braket `{` character.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function markOpening()
|
private function markOpening()
|
||||||
{
|
{
|
||||||
|
|
@ -195,8 +192,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark closing braket `}` character.
|
* Mark closing braket `}` character.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function markClosing()
|
private function markClosing()
|
||||||
{
|
{
|
||||||
|
|
@ -206,8 +201,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark backslash `\` character.
|
* Mark backslash `\` character.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function markBackslash()
|
private function markBackslash()
|
||||||
{
|
{
|
||||||
|
|
@ -223,8 +216,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark newline character: Flush control word because it's not possible to span multiline.
|
* Mark newline character: Flush control word because it's not possible to span multiline.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function markNewline()
|
private function markNewline()
|
||||||
{
|
{
|
||||||
|
|
@ -237,7 +228,6 @@ class Document
|
||||||
* Flush control word or text.
|
* Flush control word or text.
|
||||||
*
|
*
|
||||||
* @param bool $isControl
|
* @param bool $isControl
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function flush($isControl = false)
|
private function flush($isControl = false)
|
||||||
{
|
{
|
||||||
|
|
@ -252,11 +242,10 @@ class Document
|
||||||
* Flush control word.
|
* Flush control word.
|
||||||
*
|
*
|
||||||
* @param bool $isControl
|
* @param bool $isControl
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function flushControl($isControl = false)
|
private function flushControl($isControl = false)
|
||||||
{
|
{
|
||||||
if (1 === preg_match("/^([A-Za-z]+)(-?[0-9]*) ?$/", $this->control, $match)) {
|
if (1 === preg_match('/^([A-Za-z]+)(-?[0-9]*) ?$/', $this->control, $match)) {
|
||||||
list(, $control, $parameter) = $match;
|
list(, $control, $parameter) = $match;
|
||||||
$this->parseControl($control, $parameter);
|
$this->parseControl($control, $parameter);
|
||||||
}
|
}
|
||||||
|
|
@ -268,8 +257,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush text in queue.
|
* Flush text in queue.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function flushText()
|
private function flushText()
|
||||||
{
|
{
|
||||||
|
|
@ -296,7 +283,6 @@ class Document
|
||||||
* Reset control word and first char state.
|
* Reset control word and first char state.
|
||||||
*
|
*
|
||||||
* @param bool $value
|
* @param bool $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function setControl($value)
|
private function setControl($value)
|
||||||
{
|
{
|
||||||
|
|
@ -308,14 +294,13 @@ class Document
|
||||||
* Push text into queue.
|
* Push text into queue.
|
||||||
*
|
*
|
||||||
* @param string $char
|
* @param string $char
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function pushText($char)
|
private function pushText($char)
|
||||||
{
|
{
|
||||||
if ('<' == $char) {
|
if ('<' == $char) {
|
||||||
$this->text .= "<";
|
$this->text .= '<';
|
||||||
} elseif ('>' == $char) {
|
} elseif ('>' == $char) {
|
||||||
$this->text .= ">";
|
$this->text .= '>';
|
||||||
} else {
|
} else {
|
||||||
$this->text .= $char;
|
$this->text .= $char;
|
||||||
}
|
}
|
||||||
|
|
@ -326,19 +311,18 @@ class Document
|
||||||
*
|
*
|
||||||
* @param string $control
|
* @param string $control
|
||||||
* @param string $parameter
|
* @param string $parameter
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function parseControl($control, $parameter)
|
private function parseControl($control, $parameter)
|
||||||
{
|
{
|
||||||
$controls = array(
|
$controls = array(
|
||||||
'par' => array(self::PARA, 'paragraph', true),
|
'par' => array(self::PARA, 'paragraph', true),
|
||||||
'b' => array(self::STYL, 'font', 'bold', true),
|
'b' => array(self::STYL, 'font', 'bold', true),
|
||||||
'i' => array(self::STYL, 'font', 'italic', true),
|
'i' => array(self::STYL, 'font', 'italic', true),
|
||||||
'u' => array(self::STYL, 'font', 'underline', true),
|
'u' => array(self::STYL, 'font', 'underline', true),
|
||||||
'strike' => array(self::STYL, 'font', 'strikethrough',true),
|
'strike' => array(self::STYL, 'font', 'strikethrough', true),
|
||||||
'fs' => array(self::STYL, 'font', 'size', $parameter),
|
'fs' => array(self::STYL, 'font', 'size', $parameter),
|
||||||
'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER),
|
'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER),
|
||||||
'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter),
|
'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter),
|
||||||
'fonttbl' => array(self::SKIP, 'fonttbl', null),
|
'fonttbl' => array(self::SKIP, 'fonttbl', null),
|
||||||
'colortbl' => array(self::SKIP, 'colortbl', null),
|
'colortbl' => array(self::SKIP, 'colortbl', null),
|
||||||
'info' => array(self::SKIP, 'info', null),
|
'info' => array(self::SKIP, 'info', null),
|
||||||
|
|
@ -366,7 +350,6 @@ class Document
|
||||||
* Read paragraph.
|
* Read paragraph.
|
||||||
*
|
*
|
||||||
* @param array $directives
|
* @param array $directives
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readParagraph($directives)
|
private function readParagraph($directives)
|
||||||
{
|
{
|
||||||
|
|
@ -379,7 +362,6 @@ class Document
|
||||||
* Read style.
|
* Read style.
|
||||||
*
|
*
|
||||||
* @param array $directives
|
* @param array $directives
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readStyle($directives)
|
private function readStyle($directives)
|
||||||
{
|
{
|
||||||
|
|
@ -391,7 +373,6 @@ class Document
|
||||||
* Read skip.
|
* Read skip.
|
||||||
*
|
*
|
||||||
* @param array $directives
|
* @param array $directives
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readSkip($directives)
|
private function readSkip($directives)
|
||||||
{
|
{
|
||||||
|
|
@ -402,8 +383,6 @@ class Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read text.
|
* Read text.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readText()
|
private function readText()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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 @@ interface ReaderInterface
|
||||||
* Can the current ReaderInterface read the file?
|
* Can the current ReaderInterface read the file?
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canRead($filename);
|
public function canRead($filename);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,7 +55,7 @@ class Word2007 extends AbstractReader implements ReaderInterface
|
||||||
array('stepPart' => 'document', 'stepItems' => array(
|
array('stepPart' => 'document', 'stepItems' => array(
|
||||||
'endnotes' => 'Endnotes',
|
'endnotes' => 'Endnotes',
|
||||||
'footnotes' => 'Footnotes',
|
'footnotes' => 'Footnotes',
|
||||||
'settings' => 'Settings',
|
'settings' => 'Settings',
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -83,7 +83,6 @@ class Word2007 extends AbstractReader implements ReaderInterface
|
||||||
* @param string $partName
|
* @param string $partName
|
||||||
* @param string $docFile
|
* @param string $docFile
|
||||||
* @param string $xmlFile
|
* @param string $xmlFile
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
|
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,9 +36,9 @@ abstract class AbstractPart
|
||||||
*/
|
*/
|
||||||
const READ_VALUE = 'attributeValue'; // Read attribute value
|
const READ_VALUE = 'attributeValue'; // Read attribute value
|
||||||
const READ_EQUAL = 'attributeEquals'; // Read `true` when attribute value equals specified value
|
const READ_EQUAL = 'attributeEquals'; // Read `true` when attribute value equals specified value
|
||||||
const READ_TRUE = 'attributeTrue'; // Read `true` when element exists
|
const READ_TRUE = 'attributeTrue'; // Read `true` when element exists
|
||||||
const READ_FALSE = 'attributeFalse'; // Read `false` when element exists
|
const READ_FALSE = 'attributeFalse'; // Read `false` when element exists
|
||||||
const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size
|
const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document file
|
* Document file
|
||||||
|
|
@ -82,7 +82,6 @@ abstract class AbstractPart
|
||||||
* Set relationships.
|
* Set relationships.
|
||||||
*
|
*
|
||||||
* @param array $value
|
* @param array $value
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setRels($value)
|
public function setRels($value)
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +95,6 @@ abstract class AbstractPart
|
||||||
* @param \DOMElement $domNode
|
* @param \DOMElement $domNode
|
||||||
* @param mixed $parent
|
* @param mixed $parent
|
||||||
* @param string $docPart
|
* @param string $docPart
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @todo Get font style for preserve text
|
* @todo Get font style for preserve text
|
||||||
*/
|
*/
|
||||||
|
|
@ -137,9 +135,8 @@ abstract class AbstractPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$parent->addPreserveText($textContent, $fontStyle, $paragraphStyle);
|
$parent->addPreserveText($textContent, $fontStyle, $paragraphStyle);
|
||||||
|
|
||||||
// List item
|
|
||||||
} elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) {
|
} elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) {
|
||||||
|
// List item
|
||||||
$textContent = '';
|
$textContent = '';
|
||||||
$numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId');
|
$numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId');
|
||||||
$levelId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:ilvl');
|
$levelId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:ilvl');
|
||||||
|
|
@ -148,18 +145,16 @@ abstract class AbstractPart
|
||||||
$textContent .= $xmlReader->getValue('w:t', $node);
|
$textContent .= $xmlReader->getValue('w:t', $node);
|
||||||
}
|
}
|
||||||
$parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle);
|
$parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle);
|
||||||
|
|
||||||
// Heading
|
|
||||||
} elseif (!empty($headingMatches)) {
|
} elseif (!empty($headingMatches)) {
|
||||||
|
// Heading
|
||||||
$textContent = '';
|
$textContent = '';
|
||||||
$nodes = $xmlReader->getElements('w:r', $domNode);
|
$nodes = $xmlReader->getElements('w:r', $domNode);
|
||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
$textContent .= $xmlReader->getValue('w:t', $node);
|
$textContent .= $xmlReader->getValue('w:t', $node);
|
||||||
}
|
}
|
||||||
$parent->addTitle($textContent, $headingMatches[1]);
|
$parent->addTitle($textContent, $headingMatches[1]);
|
||||||
|
|
||||||
// Text and TextRun
|
|
||||||
} else {
|
} else {
|
||||||
|
// Text and TextRun
|
||||||
$runCount = $xmlReader->countElements('w:r', $domNode);
|
$runCount = $xmlReader->countElements('w:r', $domNode);
|
||||||
$linkCount = $xmlReader->countElements('w:hyperlink', $domNode);
|
$linkCount = $xmlReader->countElements('w:hyperlink', $domNode);
|
||||||
$runLinkCount = $runCount + $linkCount;
|
$runLinkCount = $runCount + $linkCount;
|
||||||
|
|
@ -185,7 +180,6 @@ abstract class AbstractPart
|
||||||
* @param mixed $parent
|
* @param mixed $parent
|
||||||
* @param string $docPart
|
* @param string $docPart
|
||||||
* @param mixed $paragraphStyle
|
* @param mixed $paragraphStyle
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @todo Footnote paragraph style
|
* @todo Footnote paragraph style
|
||||||
*/
|
*/
|
||||||
|
|
@ -205,25 +199,22 @@ abstract class AbstractPart
|
||||||
$parent->addLink($target, $textContent, $fontStyle, $paragraphStyle);
|
$parent->addLink($target, $textContent, $fontStyle, $paragraphStyle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Footnote
|
|
||||||
if ($xmlReader->elementExists('w:footnoteReference', $domNode)) {
|
if ($xmlReader->elementExists('w:footnoteReference', $domNode)) {
|
||||||
|
// Footnote
|
||||||
$parent->addFootnote();
|
$parent->addFootnote();
|
||||||
|
|
||||||
// Endnote
|
|
||||||
} elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) {
|
} elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) {
|
||||||
|
// Endnote
|
||||||
$parent->addEndnote();
|
$parent->addEndnote();
|
||||||
|
|
||||||
// Image
|
|
||||||
} elseif ($xmlReader->elementExists('w:pict', $domNode)) {
|
} elseif ($xmlReader->elementExists('w:pict', $domNode)) {
|
||||||
|
// Image
|
||||||
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata');
|
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata');
|
||||||
$target = $this->getMediaTarget($docPart, $rId);
|
$target = $this->getMediaTarget($docPart, $rId);
|
||||||
if (!is_null($target)) {
|
if (!is_null($target)) {
|
||||||
$imageSource = "zip://{$this->docFile}#{$target}";
|
$imageSource = "zip://{$this->docFile}#{$target}";
|
||||||
$parent->addImage($imageSource);
|
$parent->addImage($imageSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Object
|
|
||||||
} elseif ($xmlReader->elementExists('w:object', $domNode)) {
|
} elseif ($xmlReader->elementExists('w:object', $domNode)) {
|
||||||
|
// Object
|
||||||
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject');
|
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject');
|
||||||
// $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata');
|
// $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata');
|
||||||
$target = $this->getMediaTarget($docPart, $rId);
|
$target = $this->getMediaTarget($docPart, $rId);
|
||||||
|
|
@ -231,9 +222,8 @@ abstract class AbstractPart
|
||||||
$textContent = "<Object: {$target}>";
|
$textContent = "<Object: {$target}>";
|
||||||
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextRun
|
|
||||||
} else {
|
} else {
|
||||||
|
// TextRun
|
||||||
$textContent = $xmlReader->getValue('w:t', $domNode);
|
$textContent = $xmlReader->getValue('w:t', $domNode);
|
||||||
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +237,6 @@ abstract class AbstractPart
|
||||||
* @param \DOMElement $domNode
|
* @param \DOMElement $domNode
|
||||||
* @param mixed $parent
|
* @param mixed $parent
|
||||||
* @param string $docPart
|
* @param string $docPart
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart = 'document')
|
protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart = 'document')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -33,15 +33,15 @@ class DocPropsCore extends AbstractPart
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $mapping = array(
|
protected $mapping = array(
|
||||||
'dc:creator' => 'setCreator',
|
'dc:creator' => 'setCreator',
|
||||||
'dc:title' => 'setTitle',
|
'dc:title' => 'setTitle',
|
||||||
'dc:description' => 'setDescription',
|
'dc:description' => 'setDescription',
|
||||||
'dc:subject' => 'setSubject',
|
'dc:subject' => 'setSubject',
|
||||||
'cp:keywords' => 'setKeywords',
|
'cp:keywords' => 'setKeywords',
|
||||||
'cp:category' => 'setCategory',
|
'cp:category' => 'setCategory',
|
||||||
'cp:lastModifiedBy' => 'setLastModifiedBy',
|
'cp:lastModifiedBy' => 'setLastModifiedBy',
|
||||||
'dcterms:created' => 'setCreated',
|
'dcterms:created' => 'setCreated',
|
||||||
'dcterms:modified' => 'setModified',
|
'dcterms:modified' => 'setModified',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,7 +55,6 @@ class DocPropsCore extends AbstractPart
|
||||||
* Read core/extended document properties.
|
* Read core/extended document properties.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -32,7 +32,6 @@ class DocPropsCustom extends AbstractPart
|
||||||
* Read custom document properties.
|
* Read custom document properties.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -40,7 +40,6 @@ class Document extends AbstractPart
|
||||||
* Read document.xml.
|
* Read document.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
@ -66,7 +65,6 @@ class Document extends AbstractPart
|
||||||
*
|
*
|
||||||
* @param array $settings
|
* @param array $settings
|
||||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readHeaderFooter($settings, Section &$section)
|
private function readHeaderFooter($settings, Section &$section)
|
||||||
{
|
{
|
||||||
|
|
@ -131,7 +129,7 @@ class Document extends AbstractPart
|
||||||
$id = $xmlReader->getAttribute('r:id', $node);
|
$id = $xmlReader->getAttribute('r:id', $node);
|
||||||
$styles['hf'][$id] = array(
|
$styles['hf'][$id] = array(
|
||||||
'method' => str_replace('w:', '', str_replace('Reference', '', $node->nodeName)),
|
'method' => str_replace('w:', '', str_replace('Reference', '', $node->nodeName)),
|
||||||
'type' => $xmlReader->getAttribute('w:type', $node),
|
'type' => $xmlReader->getAttribute('w:type', $node),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +143,6 @@ class Document extends AbstractPart
|
||||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||||
* @param \DOMElement $node
|
* @param \DOMElement $node
|
||||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @todo <w:lastRenderedPageBreak>
|
* @todo <w:lastRenderedPageBreak>
|
||||||
*/
|
*/
|
||||||
|
|
@ -175,7 +172,6 @@ class Document extends AbstractPart
|
||||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||||
* @param \DOMElement $node
|
* @param \DOMElement $node
|
||||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function readWSectPrNode(XMLReader $xmlReader, \DOMElement $node, Section &$section)
|
private function readWSectPrNode(XMLReader $xmlReader, \DOMElement $node, Section &$section)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -45,7 +45,6 @@ class Footnotes extends AbstractPart
|
||||||
* Read (footnotes|endnotes).xml.
|
* Read (footnotes|endnotes).xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -31,7 +31,6 @@ class Numbering extends AbstractPart
|
||||||
* Read numbering.xml.
|
* Read numbering.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
@ -92,7 +91,7 @@ class Numbering extends AbstractPart
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||||
* @param \DOMElement $subnode
|
* @param \DOMElement $subnode
|
||||||
* @param integer $levelId
|
* @param int $levelId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function readLevel(XMLReader $xmlReader, \DOMElement $subnode, $levelId)
|
private function readLevel(XMLReader $xmlReader, \DOMElement $subnode, $levelId)
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 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,14 +29,12 @@ use PhpOffice\PhpWord\Style\Language;
|
||||||
*/
|
*/
|
||||||
class Settings extends AbstractPart
|
class Settings extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
||||||
private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders');
|
private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read settings.xml.
|
* Read settings.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
@ -58,9 +56,9 @@ class Settings extends AbstractPart
|
||||||
} else {
|
} else {
|
||||||
$docSettings->$method(true);
|
$docSettings->$method(true);
|
||||||
}
|
}
|
||||||
} else if (method_exists($this, $method)) {
|
} elseif (method_exists($this, $method)) {
|
||||||
$this->$method($xmlReader, $phpWord, $node);
|
$this->$method($xmlReader, $phpWord, $node);
|
||||||
} else if (method_exists($docSettings, $method)) {
|
} elseif (method_exists($docSettings, $method)) {
|
||||||
$docSettings->$method($value);
|
$docSettings->$method($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,14 +67,13 @@ class Settings extends AbstractPart
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the document Language
|
* Sets the document Language
|
||||||
*
|
*
|
||||||
* @param XMLReader $xmlReader
|
* @param XMLReader $xmlReader
|
||||||
* @param PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @param \DOMNode $node
|
* @param \DOMNode $node
|
||||||
*/
|
*/
|
||||||
protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node)
|
protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node)
|
||||||
{
|
{
|
||||||
|
|
||||||
$val = $xmlReader->getAttribute('w:val', $node);
|
$val = $xmlReader->getAttribute('w:val', $node);
|
||||||
$eastAsia = $xmlReader->getAttribute('w:eastAsia', $node);
|
$eastAsia = $xmlReader->getAttribute('w:eastAsia', $node);
|
||||||
$bidi = $xmlReader->getAttribute('w:bidi', $node);
|
$bidi = $xmlReader->getAttribute('w:bidi', $node);
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
* file that was distributed with this source code. For the full list of
|
* file that was distributed with this source code. For the full list of
|
||||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||||
*
|
*
|
||||||
* @link https://github.com/PHPOffice/PHPWord
|
* @see https://github.com/PHPOffice/PHPWord
|
||||||
* @copyright 2010-2016 PHPWord contributors
|
* @copyright 2010-2017 PHPWord contributors
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -31,7 +31,6 @@ class Styles extends AbstractPart
|
||||||
* Read styles.xml.
|
* Read styles.xml.
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function read(PhpWord $phpWord)
|
public function read(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
|
|
@ -64,14 +63,12 @@ class Styles extends AbstractPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'character':
|
case 'character':
|
||||||
$fontStyle = $this->readFontStyle($xmlReader, $node);
|
$fontStyle = $this->readFontStyle($xmlReader, $node);
|
||||||
if (!empty($fontStyle)) {
|
if (!empty($fontStyle)) {
|
||||||
$phpWord->addFontStyle($name, $fontStyle);
|
$phpWord->addFontStyle($name, $fontStyle);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'table':
|
case 'table':
|
||||||
$tStyle = $this->readTableStyle($xmlReader, $node);
|
$tStyle = $this->readTableStyle($xmlReader, $node);
|
||||||
if (!empty($tStyle)) {
|
if (!empty($tStyle)) {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue