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
|
||||
/.buildpath
|
||||
/.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.6
|
||||
- 7.0
|
||||
## - hhvm
|
||||
- 7.1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: COVERAGE=1
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
## - php: hhvm
|
||||
- php: 7.1
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
- $HOME/.composer/cache
|
||||
- .php-cs.cache
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
@ -25,6 +34,8 @@ before_install:
|
|||
- sudo apt-get install -y graphviz
|
||||
|
||||
before_script:
|
||||
## Deactivate xdebug if we don't do code coverage
|
||||
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
|
||||
## Composer
|
||||
- composer self-update
|
||||
- composer install --prefer-source
|
||||
|
|
@ -34,19 +45,20 @@ before_script:
|
|||
|
||||
script:
|
||||
## 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
|
||||
- ./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
|
||||
- ./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
|
||||
- ./vendor/bin/phploc src/
|
||||
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
|
||||
## 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:
|
||||
## PHPDocumentor
|
||||
- bash .travis_shell_after_success.sh
|
||||
## Scrutinizer
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
|
||||
- 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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
|
|||
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
|
||||
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
|
||||
|
||||
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then
|
||||
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then
|
||||
|
||||
echo -e "Publishing PHPDoc...\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,14 @@
|
|||
"phpoffice/common": "^0.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"phpunit/phpunit": "4.8.*",
|
||||
"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.*",
|
||||
"phploc/phploc": "2.*",
|
||||
"dompdf/dompdf":"0.6.*",
|
||||
"dompdf/dompdf":"0.8.*",
|
||||
"tecnickcom/tcpdf": "6.*",
|
||||
"mpdf/mpdf": "5.*"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -135,12 +135,12 @@ Text breaks are empty new lines. To add text breaks, use the following syntax. A
|
|||
Page breaks
|
||||
~~~~~~~~~~~
|
||||
|
||||
There are two ways to insert a page breaks, using the ``addPageBreak``
|
||||
There are two ways to insert a page break, using the ``addPageBreak``
|
||||
method or using the ``pageBreakBefore`` style of paragraph.
|
||||
|
||||
:: code-block:: php
|
||||
.. code-block:: php
|
||||
|
||||
\\$section->addPageBreak();
|
||||
$section->addPageBreak();
|
||||
|
||||
Lists
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -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
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $phpWord->addParagraphStyle(
|
|||
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
||||
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
||||
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ for ($i = 1; $i <= 8; $i++) {
|
|||
$table->addCell(500)->addText($text);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 3. colspan (gridSpan) and rowspan (vMerge)
|
||||
* ---------------------
|
||||
* | | B | |
|
||||
|
|
@ -93,7 +93,7 @@ $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered);
|
|||
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
|
||||
$table->addCell(null, $cellRowContinue);
|
||||
|
||||
/**
|
||||
/*
|
||||
* 4. colspan (gridSpan) and rowspan (vMerge)
|
||||
* ---------------------
|
||||
* | | B | 1 |
|
||||
|
|
@ -104,6 +104,7 @@ $table->addCell(null, $cellRowContinue);
|
|||
* ---------------------
|
||||
* @see https://github.com/PHPOffice/PHPWord/issues/806
|
||||
*/
|
||||
|
||||
$section->addPageBreak();
|
||||
$section->addText('Table with colspan and rowspan', $header);
|
||||
|
||||
|
|
@ -114,12 +115,12 @@ $table = $section->addTable('Colspan Rowspan');
|
|||
$row = $table->addRow();
|
||||
|
||||
$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 = $table->addRow();
|
||||
$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 = $table->addRow();
|
||||
$row->addCell(null, array('vMerge' => 'continue'));
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ $section->addImage($source);
|
|||
// Image from string
|
||||
$source = 'resources/_mars.jpg';
|
||||
$fileContent = file_get_contents($source);
|
||||
$section->addText("Image from string");
|
||||
$section->addText('Image from string');
|
||||
$section->addImage($fileContent);
|
||||
|
||||
//Wrapping style
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $image->setCommentRangeStart($commentOnImage);
|
|||
$section->addTextBreak(2);
|
||||
|
||||
// We can also do things the other way round, link the comment to the element
|
||||
$anotherText = $section->addText("another text");
|
||||
$anotherText = $section->addText('another text');
|
||||
|
||||
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
||||
$comment1->addText('Test', array('bold' => true));
|
||||
|
|
@ -55,7 +55,6 @@ $comment1->setStartElement($anotherText);
|
|||
$comment1->setEndElement($anotherText);
|
||||
$phpWord->addComment($comment1);
|
||||
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ function getEndingNotes($writers)
|
|||
|
||||
// Do not show execution time for index
|
||||
if (!IS_INDEX) {
|
||||
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
|
||||
$result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
|
||||
$result .= date('H:i:s') . ' Done writing file(s)' . EOL;
|
||||
$result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL;
|
||||
}
|
||||
|
||||
// Return
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ if (!CLI) {
|
|||
<?php
|
||||
}
|
||||
if (!CLI) {
|
||||
echo "<h3>Requirement check:</h3>";
|
||||
echo "<ul>";
|
||||
echo '<h3>Requirement check:</h3>';
|
||||
echo '<ul>';
|
||||
foreach ($requirements as $key => $value) {
|
||||
list($label, $result) = $value;
|
||||
$status = $result ? 'passed' : 'failed';
|
||||
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
echo '</ul>';
|
||||
include_once 'Sample_Footer.php';
|
||||
} else {
|
||||
echo 'Requirement check:' . PHP_EOL;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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)) {
|
||||
return $this->items[$index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +61,6 @@ abstract class AbstractCollection
|
|||
*
|
||||
* @param int $index
|
||||
* @param mixed $item
|
||||
* @return void
|
||||
*/
|
||||
public function setItem($index, $item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\ComplexType;
|
||||
|
||||
use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
||||
|
|
@ -25,7 +26,6 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
|||
*/
|
||||
final class FootnoteProperties
|
||||
{
|
||||
|
||||
const RESTART_NUMBER_CONTINUOUS = 'continuous';
|
||||
const RESTART_NUMBER_EACH_SECTION = 'eachSect';
|
||||
const RESTART_NUMBER_EACH_PAGE = 'eachPage';
|
||||
|
|
@ -52,7 +52,7 @@ final class FootnoteProperties
|
|||
/**
|
||||
* Footnote and Endnote Numbering Starting Value
|
||||
*
|
||||
* @var double
|
||||
* @var float
|
||||
*/
|
||||
private $numStart;
|
||||
|
||||
|
|
@ -86,14 +86,15 @@ final class FootnoteProperties
|
|||
self::POSITION_PAGE_BOTTOM,
|
||||
self::POSITION_BENEATH_TEXT,
|
||||
self::POSITION_SECTION_END,
|
||||
self::POSITION_DOC_END
|
||||
self::POSITION_DOC_END,
|
||||
);
|
||||
|
||||
if (in_array($pos, $position)) {
|
||||
$this->pos = $pos;
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible");
|
||||
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $position) . ' possible');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -117,13 +118,14 @@ final class FootnoteProperties
|
|||
{
|
||||
NumberFormat::validate($numFmt);
|
||||
$this->numFmt = $numFmt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Footnote Numbering Format
|
||||
*
|
||||
* @return double
|
||||
* @return float
|
||||
*/
|
||||
public function getNumStart()
|
||||
{
|
||||
|
|
@ -133,12 +135,13 @@ final class FootnoteProperties
|
|||
/**
|
||||
* Set the Footnote Numbering Format
|
||||
*
|
||||
* @param double $numStart
|
||||
* @param float $numStart
|
||||
* @return self
|
||||
*/
|
||||
public function setNumStart($numStart)
|
||||
{
|
||||
$this->numStart = $numStart;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -164,14 +167,15 @@ final class FootnoteProperties
|
|||
$restartNumbers = array(
|
||||
self::RESTART_NUMBER_CONTINUOUS,
|
||||
self::RESTART_NUMBER_EACH_SECTION,
|
||||
self::RESTART_NUMBER_EACH_PAGE
|
||||
self::RESTART_NUMBER_EACH_PAGE,
|
||||
);
|
||||
|
||||
if (in_array($numRestart, $restartNumbers)) {
|
||||
$this->numRestart = $numRestart;
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible");
|
||||
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $restartNumbers) . ' possible');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\ComplexType;
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +24,6 @@ namespace PhpOffice\PhpWord\ComplexType;
|
|||
*/
|
||||
final class ProofState
|
||||
{
|
||||
|
||||
/**
|
||||
* Check Completed
|
||||
*/
|
||||
|
|
@ -60,8 +60,9 @@ final class ProofState
|
|||
if ($spelling == self::CLEAN || $spelling == self::DIRTY) {
|
||||
$this->spelling = $spelling;
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
|
||||
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -87,8 +88,9 @@ final class ProofState
|
|||
if ($grammar == self::CLEAN || $grammar == self::DIRTY) {
|
||||
$this->grammar = $grammar;
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
|
||||
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\ComplexType;
|
||||
|
||||
/**
|
||||
|
|
@ -23,46 +24,45 @@ namespace PhpOffice\PhpWord\ComplexType;
|
|||
*/
|
||||
final class TrackChangesView
|
||||
{
|
||||
|
||||
/**
|
||||
* Display Visual Indicator Of Markup Area
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $markup;
|
||||
|
||||
/**
|
||||
* Display Comments
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $comments;
|
||||
|
||||
/**
|
||||
* Display Content Revisions
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $insDel;
|
||||
|
||||
/**
|
||||
* Display Formatting Revisions
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $formatting;
|
||||
|
||||
/**
|
||||
* Display Ink Annotations
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $inkAnnotations;
|
||||
|
||||
/**
|
||||
* Get Display Visual Indicator Of Markup Area
|
||||
*
|
||||
* @return boolean True if markup is shown
|
||||
* @return bool True if markup is shown
|
||||
*/
|
||||
public function hasMarkup()
|
||||
{
|
||||
|
|
@ -72,7 +72,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Set Display Visual Indicator Of Markup Area
|
||||
*
|
||||
* @param boolean $markup
|
||||
* @param bool $markup
|
||||
* Set to true to show markup
|
||||
*/
|
||||
public function setMarkup($markup)
|
||||
|
|
@ -83,7 +83,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Get Display Comments
|
||||
*
|
||||
* @return boolean True if comments are shown
|
||||
* @return bool True if comments are shown
|
||||
*/
|
||||
public function hasComments()
|
||||
{
|
||||
|
|
@ -93,7 +93,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Set Display Comments
|
||||
*
|
||||
* @param boolean $comments
|
||||
* @param bool $comments
|
||||
* Set to true to show comments
|
||||
*/
|
||||
public function setComments($comments)
|
||||
|
|
@ -104,7 +104,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Get Display Content Revisions
|
||||
*
|
||||
* @return boolean True if content revisions are shown
|
||||
* @return bool True if content revisions are shown
|
||||
*/
|
||||
public function hasInsDel()
|
||||
{
|
||||
|
|
@ -114,7 +114,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Set Display Content Revisions
|
||||
*
|
||||
* @param boolean $insDel
|
||||
* @param bool $insDel
|
||||
* Set to true to show content revisions
|
||||
*/
|
||||
public function setInsDel($insDel)
|
||||
|
|
@ -125,7 +125,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Get Display Formatting Revisions
|
||||
*
|
||||
* @return boolean True if formatting revisions are shown
|
||||
* @return bool True if formatting revisions are shown
|
||||
*/
|
||||
public function hasFormatting()
|
||||
{
|
||||
|
|
@ -135,7 +135,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Set Display Formatting Revisions
|
||||
*
|
||||
* @param boolean|null $formatting
|
||||
* @param bool|null $formatting
|
||||
* Set to true to show formatting revisions
|
||||
*/
|
||||
public function setFormatting($formatting = null)
|
||||
|
|
@ -146,7 +146,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Get Display Ink Annotations
|
||||
*
|
||||
* @return boolean True if ink annotations are shown
|
||||
* @return bool True if ink annotations are shown
|
||||
*/
|
||||
public function hasInkAnnotations()
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ final class TrackChangesView
|
|||
/**
|
||||
* Set Display Ink Annotations
|
||||
*
|
||||
* @param boolean $inkAnnotations
|
||||
* @param bool $inkAnnotations
|
||||
* Set to true to show ink annotations
|
||||
*/
|
||||
public function setInkAnnotations($inkAnnotations)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ namespace PhpOffice\PhpWord\Element;
|
|||
* @method PageBreak addPageBreak()
|
||||
* @method Table addTable(mixed $style = null)
|
||||
* @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 Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null)
|
||||
* @method Line addLine(mixed $lineStyle = null)
|
||||
|
|
@ -83,7 +83,7 @@ abstract class AbstractContainer extends AbstractElement
|
|||
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object',
|
||||
'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field',
|
||||
'Line', 'Shape', 'Title', 'TOC', 'PageBreak',
|
||||
'Chart', 'FormField', 'SDT', 'Comment'
|
||||
'Chart', 'FormField', 'SDT', 'Comment',
|
||||
);
|
||||
$functions = array();
|
||||
foreach ($elements as $element) {
|
||||
|
|
@ -105,9 +105,8 @@ abstract class AbstractContainer extends AbstractElement
|
|||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->addElement($element, $fontStyle, $paragraphStyle);
|
||||
}
|
||||
|
||||
// All other elements
|
||||
} else {
|
||||
// All other elements
|
||||
array_unshift($args, $element); // Prepend element name to the beginning of args array
|
||||
return call_user_func_array(array($this, 'addElement'), $args);
|
||||
}
|
||||
|
|
@ -181,9 +180,8 @@ abstract class AbstractContainer extends AbstractElement
|
|||
*
|
||||
* @param string $method
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
* @return bool
|
||||
*/
|
||||
private function checkValidity($method)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ abstract class AbstractElement
|
|||
/**
|
||||
* Unique Id for element
|
||||
*
|
||||
* @var int
|
||||
* @var string
|
||||
*/
|
||||
protected $elementId;
|
||||
|
||||
|
|
@ -142,7 +142,6 @@ abstract class AbstractElement
|
|||
* Set PhpWord as reference.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function setPhpWord(PhpWord $phpWord = null)
|
||||
{
|
||||
|
|
@ -164,7 +163,6 @@ abstract class AbstractElement
|
|||
*
|
||||
* @param string $docPart
|
||||
* @param int $docPartId
|
||||
* @return void
|
||||
*/
|
||||
public function setDocPart($docPart, $docPartId = 1)
|
||||
{
|
||||
|
|
@ -221,7 +219,6 @@ abstract class AbstractElement
|
|||
* Set element index.
|
||||
*
|
||||
* @param int $value
|
||||
* @return void
|
||||
*/
|
||||
public function setElementIndex($value)
|
||||
{
|
||||
|
|
@ -231,7 +228,7 @@ abstract class AbstractElement
|
|||
/**
|
||||
* Get element unique ID
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getElementId()
|
||||
{
|
||||
|
|
@ -240,8 +237,6 @@ abstract class AbstractElement
|
|||
|
||||
/**
|
||||
* Set element unique ID from 6 first digit of md5.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setElementId()
|
||||
{
|
||||
|
|
@ -262,7 +257,6 @@ abstract class AbstractElement
|
|||
* Set relation Id.
|
||||
*
|
||||
* @param int $value
|
||||
* @return void
|
||||
*/
|
||||
public function setRelationId($value)
|
||||
{
|
||||
|
|
@ -297,7 +291,7 @@ abstract class AbstractElement
|
|||
public function setCommentRangeStart(Comment $value)
|
||||
{
|
||||
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->setStartElement($this);
|
||||
|
|
@ -317,12 +311,11 @@ abstract class AbstractElement
|
|||
* Set comment end
|
||||
*
|
||||
* @param Comment $value
|
||||
* @return void
|
||||
*/
|
||||
public function setCommentRangeEnd(Comment $value)
|
||||
{
|
||||
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->setEndElement($this);
|
||||
|
|
@ -334,7 +327,6 @@ abstract class AbstractElement
|
|||
* Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
||||
* @return void
|
||||
*/
|
||||
public function setParentContainer(AbstractElement $container)
|
||||
{
|
||||
|
|
@ -363,8 +355,6 @@ abstract class AbstractElement
|
|||
*
|
||||
* - Image element needs to be passed to Media object
|
||||
* - Icon needs to be set for Object element
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function setMediaRelation()
|
||||
{
|
||||
|
|
@ -391,8 +381,6 @@ abstract class AbstractElement
|
|||
|
||||
/**
|
||||
* Set relation Id for elements that will be registered in the Collection subnamespaces.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function setCollectionRelation()
|
||||
{
|
||||
|
|
@ -411,7 +399,7 @@ abstract class AbstractElement
|
|||
*/
|
||||
public function isInSection()
|
||||
{
|
||||
return ($this->docPart == 'Section');
|
||||
return $this->docPart == 'Section';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -441,9 +429,8 @@ abstract class AbstractElement
|
|||
* @param array $enum
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return mixed
|
||||
*
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -83,7 +83,6 @@ class Chart extends AbstractElement
|
|||
* Set type.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
|
|
@ -96,7 +95,6 @@ class Chart extends AbstractElement
|
|||
*
|
||||
* @param array $categories
|
||||
* @param array $values
|
||||
* @return void
|
||||
*/
|
||||
public function addSeries($categories, $values)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element;
|
|||
* Field element
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
|
@ -36,32 +36,32 @@ class Field extends AbstractElement
|
|||
'properties' => array(
|
||||
'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
|
||||
),
|
||||
'options'=>array('PreserveFormat')
|
||||
'options' => array('PreserveFormat'),
|
||||
),
|
||||
'NUMPAGES' => array(
|
||||
'properties' => array(
|
||||
'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText',
|
||||
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'),
|
||||
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%')
|
||||
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper', ),
|
||||
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%'),
|
||||
),
|
||||
'options'=>array('PreserveFormat')
|
||||
'options' => array('PreserveFormat'),
|
||||
),
|
||||
'DATE' => array(
|
||||
'properties' => array(
|
||||
'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',
|
||||
'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(
|
||||
'properties' => array(),
|
||||
'options' => array('Bold', 'Italic')
|
||||
'options' => array('Bold', 'Italic'),
|
||||
),
|
||||
'INDEX' => array(
|
||||
'properties' => array(),
|
||||
'options' => array('PreserveFormat')
|
||||
)
|
||||
'options' => array('PreserveFormat'),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -113,9 +113,8 @@ class Field extends AbstractElement
|
|||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return string
|
||||
*/
|
||||
public function setType($type = null)
|
||||
{
|
||||
|
|
@ -126,6 +125,7 @@ class Field extends AbstractElement
|
|||
throw new \InvalidArgumentException("Invalid type '$type'");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
|
|
@ -144,9 +144,8 @@ class Field extends AbstractElement
|
|||
*
|
||||
* @param array $properties
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return self
|
||||
*/
|
||||
public function setProperties($properties = array())
|
||||
{
|
||||
|
|
@ -158,6 +157,7 @@ class Field extends AbstractElement
|
|||
}
|
||||
$this->properties = array_merge($this->properties, $properties);
|
||||
}
|
||||
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
|
|
@ -176,9 +176,8 @@ class Field extends AbstractElement
|
|||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return self
|
||||
*/
|
||||
public function setOptions($options = array())
|
||||
{
|
||||
|
|
@ -190,6 +189,7 @@ class Field extends AbstractElement
|
|||
}
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
|
|
@ -208,9 +208,8 @@ class Field extends AbstractElement
|
|||
*
|
||||
* @param string | TextRun $text
|
||||
*
|
||||
* @return string | TextRun
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return string | TextRun
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
|
|
@ -218,9 +217,10 @@ class Field extends AbstractElement
|
|||
if (is_string($text) || $text instanceof TextRun) {
|
||||
$this->text = $text;
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid text");
|
||||
throw new \InvalidArgumentException('Invalid text');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ class Footer extends AbstractContainer
|
|||
* Header/footer types constants
|
||||
*
|
||||
* @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 FIRST = 'first';
|
||||
|
|
@ -64,7 +64,6 @@ class Footer extends AbstractContainer
|
|||
* @since 0.10.0
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setType($value = self::AUTO)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element;
|
|||
* Form field element
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Is watermark
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $watermark;
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Is memory image
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $memoryImage;
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Image media index
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
private $mediaIndex;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ class Image extends AbstractElement
|
|||
*
|
||||
* @param string $source
|
||||
* @param mixed $style
|
||||
* @param boolean $watermark
|
||||
* @param bool $watermark
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
||||
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
||||
|
|
@ -183,7 +183,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Get is watermark
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isWatermark()
|
||||
{
|
||||
|
|
@ -193,7 +193,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Set is watermark
|
||||
*
|
||||
* @param boolean $value
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setIsWatermark($value)
|
||||
{
|
||||
|
|
@ -243,7 +243,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Get is memory image
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isMemImage()
|
||||
{
|
||||
|
|
@ -264,7 +264,6 @@ class Image extends AbstractElement
|
|||
* Set target file name.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setTarget($value)
|
||||
{
|
||||
|
|
@ -274,7 +273,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Get media index
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getMediaIndex()
|
||||
{
|
||||
|
|
@ -284,8 +283,7 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Set media index.
|
||||
*
|
||||
* @param integer $value
|
||||
* @return void
|
||||
* @param int $value
|
||||
*/
|
||||
public function setMediaIndex($value)
|
||||
{
|
||||
|
|
@ -368,8 +366,6 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Check memory image, supported type, image functions, and proportional width/height.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
|
||||
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
|
||||
*/
|
||||
|
|
@ -407,8 +403,6 @@ class Image extends AbstractElement
|
|||
|
||||
/**
|
||||
* Set source type.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function setSourceType()
|
||||
{
|
||||
|
|
@ -443,9 +437,9 @@ class Image extends AbstractElement
|
|||
*
|
||||
* @param string $source
|
||||
*
|
||||
* @return array|null
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private function getArchiveImageSize($source)
|
||||
{
|
||||
|
|
@ -483,19 +477,19 @@ class Image extends AbstractElement
|
|||
*/
|
||||
private function getStringImageSize($source)
|
||||
{
|
||||
$result = false;
|
||||
if (!function_exists('getimagesizefromstring')) {
|
||||
$uri = 'data://application/octet-stream;base64,' . base64_encode($source);
|
||||
return @getimagesize($uri);
|
||||
$result = @getimagesize($uri);
|
||||
} else {
|
||||
return @getimagesizefromstring($source);
|
||||
$result = @getimagesizefromstring($source);
|
||||
}
|
||||
return false;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image functions and extensions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function setFunctions()
|
||||
{
|
||||
|
|
@ -530,9 +524,8 @@ class Image extends AbstractElement
|
|||
/**
|
||||
* Set proportional width/height if one dimension not available.
|
||||
*
|
||||
* @param integer $actualWidth
|
||||
* @param integer $actualHeight
|
||||
* @return void
|
||||
* @param int $actualWidth
|
||||
* @param int $actualHeight
|
||||
*/
|
||||
private function setProportionalSize($actualWidth, $actualHeight)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -75,6 +75,7 @@ class Link extends AbstractElement
|
|||
* @param string $text
|
||||
* @param mixed $fontStyle
|
||||
* @param mixed $paragraphStyle
|
||||
* @param bool $internal
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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");
|
||||
|
||||
return $this;
|
||||
} else {
|
||||
throw new InvalidObjectException();
|
||||
}
|
||||
|
||||
throw new InvalidObjectException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +133,6 @@ class Object extends AbstractElement
|
|||
* Set Image Relation ID.
|
||||
*
|
||||
* @param int $rId
|
||||
* @return void
|
||||
*/
|
||||
public function setImageRelationId($rId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -47,7 +47,6 @@ class PreserveText extends AbstractElement
|
|||
*/
|
||||
private $paragraphStyle;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Preserve Text Element
|
||||
*
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -73,7 +73,6 @@ class Section extends AbstractContainer
|
|||
* Set section style.
|
||||
*
|
||||
* @param array $style
|
||||
* @return void
|
||||
*/
|
||||
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.
|
||||
* False otherwise.
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDifferentFirstPage()
|
||||
{
|
||||
|
|
@ -186,6 +185,7 @@ class Section extends AbstractContainer
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -195,11 +195,11 @@ class Section extends AbstractContainer
|
|||
* @since 0.10.0
|
||||
*
|
||||
* @param string $type
|
||||
* @param boolean $header
|
||||
*
|
||||
* @return Header|Footer
|
||||
* @param bool $header
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return Header|Footer
|
||||
*/
|
||||
private function addHeaderFooter($type = Header::AUTO, $header = true)
|
||||
{
|
||||
|
|
@ -215,10 +215,10 @@ class Section extends AbstractContainer
|
|||
$container->setPhpWord($this->phpWord);
|
||||
|
||||
$collection[$index] = $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)) {
|
||||
return null;
|
||||
} else {
|
||||
}
|
||||
|
||||
return $this->footers[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -54,14 +54,13 @@ class TOC extends AbstractElement
|
|||
*/
|
||||
private $maxDepth = 9;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Table-of-Contents Element
|
||||
*
|
||||
* @param mixed $fontStyle
|
||||
* @param array $tocStyle
|
||||
* @param integer $minDepth
|
||||
* @param integer $maxDepth
|
||||
* @param int $minDepth
|
||||
* @param int $maxDepth
|
||||
*/
|
||||
public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
|
||||
{
|
||||
|
|
@ -132,7 +131,6 @@ class TOC extends AbstractElement
|
|||
* Set max depth.
|
||||
*
|
||||
* @param int $value
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxDepth($value)
|
||||
{
|
||||
|
|
@ -153,7 +151,6 @@ class TOC extends AbstractElement
|
|||
* Set min depth.
|
||||
*
|
||||
* @param int $value
|
||||
* @return void
|
||||
*/
|
||||
public function setMinDepth($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -121,7 +121,6 @@ class Table extends AbstractElement
|
|||
* Set table width.
|
||||
*
|
||||
* @param int $width
|
||||
* @return void
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -105,12 +105,12 @@ class Text extends AbstractElement
|
|||
public function setParagraphStyle($style = null)
|
||||
{
|
||||
if (is_array($style)) {
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
$this->paragraphStyle = new Paragraph();
|
||||
$this->paragraphStyle->setStyleByArray($style);
|
||||
} elseif ($style instanceof Paragraph) {
|
||||
$this->paragraphStyle = $style;
|
||||
} elseif (null === $style) {
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
$this->paragraphStyle = new Paragraph();
|
||||
} else {
|
||||
$this->paragraphStyle = $style;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -74,6 +74,7 @@ class TextBreak extends AbstractElement
|
|||
$this->fontStyle = $style;
|
||||
$this->setParagraphStyle($paragraphStyle);
|
||||
}
|
||||
|
||||
return $this->fontStyle;
|
||||
}
|
||||
|
||||
|
|
@ -96,13 +97,14 @@ class TextBreak extends AbstractElement
|
|||
public function setParagraphStyle($style = null)
|
||||
{
|
||||
if (is_array($style)) {
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
$this->paragraphStyle = new Paragraph();
|
||||
$this->paragraphStyle->setStyleByArray($style);
|
||||
} elseif ($style instanceof Paragraph) {
|
||||
$this->paragraphStyle = $style;
|
||||
} else {
|
||||
$this->paragraphStyle = $style;
|
||||
}
|
||||
|
||||
return $this->paragraphStyle;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class Title extends AbstractElement
|
|||
/**
|
||||
* Get depth
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getDepth()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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)
|
||||
{
|
||||
|
||||
$this->author = $author;
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -28,9 +28,9 @@ class Rtf extends AbstractEscaper
|
|||
{
|
||||
if (20 > $code || $code >= 80) {
|
||||
return '{\u' . $code . '}';
|
||||
} else {
|
||||
return chr($code);
|
||||
}
|
||||
|
||||
return chr($code);
|
||||
}
|
||||
|
||||
protected function escapeMultibyteCharacter($code)
|
||||
|
|
@ -40,6 +40,7 @@ class Rtf extends AbstractEscaper
|
|||
|
||||
/**
|
||||
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
* @param string $input
|
||||
*/
|
||||
protected function escapeSingleValue($input)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -23,10 +23,10 @@ namespace PhpOffice\PhpWord\Exception;
|
|||
final class CopyFileException extends Exception
|
||||
{
|
||||
/**
|
||||
* @param string $source The fully qualified source file name.
|
||||
* @param string $destination The fully qualified destination file name.
|
||||
* @param integer $code The user defined exception code.
|
||||
* @param \Exception $previous The previous exception used for the exception chaining.
|
||||
* @param string $source The fully qualified source file name
|
||||
* @param string $destination The fully qualified destination file name
|
||||
* @param int $code The user defined exception code
|
||||
* @param \Exception $previous The previous exception used for the exception chaining
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ namespace PhpOffice\PhpWord\Exception;
|
|||
final class CreateTemporaryFileException extends Exception
|
||||
{
|
||||
/**
|
||||
* @param integer $code The user defined exception code.
|
||||
* @param \Exception $previous The previous exception used for the exception chaining.
|
||||
* @param int $code The user defined exception code
|
||||
* @param \Exception $previous The previous exception used for the exception chaining
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -29,9 +29,9 @@ abstract class IOFactory
|
|||
* @param PhpWord $phpWord
|
||||
* @param string $name
|
||||
*
|
||||
* @return WriterInterface
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*
|
||||
* @return WriterInterface
|
||||
*/
|
||||
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
|
||||
{
|
||||
|
|
@ -49,9 +49,9 @@ abstract class IOFactory
|
|||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return ReaderInterface
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return ReaderInterface
|
||||
*/
|
||||
public static function createReader($name = 'Word2007')
|
||||
{
|
||||
|
|
@ -65,19 +65,19 @@ abstract class IOFactory
|
|||
* @param string $name
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
|
||||
*/
|
||||
private static function createObject($type, $name, $phpWord = null)
|
||||
{
|
||||
$class = "PhpOffice\\PhpWord\\{$type}\\{$name}";
|
||||
if (class_exists($class) && self::isConcreteClass($class)) {
|
||||
return new $class($phpWord);
|
||||
} else {
|
||||
}
|
||||
throw new Exception("\"{$name}\" is not a valid {$type}.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PhpWord from file
|
||||
*
|
||||
|
|
@ -89,8 +89,10 @@ abstract class IOFactory
|
|||
{
|
||||
/** @var \PhpOffice\PhpWord\Reader\ReaderInterface $reader */
|
||||
$reader = self::createReader($readerName);
|
||||
|
||||
return $reader->load($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if it's a concrete class (not abstract nor interface)
|
||||
*
|
||||
|
|
@ -100,6 +102,7 @@ abstract class IOFactory
|
|||
private static function isConcreteClass($class)
|
||||
{
|
||||
$reflection = new \ReflectionClass($class);
|
||||
|
||||
return !$reflection->isAbstract() && !$reflection->isInterface();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ class Media
|
|||
* @param string $source
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function addElement($container, $mediaType, $source, Image $image = null)
|
||||
{
|
||||
|
|
@ -83,12 +83,10 @@ class Media
|
|||
$image->setTarget($target);
|
||||
$image->setMediaIndex($mediaTypeCount);
|
||||
break;
|
||||
|
||||
// Objects
|
||||
case 'object':
|
||||
$target = "{$container}_oleObject{$mediaTypeCount}.bin";
|
||||
break;
|
||||
|
||||
// Links
|
||||
case 'link':
|
||||
$target = $source;
|
||||
|
|
@ -100,23 +98,25 @@ class Media
|
|||
$mediaData['type'] = $mediaType;
|
||||
$mediaData['rID'] = $rId;
|
||||
self::$elements[$container][$mediaId] = $mediaData;
|
||||
|
||||
return $rId;
|
||||
} else {
|
||||
}
|
||||
|
||||
$mediaData = self::$elements[$container][$mediaId];
|
||||
if (!is_null($image)) {
|
||||
$image->setTarget($mediaData['target']);
|
||||
$image->setMediaIndex($mediaData['mediaIndex']);
|
||||
}
|
||||
|
||||
return $mediaData['rID'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media elements count
|
||||
*
|
||||
* @param string $container section|headerx|footerx|footnote|endnote
|
||||
* @param string $mediaType image|object|link
|
||||
* @return integer
|
||||
* @return int
|
||||
* @since 0.10.0
|
||||
*/
|
||||
public static function countElements($container, $mediaType = null)
|
||||
|
|
@ -157,14 +157,16 @@ class Media
|
|||
$elements[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $elements;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!isset(self::$elements[$container])) {
|
||||
return $elements;
|
||||
}
|
||||
|
||||
return self::getElementsByType($container, $type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get elements by media type
|
||||
|
|
@ -208,7 +210,7 @@ class Media
|
|||
* @param string $type
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -224,7 +226,7 @@ class Media
|
|||
*
|
||||
* @param string $linkSrc
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -256,7 +258,7 @@ class Media
|
|||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -270,11 +272,11 @@ class Media
|
|||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param integer $headerCount
|
||||
* @param int $headerCount
|
||||
* @param string $src
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -290,7 +292,7 @@ class Media
|
|||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -318,11 +320,11 @@ class Media
|
|||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param integer $footerCount
|
||||
* @param int $footerCount
|
||||
* @param string $src
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -338,7 +340,7 @@ class Media
|
|||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata;
|
|||
* Compatibility setting class
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
|
@ -33,7 +33,7 @@ class Compatibility
|
|||
* 15 = 2013
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -399,7 +399,7 @@ class DocInfo
|
|||
* Check if a Custom Property is defined
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isCustomPropertySet($propertyName)
|
||||
{
|
||||
|
|
@ -416,9 +416,9 @@ class DocInfo
|
|||
{
|
||||
if ($this->isCustomPropertySet($propertyName)) {
|
||||
return $this->customProperties[$propertyName]['value'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -431,9 +431,9 @@ class DocInfo
|
|||
{
|
||||
if ($this->isCustomPropertySet($propertyName)) {
|
||||
return $this->customProperties[$propertyName]['type'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -456,7 +456,7 @@ class DocInfo
|
|||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN
|
||||
self::PROPERTY_TYPE_BOOLEAN,
|
||||
);
|
||||
if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) {
|
||||
if ($propertyValue === null) {
|
||||
|
|
@ -474,8 +474,9 @@ class DocInfo
|
|||
|
||||
$this->customProperties[$propertyName] = array(
|
||||
'value' => $propertyValue,
|
||||
'type' => $propertyType
|
||||
'type' => $propertyType,
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata;
|
|||
* Document protection class
|
||||
*
|
||||
* @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!
|
||||
*/
|
||||
class Protection
|
||||
|
|
@ -30,7 +30,7 @@ class Protection
|
|||
* Editing restriction readOnly|comments|trackedChanges|forms
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,30 +10,30 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Metadata;
|
||||
|
||||
use PhpOffice\PhpWord\ComplexType\ProofState;
|
||||
use PhpOffice\PhpWord\SimpleType\Zoom;
|
||||
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
|
||||
use PhpOffice\PhpWord\SimpleType\Zoom;
|
||||
use PhpOffice\PhpWord\Style\Language;
|
||||
|
||||
/**
|
||||
* Setting class
|
||||
*
|
||||
* @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
|
||||
{
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
private $zoom = 100;
|
||||
|
|
@ -41,14 +41,14 @@ class Settings
|
|||
/**
|
||||
* Hide spelling errors
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $hideSpellingErrors = false;
|
||||
|
||||
/**
|
||||
* Hide grammatical errors
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $hideGrammaticalErrors = false;
|
||||
|
||||
|
|
@ -62,21 +62,21 @@ class Settings
|
|||
/**
|
||||
* Track Revisions to Document
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $trackRevisions = false;
|
||||
|
||||
/**
|
||||
* Do Not Use Move Syntax When Tracking Revisions
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $doNotTrackMoves = false;
|
||||
|
||||
/**
|
||||
* Do Not Track Formatting Revisions When Tracking Revisions
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
private $doNotTrackFormatting = false;
|
||||
|
||||
|
|
@ -123,6 +123,7 @@ class Settings
|
|||
if ($this->documentProtection == null) {
|
||||
$this->documentProtection = new Protection();
|
||||
}
|
||||
|
||||
return $this->documentProtection;
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +143,7 @@ class Settings
|
|||
if ($this->proofState == null) {
|
||||
$this->proofState = new ProofState();
|
||||
}
|
||||
|
||||
return $this->proofState;
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +158,7 @@ class Settings
|
|||
/**
|
||||
* Are spelling errors hidden
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHideSpellingErrors()
|
||||
{
|
||||
|
|
@ -166,7 +168,7 @@ class Settings
|
|||
/**
|
||||
* Hide spelling errors
|
||||
*
|
||||
* @param boolean $hideSpellingErrors
|
||||
* @param bool $hideSpellingErrors
|
||||
*/
|
||||
public function setHideSpellingErrors($hideSpellingErrors)
|
||||
{
|
||||
|
|
@ -176,7 +178,7 @@ class Settings
|
|||
/**
|
||||
* Are grammatical errors hidden
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHideGrammaticalErrors()
|
||||
{
|
||||
|
|
@ -186,7 +188,7 @@ class Settings
|
|||
/**
|
||||
* Hide grammatical errors
|
||||
*
|
||||
* @param boolean $hideGrammaticalErrors
|
||||
* @param bool $hideGrammaticalErrors
|
||||
*/
|
||||
public function setHideGrammaticalErrors($hideGrammaticalErrors)
|
||||
{
|
||||
|
|
@ -194,7 +196,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEvenAndOddHeaders()
|
||||
{
|
||||
|
|
@ -202,7 +204,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $evenAndOddHeaders
|
||||
* @param bool $evenAndOddHeaders
|
||||
*/
|
||||
public function setEvenAndOddHeaders($evenAndOddHeaders)
|
||||
{
|
||||
|
|
@ -230,7 +232,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTrackRevisions()
|
||||
{
|
||||
|
|
@ -238,7 +240,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $trackRevisions
|
||||
* @param bool $trackRevisions
|
||||
*/
|
||||
public function setTrackRevisions($trackRevisions)
|
||||
{
|
||||
|
|
@ -246,7 +248,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDoNotTrackMoves()
|
||||
{
|
||||
|
|
@ -254,7 +256,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $doNotTrackMoves
|
||||
* @param bool $doNotTrackMoves
|
||||
*/
|
||||
public function setDoNotTrackMoves($doNotTrackMoves)
|
||||
{
|
||||
|
|
@ -262,7 +264,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDoNotTrackFormatting()
|
||||
{
|
||||
|
|
@ -270,7 +272,7 @@ class Settings
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $doNotTrackFormatting
|
||||
* @param bool $doNotTrackFormatting
|
||||
*/
|
||||
public function setDoNotTrackFormatting($doNotTrackFormatting)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -108,9 +108,9 @@ class PhpWord
|
|||
* @param mixed $function
|
||||
* @param mixed $args
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($function, $args)
|
||||
{
|
||||
|
|
@ -241,7 +241,6 @@ class PhpWord
|
|||
* Set default font name.
|
||||
*
|
||||
* @param string $fontName
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultFontName($fontName)
|
||||
{
|
||||
|
|
@ -251,7 +250,7 @@ class PhpWord
|
|||
/**
|
||||
* Get default font size
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getDefaultFontSize()
|
||||
{
|
||||
|
|
@ -262,7 +261,6 @@ class PhpWord
|
|||
* Set default font size.
|
||||
*
|
||||
* @param int $fontSize
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultFontSize($fontSize)
|
||||
{
|
||||
|
|
@ -285,21 +283,20 @@ class PhpWord
|
|||
*
|
||||
* @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead.
|
||||
*
|
||||
* @param string $filename Fully qualified filename.
|
||||
*
|
||||
* @return TemplateProcessor
|
||||
* @param string $filename Fully qualified filename
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*
|
||||
* @return TemplateProcessor
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function loadTemplate($filename)
|
||||
{
|
||||
if (file_exists($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);
|
||||
|
||||
if ($download === true) {
|
||||
header("Content-Description: File Transfer");
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||
header('Content-Type: ' . $mime[$format]);
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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)
|
||||
{
|
||||
$this->readDataOnly = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -70,21 +71,21 @@ abstract class AbstractReader implements ReaderInterface
|
|||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return resource
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
protected function openFile($filename)
|
||||
{
|
||||
// Check if file exists
|
||||
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
|
||||
$this->fileHandle = fopen($filename, 'r');
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Shared\OLERead;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
/**
|
||||
* Reader for Word97
|
||||
|
|
@ -164,13 +164,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$arrayCP[$inc] = self::getInt4d($data, $posMem);
|
||||
$posMem += 4;
|
||||
}
|
||||
|
||||
return $arrayCP;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @link http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
|
||||
* @link https://igor.io/2012/09/24/binary-parsing.html
|
||||
* @see http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
|
||||
* @see https://igor.io/2012/09/24/binary-parsing.html
|
||||
* @param string $data
|
||||
*/
|
||||
private function readFib($data)
|
||||
{
|
||||
|
|
@ -1095,6 +1096,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos);
|
||||
$pos += 4;
|
||||
}
|
||||
|
||||
return $pos;
|
||||
}
|
||||
|
||||
|
|
@ -1107,11 +1109,11 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$this->readRecordPlcfSed();
|
||||
|
||||
// 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();
|
||||
|
||||
// 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->generatePhpWord();
|
||||
|
|
@ -1119,7 +1121,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
|
@ -1133,7 +1135,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$posMem += 4;
|
||||
|
||||
// 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);
|
||||
|
||||
$aSed = array();
|
||||
|
|
@ -1164,7 +1166,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
|
@ -1223,7 +1225,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
|
@ -1247,7 +1249,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}
|
||||
$arrayRGB = array();
|
||||
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);
|
||||
$offset += 1;
|
||||
// reserved
|
||||
|
|
@ -1426,7 +1428,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
} else {
|
||||
if ($istd > 0) {
|
||||
// @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
|
||||
* @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()
|
||||
{
|
||||
|
|
@ -1453,7 +1455,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$offset = $offsetBase;
|
||||
|
||||
// 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);
|
||||
$arrayRGFC = array();
|
||||
for ($inc = 0; $inc <= $numRGFC; $inc++) {
|
||||
|
|
@ -1476,7 +1478,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
|
||||
if ($rgb > 0) {
|
||||
// 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;
|
||||
|
||||
$cb = self::getInt1d($this->dataWorkDocument, $posRGB);
|
||||
|
|
@ -1500,12 +1502,13 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$oSprm->f = ($sprm / 512) & 0x0001;
|
||||
$oSprm->sgc = ($sprm / 1024) & 0x0007;
|
||||
$oSprm->spra = ($sprm / 8192);
|
||||
|
||||
return $oSprm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @param integer $pos
|
||||
* @param int $pos
|
||||
* @param \stdClass $oSprm
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -1564,10 +1567,11 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $data integer
|
||||
* @param $pos integer
|
||||
* @param $data int
|
||||
* @param $pos int
|
||||
* @param $cbNum int
|
||||
* @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)
|
||||
{
|
||||
|
|
@ -1732,7 +1736,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}
|
||||
break;
|
||||
// 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:
|
||||
switch (dechex($operand)) {
|
||||
case 0x00:
|
||||
|
|
@ -1838,7 +1842,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
case 0x61:
|
||||
break;
|
||||
// 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:
|
||||
// $operand = self::getInt2d($data, $pos);
|
||||
$pos += 2;
|
||||
|
|
@ -1848,7 +1852,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
// $icoFore = ($operand >> 11) && bindec('11111');
|
||||
break;
|
||||
// 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:
|
||||
$red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT);
|
||||
$pos += 1;
|
||||
|
|
@ -1950,7 +1954,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
// HFD > clsid
|
||||
$sprmCPicLocation += 16;
|
||||
// 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);
|
||||
$sprmCPicLocation += 4;
|
||||
$data = self::getInt4d($this->dataData, $sprmCPicLocation);
|
||||
|
|
@ -2018,8 +2022,8 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}*/
|
||||
} else {
|
||||
// Pictures
|
||||
//@link : 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/dd925458%28v=office.12%29.aspx
|
||||
//@see : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx
|
||||
// PICF : lcb
|
||||
$sprmCPicLocation += 4;
|
||||
// PICF : cbHeader
|
||||
|
|
@ -2106,13 +2110,13 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$sprmCPicLocation += $shapeRH['recLen'];
|
||||
}
|
||||
// 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);
|
||||
while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) {
|
||||
$sprmCPicLocation += 8;
|
||||
switch ($fileBlockRH['recType']) {
|
||||
// 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:
|
||||
// btWin32
|
||||
$sprmCPicLocation += 1;
|
||||
|
|
@ -2147,7 +2151,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}
|
||||
}
|
||||
// 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);
|
||||
switch ($embeddedBlipRH['recType']) {
|
||||
case self::OFFICEARTBLIPJPG:
|
||||
|
|
@ -2192,13 +2196,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
}
|
||||
|
||||
$oStylePrl->length = $pos - $posStart;
|
||||
|
||||
return $oStylePrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a record header
|
||||
* @param string $stream
|
||||
* @param integer $pos
|
||||
* @param int $pos
|
||||
* @return array
|
||||
*/
|
||||
private function loadRecordHeader($stream, $pos)
|
||||
|
|
@ -2206,6 +2211,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
$rec = self::getInt2d($stream, $pos);
|
||||
$recType = self::getInt2d($stream, $pos + 2);
|
||||
$recLen = self::getInt4d($stream, $pos + 4);
|
||||
|
||||
return array(
|
||||
'recVer' => ($rec >> 0) & bindec('1111'),
|
||||
'recInstance' => ($rec >> 4) & bindec('111111111111'),
|
||||
|
|
@ -2342,6 +2348,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
|
|||
} else {
|
||||
$ord24 = ($or24 & 127) << 24;
|
||||
}
|
||||
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -58,7 +58,6 @@ class ODText extends AbstractReader implements ReaderInterface
|
|||
* @param string $partName
|
||||
* @param string $docFile
|
||||
* @param string $xmlFile
|
||||
* @return void
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -31,7 +31,6 @@ class Content extends AbstractPart
|
|||
* Read content.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
@ -48,11 +47,9 @@ class Content extends AbstractPart
|
|||
$depth = $xmlReader->getAttribute('text:outline-level', $node);
|
||||
$section->addTitle($node->nodeValue, $depth);
|
||||
break;
|
||||
|
||||
case 'text:p': // Paragraph
|
||||
$section->addText($node->nodeValue);
|
||||
break;
|
||||
|
||||
case 'text:list': // List
|
||||
$listItems = $xmlReader->getElements('text:list-item/text:p', $node);
|
||||
foreach ($listItems as $listItem) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -31,7 +31,6 @@ class Meta extends AbstractPart
|
|||
* Read meta.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
* @todo Process property type
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
|
|
@ -70,9 +69,8 @@ class Meta extends AbstractPart
|
|||
if (in_array($property, array('Category', 'Company', 'Manager'))) {
|
||||
$method = "set{$property}";
|
||||
$docProps->$method($propertyNode->nodeValue);
|
||||
|
||||
// Set other custom properties
|
||||
} else {
|
||||
// Set other custom properties
|
||||
$docProps->setCustomProperty($property, $propertyNode->nodeValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
* @todo Use `fread` stream for scalability
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
|
|
@ -163,7 +162,7 @@ class Document
|
|||
if (false === $this->isControl) { // Non control word: Push character
|
||||
$this->pushText($char);
|
||||
} 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->isFirst = false;
|
||||
} else { // Delimiter found: Parse buffered control
|
||||
|
|
@ -184,8 +183,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Mark opening braket `{` character.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function markOpening()
|
||||
{
|
||||
|
|
@ -195,8 +192,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Mark closing braket `}` character.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function markClosing()
|
||||
{
|
||||
|
|
@ -206,8 +201,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Mark backslash `\` character.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function markBackslash()
|
||||
{
|
||||
|
|
@ -223,8 +216,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Mark newline character: Flush control word because it's not possible to span multiline.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function markNewline()
|
||||
{
|
||||
|
|
@ -237,7 +228,6 @@ class Document
|
|||
* Flush control word or text.
|
||||
*
|
||||
* @param bool $isControl
|
||||
* @return void
|
||||
*/
|
||||
private function flush($isControl = false)
|
||||
{
|
||||
|
|
@ -252,11 +242,10 @@ class Document
|
|||
* Flush control word.
|
||||
*
|
||||
* @param bool $isControl
|
||||
* @return void
|
||||
*/
|
||||
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;
|
||||
$this->parseControl($control, $parameter);
|
||||
}
|
||||
|
|
@ -268,8 +257,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Flush text in queue.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function flushText()
|
||||
{
|
||||
|
|
@ -296,7 +283,6 @@ class Document
|
|||
* Reset control word and first char state.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return void
|
||||
*/
|
||||
private function setControl($value)
|
||||
{
|
||||
|
|
@ -308,14 +294,13 @@ class Document
|
|||
* Push text into queue.
|
||||
*
|
||||
* @param string $char
|
||||
* @return void
|
||||
*/
|
||||
private function pushText($char)
|
||||
{
|
||||
if ('<' == $char) {
|
||||
$this->text .= "<";
|
||||
$this->text .= '<';
|
||||
} elseif ('>' == $char) {
|
||||
$this->text .= ">";
|
||||
$this->text .= '>';
|
||||
} else {
|
||||
$this->text .= $char;
|
||||
}
|
||||
|
|
@ -326,7 +311,6 @@ class Document
|
|||
*
|
||||
* @param string $control
|
||||
* @param string $parameter
|
||||
* @return void
|
||||
*/
|
||||
private function parseControl($control, $parameter)
|
||||
{
|
||||
|
|
@ -366,7 +350,6 @@ class Document
|
|||
* Read paragraph.
|
||||
*
|
||||
* @param array $directives
|
||||
* @return void
|
||||
*/
|
||||
private function readParagraph($directives)
|
||||
{
|
||||
|
|
@ -379,7 +362,6 @@ class Document
|
|||
* Read style.
|
||||
*
|
||||
* @param array $directives
|
||||
* @return void
|
||||
*/
|
||||
private function readStyle($directives)
|
||||
{
|
||||
|
|
@ -391,7 +373,6 @@ class Document
|
|||
* Read skip.
|
||||
*
|
||||
* @param array $directives
|
||||
* @return void
|
||||
*/
|
||||
private function readSkip($directives)
|
||||
{
|
||||
|
|
@ -402,8 +383,6 @@ class Document
|
|||
|
||||
/**
|
||||
* Read text.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function readText()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ interface ReaderInterface
|
|||
* Can the current ReaderInterface read the file?
|
||||
*
|
||||
* @param string $filename
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function canRead($filename);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -83,7 +83,6 @@ class Word2007 extends AbstractReader implements ReaderInterface
|
|||
* @param string $partName
|
||||
* @param string $docFile
|
||||
* @param string $xmlFile
|
||||
* @return void
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -82,7 +82,6 @@ abstract class AbstractPart
|
|||
* Set relationships.
|
||||
*
|
||||
* @param array $value
|
||||
* @return void
|
||||
*/
|
||||
public function setRels($value)
|
||||
{
|
||||
|
|
@ -96,7 +95,6 @@ abstract class AbstractPart
|
|||
* @param \DOMElement $domNode
|
||||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
* @return void
|
||||
*
|
||||
* @todo Get font style for preserve text
|
||||
*/
|
||||
|
|
@ -137,9 +135,8 @@ abstract class AbstractPart
|
|||
}
|
||||
}
|
||||
$parent->addPreserveText($textContent, $fontStyle, $paragraphStyle);
|
||||
|
||||
// List item
|
||||
} elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) {
|
||||
// List item
|
||||
$textContent = '';
|
||||
$numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId');
|
||||
$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);
|
||||
}
|
||||
$parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle);
|
||||
|
||||
// Heading
|
||||
} elseif (!empty($headingMatches)) {
|
||||
// Heading
|
||||
$textContent = '';
|
||||
$nodes = $xmlReader->getElements('w:r', $domNode);
|
||||
foreach ($nodes as $node) {
|
||||
$textContent .= $xmlReader->getValue('w:t', $node);
|
||||
}
|
||||
$parent->addTitle($textContent, $headingMatches[1]);
|
||||
|
||||
// Text and TextRun
|
||||
} else {
|
||||
// Text and TextRun
|
||||
$runCount = $xmlReader->countElements('w:r', $domNode);
|
||||
$linkCount = $xmlReader->countElements('w:hyperlink', $domNode);
|
||||
$runLinkCount = $runCount + $linkCount;
|
||||
|
|
@ -185,7 +180,6 @@ abstract class AbstractPart
|
|||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
* @param mixed $paragraphStyle
|
||||
* @return void
|
||||
*
|
||||
* @todo Footnote paragraph style
|
||||
*/
|
||||
|
|
@ -205,25 +199,22 @@ abstract class AbstractPart
|
|||
$parent->addLink($target, $textContent, $fontStyle, $paragraphStyle);
|
||||
}
|
||||
} else {
|
||||
// Footnote
|
||||
if ($xmlReader->elementExists('w:footnoteReference', $domNode)) {
|
||||
// Footnote
|
||||
$parent->addFootnote();
|
||||
|
||||
// Endnote
|
||||
} elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) {
|
||||
// Endnote
|
||||
$parent->addEndnote();
|
||||
|
||||
// Image
|
||||
} elseif ($xmlReader->elementExists('w:pict', $domNode)) {
|
||||
// Image
|
||||
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata');
|
||||
$target = $this->getMediaTarget($docPart, $rId);
|
||||
if (!is_null($target)) {
|
||||
$imageSource = "zip://{$this->docFile}#{$target}";
|
||||
$parent->addImage($imageSource);
|
||||
}
|
||||
|
||||
// Object
|
||||
} elseif ($xmlReader->elementExists('w:object', $domNode)) {
|
||||
// Object
|
||||
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject');
|
||||
// $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata');
|
||||
$target = $this->getMediaTarget($docPart, $rId);
|
||||
|
|
@ -231,9 +222,8 @@ abstract class AbstractPart
|
|||
$textContent = "<Object: {$target}>";
|
||||
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
||||
}
|
||||
|
||||
// TextRun
|
||||
} else {
|
||||
// TextRun
|
||||
$textContent = $xmlReader->getValue('w:t', $domNode);
|
||||
$parent->addText($textContent, $fontStyle, $paragraphStyle);
|
||||
}
|
||||
|
|
@ -247,7 +237,6 @@ abstract class AbstractPart
|
|||
* @param \DOMElement $domNode
|
||||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
* @return void
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -55,7 +55,6 @@ class DocPropsCore extends AbstractPart
|
|||
* Read core/extended document properties.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -32,7 +32,6 @@ class DocPropsCustom extends AbstractPart
|
|||
* Read custom document properties.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -40,7 +40,6 @@ class Document extends AbstractPart
|
|||
* Read document.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
@ -66,7 +65,6 @@ class Document extends AbstractPart
|
|||
*
|
||||
* @param array $settings
|
||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||
* @return void
|
||||
*/
|
||||
private function readHeaderFooter($settings, Section &$section)
|
||||
{
|
||||
|
|
@ -145,7 +143,6 @@ class Document extends AbstractPart
|
|||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $node
|
||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||
* @return void
|
||||
*
|
||||
* @todo <w:lastRenderedPageBreak>
|
||||
*/
|
||||
|
|
@ -175,7 +172,6 @@ class Document extends AbstractPart
|
|||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $node
|
||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||
* @return void
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -45,7 +45,6 @@ class Footnotes extends AbstractPart
|
|||
* Read (footnotes|endnotes).xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -31,7 +31,6 @@ class Numbering extends AbstractPart
|
|||
* Read numbering.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
@ -92,7 +91,7 @@ class Numbering extends AbstractPart
|
|||
*
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $subnode
|
||||
* @param integer $levelId
|
||||
* @param int $levelId
|
||||
* @return array
|
||||
*/
|
||||
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
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -29,14 +29,12 @@ use PhpOffice\PhpWord\Style\Language;
|
|||
*/
|
||||
class Settings extends AbstractPart
|
||||
{
|
||||
|
||||
private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders');
|
||||
|
||||
/**
|
||||
* Read settings.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
@ -76,7 +74,6 @@ class Settings extends AbstractPart
|
|||
*/
|
||||
protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node)
|
||||
{
|
||||
|
||||
$val = $xmlReader->getAttribute('w:val', $node);
|
||||
$eastAsia = $xmlReader->getAttribute('w:eastAsia', $node);
|
||||
$bidi = $xmlReader->getAttribute('w:bidi', $node);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -31,7 +31,6 @@ class Styles extends AbstractPart
|
|||
* Read styles.xml.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @return void
|
||||
*/
|
||||
public function read(PhpWord $phpWord)
|
||||
{
|
||||
|
|
@ -64,14 +63,12 @@ class Styles extends AbstractPart
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'character':
|
||||
$fontStyle = $this->readFontStyle($xmlReader, $node);
|
||||
if (!empty($fontStyle)) {
|
||||
$phpWord->addFontStyle($name, $fontStyle);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'table':
|
||||
$tStyle = $this->readTableStyle($xmlReader, $node);
|
||||
if (!empty($tStyle)) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2016 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2017 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
|
|
@ -180,6 +180,7 @@ class Settings
|
|||
{
|
||||
if (in_array($zipClass, array(self::PCLZIP, self::ZIPARCHIVE, self::OLD_LIB))) {
|
||||
self::$zipClass = $zipClass;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +230,6 @@ class Settings
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the directory path to the PDF Rendering Library.
|
||||
*
|
||||
|
|
@ -275,7 +275,7 @@ class Settings
|
|||
public static function setMeasurementUnit($value)
|
||||
{
|
||||
$units = array(self::UNIT_TWIP, self::UNIT_CM, self::UNIT_MM, self::UNIT_INCH,
|
||||
self::UNIT_POINT, self::UNIT_PICA);
|
||||
self::UNIT_POINT, self::UNIT_PICA, );
|
||||
if (!in_array($value, $units)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -289,9 +289,7 @@ class Settings
|
|||
*
|
||||
* @since 0.12.0
|
||||
*
|
||||
* @param string $tempDir The user defined path to temporary directory.
|
||||
*
|
||||
* @return void
|
||||
* @param string $tempDir The user defined path to temporary directory
|
||||
*/
|
||||
public static function setTempDir($tempDir)
|
||||
{
|
||||
|
|
@ -319,7 +317,7 @@ class Settings
|
|||
/**
|
||||
* @since 0.13.0
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -331,7 +329,7 @@ class Settings
|
|||
/**
|
||||
* @since 0.13.0
|
||||
*
|
||||
* @param boolean $outputEscapingEnabled
|
||||
* @param bool $outputEscapingEnabled
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
|
@ -360,6 +358,7 @@ class Settings
|
|||
{
|
||||
if (is_string($value) && trim($value) !== '') {
|
||||
self::$defaultFontName = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +368,7 @@ class Settings
|
|||
/**
|
||||
* Get default font size
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public static function getDefaultFontSize()
|
||||
{
|
||||
|
|
@ -384,9 +383,10 @@ class Settings
|
|||
*/
|
||||
public static function setDefaultFontSize($value)
|
||||
{
|
||||
$value = intval($value);
|
||||
$value = (int) $value;
|
||||
if ($value > 0) {
|
||||
self::$defaultFontSize = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ namespace PhpOffice\PhpWord\Shared;
|
|||
|
||||
abstract class AbstractEnum
|
||||
{
|
||||
|
||||
private static $constCacheArray = null;
|
||||
|
||||
private static function getConstants()
|
||||
|
|
@ -16,6 +15,7 @@ abstract class AbstractEnum
|
|||
$reflect = new \ReflectionClass($calledClass);
|
||||
self::$constCacheArray[$calledClass] = $reflect->getConstants();
|
||||
}
|
||||
|
||||
return self::$constCacheArray[$calledClass];
|
||||
}
|
||||
|
||||
|
|
@ -33,11 +33,12 @@ abstract class AbstractEnum
|
|||
* Returns true the value is valid for this enum
|
||||
*
|
||||
* @param strign $value
|
||||
* @return boolean true if value is valid
|
||||
* @return bool true if value is valid
|
||||
*/
|
||||
public static function isValid($value)
|
||||
{
|
||||
$values = array_values(self::getConstants());
|
||||
|
||||
return in_array($value, $values, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue