Skip to content

Commit 1a9ed02

Browse files
authored
Merge branch 'develop' into fix_non_auto_line_spacing
2 parents 28e36fa + a44aee8 commit 1a9ed02

File tree

16 files changed

+127
-21
lines changed

16 files changed

+127
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ vendor
1818
/.settings
1919
phpword.ini
2020
/.buildpath
21+
/.scannerwork
2122
/.project
2223
/nbproject
2324
/.php_cs.cache

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ Change Log
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6-
v0.16.0 (xx xxx 2018)
6+
v0.16.0 (xx dec 2018)
77
----------------------
88
### Added
99

1010
### Fixed
1111
- Fix regex in `cloneBlock` function @nicoder #1269
1212
- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436
1313
- 240 twips are being added to line spacing, should not happen when using lineRule fixed @troosan #1509 #1505
14+
- Adding table layout to the generated HTML @aarangara #1441
15+
- Fix loading of Sharepoint document @Garrcomm #1498
16+
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
17+
- Fix parsing of Office 365 documents @Timanx #1485
1418

1519
v0.15.0 (14 Jul 2018)
1620
----------------------

docs/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Fixes # (issue)
88

99
- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
1010
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
11-
- [ ] I have update the documentation to describe the changes
11+
- [ ] I have updated the documentation to describe the changes

docs/styles.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Available Section style options:
2929
- ``marginRight``. Page margin right in *twip*.
3030
- ``marginBottom``. Page margin bottom in *twip*.
3131
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
32+
See ``\PhpOffice\PhpWord\Style\Section::ORIENTATION_...`` class constants for possible values
3233
- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
3334
- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
3435

@@ -45,7 +46,7 @@ Available Font style options:
4546
- ``color``. Font color, e.g. *FF0000*.
4647
- ``doubleStrikethrough``. Double strikethrough, *true* or *false*.
4748
- ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*.
48-
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` constants for more values
49+
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values
4950
- ``hint``. Font content type, *default*, *eastAsia*, or *cs*.
5051
- ``italic``. Italic, *true* or *false*.
5152
- ``name``. Font name, e.g. *Arial*.
@@ -56,7 +57,7 @@ Available Font style options:
5657
- ``subScript``. Subscript, *true* or *false*.
5758
- ``superScript``. Superscript, *true* or *false*.
5859
- ``underline``. Underline, *single*, *dash*, *dotted*, etc.
59-
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values
60+
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` class constants for possible values
6061
- ``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
6162
See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes.
6263
- ``position``. The text position, raised or lowered, in half points
@@ -69,7 +70,7 @@ Paragraph
6970
Available Paragraph style options:
7071

7172
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
72-
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
73+
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
7374
- ``basedOn``. Parent style.
7475
- ``hanging``. Hanging in *twip*.
7576
- ``indent``. Indent in *twip*.
@@ -82,14 +83,15 @@ Available Paragraph style options:
8283
- ``spaceAfter``. Space after paragraph in *twip*.
8384
- ``spacing``. Space between lines in *twip*. If spacingLineRule is auto, 240 (height of 1 line) will be added, so if you want a double line height, set this to 240.
8485
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
86+
See ``\PhpOffice\PhpWord\SimpleType\LineSpacingRule`` class constants for possible values.
8587
- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*.
8688
- ``tabs``. Set of custom tab stops.
8789
- ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*.
8890
- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*.
8991
- ``bidi``. Right to Left Paragraph Layout, *true* or *false*.
9092
- ``shading``. Paragraph Shading.
9193
- ``textAlignment``. Vertical Character Alignment on Line.
92-
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class for possible values.
94+
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class constants for possible values.
9395

9496
.. _table-style:
9597

@@ -99,7 +101,7 @@ Table
99101
Available Table style options:
100102

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

170172
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
171-
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
173+
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
172174
- ``font``. Font name.
173175
- ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter.
174176
- ``hanging``. See paragraph style.

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
<logging>
2424
<log type="coverage-html" target="./build/coverage" />
2525
<log type="coverage-clover" target="./build/logs/clover.xml" />
26+
<log type="junit" target="./build/logs/logfile.xml"/>
2627
</logging>
2728
</phpunit>

sonar-project.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# must be unique in a given SonarQube instance
2+
sonar.projectKey=phpoffice:phpword
3+
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
4+
sonar.projectName=PHPWord
5+
sonar.projectVersion=0.16
6+
7+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
8+
# This property is optional if sonar.modules is set.
9+
sonar.sources=src
10+
sonar.tests=tests
11+
sonar.php.coverage.reportPaths=build/logs/clover.xml
12+
sonar.php.tests.reportPath=build/logs/logfile.xml
13+
14+
# Encoding of the source code. Default is default system encoding
15+
#sonar.sourceEncoding=UTF-8
16+
17+
sonar.host.url=http://localhost:9000

src/PhpWord/Reader/MsDoc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,8 @@ private function readPrl($data, $pos, $cbNum)
21852185

21862186
$sprmCPicLocation += $embeddedBlipRH['recLen'];
21872187
break;
2188+
case self::OFFICEARTBLIPPNG:
2189+
break;
21882190
default:
21892191
// print_r(dechex($embeddedBlipRH['recType']));
21902192
}

src/PhpWord/Reader/Word2007.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public function load($docFile)
6262
foreach ($steps as $step) {
6363
$stepPart = $step['stepPart'];
6464
$stepItems = $step['stepItems'];
65+
if (!isset($relationships[$stepPart])) {
66+
continue;
67+
}
6568
foreach ($relationships[$stepPart] as $relItem) {
6669
$relType = $relItem['type'];
6770
if (isset($stepItems[$relType])) {

src/PhpWord/Shared/Html.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,6 @@ private static function mapAlign($cssAlignment)
753753
default:
754754
return Jc::START;
755755
}
756-
757-
return null;
758756
}
759757

760758
/**

src/PhpWord/TemplateProcessor.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,19 @@ protected function getHeaderName($index)
503503
}
504504

505505
/**
506+
* 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.
507+
*
506508
* @return string
507509
*/
508510
protected function getMainPartName()
509511
{
510-
return 'word/document.xml';
512+
$contentTypes = $this->zipClass->getFromName('[Content_Types].xml');
513+
514+
$pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~';
515+
516+
preg_match($pattern, $contentTypes, $matches);
517+
518+
return array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml';
511519
}
512520

513521
/**

0 commit comments

Comments
 (0)