Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4105a9a
improve `cloneBlock` regex
nicoder Feb 2, 2018
dfa2f36
Merge pull request #1429 from PHPOffice/develop
troosan Jul 14, 2018
affccc7
Merge branch 'improve-cloneBlock-regex' of https://github.com/nicoder…
troosan Jul 17, 2018
0c3eb4b
Update Chart.php
Tom-Magill Jul 17, 2018
1392426
Update Chart.php
Tom-Magill Jul 17, 2018
8c62cea
Fix Writer losing text when Title contains a TextRun instead a string.
begnini Jul 18, 2018
e07c655
adapt test
troosan Jul 18, 2018
1951db5
update changelog
troosan Jul 18, 2018
f376f20
Merge pull request #1269 from nicoder/improve-cloneBlock-regex
troosan Jul 18, 2018
18c26f9
Merge pull request #1436 from begnini/fixing_title
troosan Jul 19, 2018
d09da0b
Update CHANGELOG.md
troosan Jul 19, 2018
2bfd82e
Merge pull request #1439 from PHPOffice/master
troosan Jul 21, 2018
e61c40e
Adding table layout to the generated HTML if element has layout style…
Jul 24, 2018
4b9ae18
Adding table layout to the generated HTML - fixed php-cs-fixer error
Jul 24, 2018
677e3f6
writer / word2007 / support valign and watermark withouth paragraph
SailorMax Jul 31, 2018
683d919
Added Dutch (nl-NL)
vblinden Sep 3, 2018
d8c0441
Fix indenting
vblinden Sep 3, 2018
8a20678
Merge pull request #1455 from vblinden/feature-dutch-language
troosan Oct 3, 2018
1876062
Merge pull request #1445 from FCG-Group/writer_fixes_valign_watermark
troosan Oct 3, 2018
7f55816
detect actual filename of document xml (prevent mismatching document2…
Oct 11, 2018
7eb19c8
add test case for issue #1253
Oct 11, 2018
e19de8e
#1253 - add explanatory comment
Oct 11, 2018
28505b0
RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals
Oct 25, 2018
54eb6e6
Fix for undefined index
Nov 6, 2018
768a070
add/align possible values from class constant
gimler Nov 12, 2018
9f28ece
Fix path to test document
troosan Nov 16, 2018
c51b6fe
rename variable to comply with rules
troosan Nov 16, 2018
925e9e0
remove trailing spaces
troosan Nov 16, 2018
ea6edf9
Added PHP 7.3 support for travis (#1495)
arzurchris Nov 16, 2018
49eb9d1
Fix non auto line spacing (#1508)
troosan Nov 17, 2018
9b174e5
Fix typo in the PR template
carusogabriel Nov 19, 2018
663fb03
Use dedicated PHPUnit assertions
carusogabriel Nov 19, 2018
25348c6
Merge pull request #1504 from gimler/patch-1
troosan Nov 19, 2018
1a03a6c
Merge pull request #1512 from carusogabriel/patch-1
troosan Nov 19, 2018
d9d79c0
RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals
Oct 25, 2018
b5865b2
update changelog
troosan Nov 20, 2018
718f84c
Merge remote-tracking branch 'Patrick64/PHPWord/develop' into round_p…
troosan Nov 20, 2018
586f45e
Merge pull request #1493 from Patrick64/develop
troosan Nov 20, 2018
55da063
Merge remote-tracking branch 'upstream/develop' into rebase_pull_request
troosan Nov 20, 2018
79a7d5f
Merge remote-tracking branch 'upstream/develop' into rebase_pull_request
troosan Nov 20, 2018
1c20a4e
update changelog
troosan Nov 20, 2018
c12f98f
fix check style warning
troosan Nov 20, 2018
5ccf985
Added PHP 7.3 support for travis (#1495)
arzurchris Nov 16, 2018
a2a7073
update changelog
troosan Nov 22, 2018
d0bcfea
Merge branch 'develop' into fix-sharepoint
troosan Nov 22, 2018
a7bfc8d
Merge pull request #1485 from Timanx/develop
troosan Nov 25, 2018
78ffbff
Merge pull request #1498 from Garrcomm/fix-sharepoint
troosan Nov 25, 2018
7aef21f
add test for parsing HTML containing entities
troosan Nov 28, 2018
32fb85f
Added PHP 7.3 support for travis (#1495)
arzurchris Nov 16, 2018
b50de97
support `auto` table layout too
troosan Nov 28, 2018
f472bfb
Merge branch 'develop' into add_html_table_layout
troosan Nov 28, 2018
9dd5e0c
Merge pull request #1441 from aarangara/add_html_table_layout
troosan Nov 29, 2018
d9165f0
Merge pull request #1513 from carusogabriel/phpunit
troosan Nov 30, 2018
6a75946
add sonar config files
troosan Nov 30, 2018
a44aee8
fix some sonar warnings
troosan Nov 30, 2018
fb60865
test build php 7.3
troosan Dec 2, 2018
31968fa
Merge branch 'develop' of https://github.com/Tom-Magill/PHPWord into …
troosan Dec 2, 2018
5b688d5
fix formatting
troosan Dec 2, 2018
0c4bd1d
update documentation
troosan Dec 2, 2018
9f684c7
update changelog
troosan Dec 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ vendor
/.settings
phpword.ini
/.buildpath
/.scannerwork
/.project
/nbproject
/.php_cs.cache
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3

matrix:
include:
- php: 7.0
env: COVERAGE=1
- php: 5.3
env: COMPOSER_MEMORY_LIMIT=2G
- php: 7.3
env: DEPENDENCIES="--ignore-platform-reqs"
exclude:
- php: 5.3
- php: 7.0
- php: 7.3
allow_failures:
- php: 7.3

cache:
directories:
Expand All @@ -32,10 +43,10 @@ before_install:

before_script:
## Deactivate xdebug if we don't do code coverage
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi
## Composer
- composer self-update
- travis_wait composer install --prefer-source
- travis_wait composer install --prefer-source $(if [ -n "$DEPENDENCIES" ]; then echo $DEPENDENCIES; fi)
## PHPDocumentor
##- mkdir -p build/docs
- mkdir -p build/coverage
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

v0.16.0 (xx xxx 2018)
----------------------
### Added
- Add setting Chart Title and Legend visibility @Tom-Magill #1433

### Fixed
- Fix regex in `cloneBlock` function @nicoder #1269
- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436
- Adding table layout to the generated HTML @aarangara #1441
- Fix loading of Sharepoint document @Garrcomm #1498
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
- Fix parsing of Office 365 documents @Timanx #1485

v0.15.0 (14 Jul 2018)
----------------------
### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Fixes # (issue)

- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
- [ ] I have update the documentation to describe the changes
- [ ] I have updated the documentation to describe the changes
22 changes: 16 additions & 6 deletions docs/styles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Available Section style options:
- ``marginRight``. Page margin right in *twip*.
- ``marginBottom``. Page margin bottom in *twip*.
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
See ``\PhpOffice\PhpWord\Style\Section::ORIENTATION_...`` class constants for possible values
- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.

Expand All @@ -45,7 +46,7 @@ Available Font style options:
- ``color``. Font color, e.g. *FF0000*.
- ``doubleStrikethrough``. Double strikethrough, *true* or *false*.
- ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*.
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` constants for more values
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values
- ``hint``. Font content type, *default*, *eastAsia*, or *cs*.
- ``italic``. Italic, *true* or *false*.
- ``name``. Font name, e.g. *Arial*.
Expand All @@ -56,7 +57,7 @@ Available Font style options:
- ``subScript``. Subscript, *true* or *false*.
- ``superScript``. Superscript, *true* or *false*.
- ``underline``. Underline, *single*, *dash*, *dotted*, etc.
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` class constants for possible values
- ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages
See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes.
- ``position``. The text position, raised or lowered, in half points
Expand All @@ -69,7 +70,7 @@ Paragraph
Available Paragraph style options:

- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``basedOn``. Parent style.
- ``hanging``. Hanging in *twip*.
- ``indent``. Indent in *twip*.
Expand All @@ -82,14 +83,15 @@ Available Paragraph style options:
- ``spaceAfter``. Space after paragraph in *twip*.
- ``spacing``. Space between lines.
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
See ``\PhpOffice\PhpWord\SimpleType\LineSpacingRule`` class constants for possible values.
- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*.
- ``tabs``. Set of custom tab stops.
- ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*.
- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*.
- ``bidi``. Right to Left Paragraph Layout, *true* or *false*.
- ``shading``. Paragraph Shading.
- ``textAlignment``. Vertical Character Alignment on Line.
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class for possible values.
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class constants for possible values.

.. _table-style:

Expand All @@ -99,7 +101,7 @@ Table
Available Table style options:

- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details.
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``bgColor``. Background color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
Expand Down Expand Up @@ -168,7 +170,7 @@ Numbering level
Available NumberingLevel style options:

- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
- ``font``. Font name.
- ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter.
- ``hanging``. See paragraph style.
Expand All @@ -190,6 +192,14 @@ Available Chart style options:
- ``width``. Width (in EMU).
- ``height``. Height (in EMU).
- ``3d``. Is 3D; applies to pie, bar, line, area, *true* or *false*.
- ``colors``. A list of colors to use in the chart.
- ``title``. The title for the chart.
- ``showLegend``. Show legend, *true* or *false*.
- ``categoryLabelPosition``. Label position for categories, *nextTo* (default), *low* or *high*.
- ``valueLabelPosition``. Label position for values, *nextTo* (default), *low* or *high*.
- ``categoryAxisTitle``. The title for the category axis.
- ``valueAxisTitle``. The title for the values axis.
- ``majorTickMarkPos``. The position for major tick marks, *in*, *out*, *cross*, *none* (default).
- ``showAxisLabels``. Show labels for axis, *true* or *false*.
- ``gridX``. Show Gridlines for X-Axis, *true* or *false*.
- ``gridY``. Show Gridlines for Y-Axis, *true* or *false*.
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
<logging>
<log type="coverage-html" target="./build/coverage" />
<log type="coverage-clover" target="./build/logs/clover.xml" />
<log type="junit" target="./build/logs/logfile.xml"/>
</logging>
</phpunit>
17 changes: 17 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# must be unique in a given SonarQube instance
sonar.projectKey=phpoffice:phpword
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=PHPWord
sonar.projectVersion=0.16

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=src
sonar.tests=tests
sonar.php.coverage.reportPaths=build/logs/clover.xml
sonar.php.tests.reportPath=build/logs/logfile.xml

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

sonar.host.url=http://localhost:9000
2 changes: 2 additions & 0 deletions src/PhpWord/Reader/MsDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,8 @@ private function readPrl($data, $pos, $cbNum)

$sprmCPicLocation += $embeddedBlipRH['recLen'];
break;
case self::OFFICEARTBLIPPNG:
break;
default:
// print_r(dechex($embeddedBlipRH['recType']));
}
Expand Down
3 changes: 3 additions & 0 deletions src/PhpWord/Reader/Word2007.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public function load($docFile)
foreach ($steps as $step) {
$stepPart = $step['stepPart'];
$stepItems = $step['stepItems'];
if (!isset($relationships[$stepPart])) {
continue;
}
foreach ($relationships[$stepPart] as $relItem) {
$relType = $relItem['type'];
if (isset($stepItems[$relType])) {
Expand Down
3 changes: 1 addition & 2 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ private static function parseStyle($attribute, $styles)
$styles['bgColor'] = trim($cValue, '#');
break;
case 'line-height':
$matches = array();
if (preg_match('/([0-9]+\.?[0-9]*[a-z]+)/', $cValue, $matches)) {
$spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::EXACT;
$spacing = Converter::cssToTwip($matches[1]) / \PhpOffice\PhpWord\Style\Paragraph::LINE_HEIGHT;
Expand Down Expand Up @@ -743,8 +744,6 @@ private static function mapAlign($cssAlignment)
default:
return Jc::START;
}

return null;
}

/**
Expand Down
72 changes: 68 additions & 4 deletions src/PhpWord/Style/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ class Chart extends AbstractStyle
*/
private $colors = array();

/**
* Chart title
*
* @var string
*/
private $title = null;

/**
* Chart legend visibility
*
* @var bool
*/
private $showLegend = false;

/**
* A list of display options for data labels
*
Expand Down Expand Up @@ -97,9 +111,15 @@ class Chart extends AbstractStyle
*/
private $valueAxisTitle;

/**
* The position for major tick marks
* Possible values are 'in', 'out', 'cross', 'none'
*
* @var string
*/
private $majorTickMarkPos = 'none';

/*
/**
* Show labels for axis
*
* @var bool
Expand Down Expand Up @@ -221,6 +241,50 @@ public function setColors($value = array())
return $this;
}

/**
* Get the chart title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}

/**
* Set the chart title
*
* @param string $value
*/
public function setTitle($value = null)
{
$this->title = $value;

return $this;
}

/**
* Get chart legend visibility
*
* @return bool
*/
public function isShowLegend()
{
return $this->showLegend;
}

/**
* Set chart legend visibility
*
* @param bool $value
*/
public function setShowLegend($value = false)
{
$this->showLegend = $value;

return $this;
}

/*
* Show labels for axis
*
Expand Down Expand Up @@ -394,16 +458,16 @@ public function getMajorTickPosition()
}

/**
* set the position for major tick marks
* @param string $position [description]
* Set the position for major tick marks
* @param string $position
*/
public function setMajorTickPosition($position)
{
$enum = array('in', 'out', 'cross', 'none');
$this->majorTickMarkPos = $this->setEnumVal($position, $enum, $this->majorTickMarkPos);
}

/*
/**
* Show Gridlines for X-Axis
*
* @return bool
Expand Down
3 changes: 3 additions & 0 deletions src/PhpWord/Style/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ final class Language extends AbstractStyle
const PT_BR = 'pt-BR';
const PT_BR_ID = 1046;

const NL_NL = 'nl-NL';
const NL_NL_ID = 1043;

/**
* Language ID, used for RTF document generation
*
Expand Down
12 changes: 10 additions & 2 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function cloneBlock($blockname, $clones = 1, $replace = true)
{
$xmlBlock = null;
preg_match(
'/(<\?xml.*)(<w:p.*>\${' . $blockname . '}<\/w:.*?p>)(.*)(<w:p.*\${\/' . $blockname . '}<\/w:.*?p>)/is',
'/(<\?xml.*)(<w:p\b.*>\${' . $blockname . '}<\/w:.*?p>)(.*)(<w:p\b.*\${\/' . $blockname . '}<\/w:.*?p>)/is',
$this->tempDocumentMainPart,
$matches
);
Expand Down Expand Up @@ -503,11 +503,19 @@ protected function getHeaderName($index)
}

/**
* Usually, the name of main part document will be 'document.xml'. However, some .docx files (possibly those from Office 365, experienced also on documents from Word Online created from blank templates) have file 'document22.xml' in their zip archive instead of 'document.xml'. This method searches content types file to correctly determine the file name.
*
* @return string
*/
protected function getMainPartName()
{
return 'word/document.xml';
$contentTypes = $this->zipClass->getFromName('[Content_Types].xml');

$pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~';

preg_match($pattern, $contentTypes, $matches);

return array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml';
}

/**
Expand Down
Loading