Skip to content

Commit 2e0eb70

Browse files
authored
Merge branch 'master' into word1692
2 parents 5d34906 + 1be7a80 commit 2e0eb70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1880
-31
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ _build
1212
/build
1313
phpunit.xml
1414
composer.phar
15+
composer.lock
1516
vendor
1617
/report
1718
/build

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@
108108
"require": {
109109
"php": "^7.1|^8.0",
110110
"ext-dom": "*",
111-
"ext-gd": "*",
111+
"ext-gd": "*",
112+
"ext-zip": "*",
112113
"ext-json": "*",
113114
"ext-xml": "*",
114-
"ext-zip": "*",
115115
"phpoffice/math": "^0.2"
116116
},
117117
"require-dev": {

docs/changes/1.x/1.4.0.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@
1212
- Added support for PHP 8.4 by [@Progi1984](https://github.com/Progi1984) in [#2660](https://github.com/PHPOffice/PHPWord/pull/2660)
1313
- Autoload : Allow to use PHPWord without Composer fixing [#2543](https://github.com/PHPOffice/PHPWord/issues/2543), [#2552](https://github.com/PHPOffice/PHPWord/issues/2552), [#2716](https://github.com/PHPOffice/PHPWord/issues/2716), [#2717](https://github.com/PHPOffice/PHPWord/issues/2717) in [#2722](https://github.com/PHPOffice/PHPWord/pull/2722)
1414
- Add Default font color for Word by [@Collie-IT](https://github.com/Collie-IT) in [#2700](https://github.com/PHPOffice/PHPWord/pull/2700)
15-
- Writer HTML: Support Default font color by [@MichaelPFrey](https://github.com/MichaelPFrey)
15+
- Writer HTML: Support Default font color by [@MichaelPFrey](https://github.com/MichaelPFrey) in [#2731](https://github.com/PHPOffice/PHPWord/pull/2731)
16+
- Writer ODText: Support Default font color by [@MichaelPFrey](https://github.com/MichaelPFrey) in [#2735](https://github.com/PHPOffice/PHPWord/pull/2735)
1617
- Add basic ruby text (phonetic guide) support for Word2007 and HTML Reader/Writer, RTF Writer, basic support for ODT writing by [@Deadpikle](https://github.com/Deadpikle) in [#2727](https://github.com/PHPOffice/PHPWord/pull/2727)
17-
18+
- Reader HTML: Support font styles for h1/h6 by [@Progi1984](https://github.com/Progi1984) fixing [#2619](https://github.com/PHPOffice/PHPWord/issues/2619) in [#2737](https://github.com/PHPOffice/PHPWord/pull/2737)
19+
- Writer EPub3: Basic support by [@Sambit003](https://github.com/Sambit003) fixing [#55](https://github.com/PHPOffice/PHPWord/issues/55) in [#2724](https://github.com/PHPOffice/PHPWord/pull/2724)
20+
1821
### Bug fixes
1922

2023
- Writer ODText: Support for images inside a textRun by [@Progi1984](https://github.com/Progi1984) fixing [#2240](https://github.com/PHPOffice/PHPWord/issues/2240) in [#2668](https://github.com/PHPOffice/PHPWord/pull/2668)
2124
- Allow vAlign and vMerge on Style\Cell to be set to null by [@SpraxDev](https://github.com/SpraxDev) fixing [#2673](https://github.com/PHPOffice/PHPWord/issues/2673) in [#2676](https://github.com/PHPOffice/PHPWord/pull/2676)
2225
- Reader HTML: Support for differents size units for table by [@Progi1984](https://github.com/Progi1984) fixing [#2384](https://github.com/PHPOffice/PHPWord/issues/2384), [#2701](https://github.com/PHPOffice/PHPWord/issues/2701) in [#2725](https://github.com/PHPOffice/PHPWord/pull/2725)
23-
- Reader Word2007 : Respect paragraph indent units by [@tugmaks](https://github.com/tugmaks) & [@Progi1984](https://github.com/Progi1984) fixing [#507](https://github.com/PHPOffice/PHPWord/issues/507) in [#2726](https://github.com/PHPOffice/PHPWord/pull/2726)
24-
- Reader Word2007 : Support Header elements within Title elements by [@SpraxDev](https://github.com/SpraxDev) fixing [#2616](https://github.com/PHPOffice/PHPWord/issues/2616), [#2426](https://github.com/PHPOffice/PHPWord/issues/2426) in [#2674](https://github.com/PHPOffice/PHPWord/pull/2674)
26+
- Reader Word2007: Respect paragraph indent units by [@tugmaks](https://github.com/tugmaks) & [@Progi1984](https://github.com/Progi1984) fixing [#507](https://github.com/PHPOffice/PHPWord/issues/507) in [#2726](https://github.com/PHPOffice/PHPWord/pull/2726)
27+
- Reader Word2007: Support Header elements within Title elements by [@SpraxDev](https://github.com/SpraxDev) fixing [#2616](https://github.com/PHPOffice/PHPWord/issues/2616), [#2426](https://github.com/PHPOffice/PHPWord/issues/2426) in [#2674](https://github.com/PHPOffice/PHPWord/pull/2674)
28+
- Reader HTML: Support for inherit value for property line-height by [@Progi1984](https://github.com/Progi1984) fixing [#2683](https://github.com/PHPOffice/PHPWord/issues/2683) in [#2733](https://github.com/PHPOffice/PHPWord/pull/2733)
29+
- Writer HTML: Fixed null string for Text Elements by [@armagedon007](https://github.com/armagedon007) and [@Progi1984](https://github.com/Progi1984) in [#2738](https://github.com/PHPOffice/PHPWord/pull/2738)
2530

2631
### Miscellaneous
2732

@@ -34,3 +39,9 @@
3439
- Deprecate `PhpOffice\PhpWord\Style\Paragraph::setIndent()` : Use `PhpOffice\PhpWord\Style\Paragraph::setIndentLeft()`
3540

3641
### BC Breaks
42+
43+
### Notes
44+
- Writer ODText previously used to set 'style:use-window-font-color' to 'true', now it is set to 'false'. (see [#2735](https://github.com/PHPOffice/PHPWord/pull/2735))
45+
The effect of this attribute is "implementation dependent" (if implemented at all).
46+
Setting it to false allows setting a default font color and improves interoperabilt,
47+
but may break certain specific use cases.

docs/install.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ require_once 'path/to/PHPWord/src/PhpWord/Autoloader.php';
4545

4646
The preferred method is the Composer one.
4747

48+
### Configuration
49+
50+
In order to configure you can create phpword.ini file and load configuration by calling Settings::loadConfig
51+
52+
``` php
53+
<?php
54+
55+
Settings::loadConfig();
56+
57+
```
58+
59+
You can also specify the config file location. (Do not use phpword.ini file in vendor folder)
60+
61+
``` php
62+
<?php
63+
64+
Settings::loadConfig(__DIR__ . '/../../phpword.ini');
65+
66+
```
67+
4868
## Samples
4969

5070
After installation, you can browse and use the samples that we've provided, either by command line or using browser. If you can access your PhpWord library folder using browser, point your browser to the `samples` folder, e.g. `http://localhost/PhpWord/samples/`.

docs/usage/writers.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ Settings::setPdfRendererName(Settings::PDF_RENDERER_MPDF);
110110
Settings::setPdfRendererPath(__DIR__ . '/../vendor/mpdf/mpdf');
111111
```
112112

113+
or you can edit settings in phpword.ini ( or phpword.ini.dist) file.
114+
115+
``` ini
116+
pdfRendererName = MPDF ;DomPDF, TCPDF, MPDF
117+
pdfRendererPath = /path/to/your/renderer/folder
118+
```
119+
113120
## RTF
114121
The name of the writer is `RTF`.
115122

samples/Sample_Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232

3333
// Set writers
34-
$writers = ['Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'];
34+
$writers = ['Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf', 'EPub3' => 'epub'];
3535

3636
// Set PDF renderer
3737
if (null === Settings::getPdfRendererPath()) {

src/PhpWord/Element/Link.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ public function getSource()
9999

100100
/**
101101
* Get link text.
102-
*
103-
* @return string
104102
*/
105-
public function getText()
103+
public function getText(): string
106104
{
107105
return $this->text;
108106
}

src/PhpWord/Element/Text.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,8 @@ public function setText($text)
147147

148148
/**
149149
* Get Text content.
150-
*
151-
* @return ?string
152150
*/
153-
public function getText()
151+
public function getText(): ?string
154152
{
155153
return $this->text;
156154
}

src/PhpWord/IOFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class IOFactory
3636
*/
3737
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
3838
{
39-
if ($name !== 'WriterInterface' && !in_array($name, ['ODText', 'RTF', 'Word2007', 'HTML', 'PDF'], true)) {
39+
if ($name !== 'WriterInterface' && !in_array($name, ['ODText', 'RTF', 'Word2007', 'HTML', 'PDF', 'EPub3'], true)) {
4040
throw new Exception("\"{$name}\" is not a valid writer.");
4141
}
4242

src/PhpWord/Shared/Html.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,16 @@ protected static function parseNode($node, $element, $styles = [], $data = []):
211211

212212
// Node mapping table
213213
$nodes = [
214-
// $method $node $element $styles $data $argument1 $argument2
215-
'p' => ['Paragraph', $node, $element, $styles, null, null, null],
216-
'h1' => ['Heading', $node, $element, $styles, null, 'Heading1', null],
217-
'h2' => ['Heading', $node, $element, $styles, null, 'Heading2', null],
218-
'h3' => ['Heading', $node, $element, $styles, null, 'Heading3', null],
219-
'h4' => ['Heading', $node, $element, $styles, null, 'Heading4', null],
220-
'h5' => ['Heading', $node, $element, $styles, null, 'Heading5', null],
221-
'h6' => ['Heading', $node, $element, $styles, null, 'Heading6', null],
222-
'#text' => ['Text', $node, $element, $styles, null, null, null],
223-
'strong' => ['Property', null, null, $styles, null, 'bold', true],
214+
// $method $node $element $styles $data $argument1 $argument2
215+
'p' => ['Paragraph', $node, $element, $styles, null, null, null],
216+
'h1' => ['Heading', $node, $element, $styles, null, 'Heading1', null],
217+
'h2' => ['Heading', $node, $element, $styles, null, 'Heading2', null],
218+
'h3' => ['Heading', $node, $element, $styles, null, 'Heading3', null],
219+
'h4' => ['Heading', $node, $element, $styles, null, 'Heading4', null],
220+
'h5' => ['Heading', $node, $element, $styles, null, 'Heading5', null],
221+
'h6' => ['Heading', $node, $element, $styles, null, 'Heading6', null],
222+
'#text' => ['Text', $node, $element, $styles, null, null, null],
223+
'strong' => ['Property', null, null, $styles, null, 'bold', true],
224224
'b' => ['Property', null, null, $styles, null, 'bold', true],
225225
'em' => ['Property', null, null, $styles, null, 'italic', true],
226226
'i' => ['Property', null, null, $styles, null, 'italic', true],
@@ -742,7 +742,7 @@ protected static function parseStyleDeclarations(array $selectors, array $styles
742742
break;
743743
case 'line-height':
744744
$matches = [];
745-
if ($value === 'normal') {
745+
if ($value === 'normal' || $value === 'inherit') {
746746
$spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::AUTO;
747747
$spacing = 0;
748748
} elseif (preg_match('/([0-9]+\.?[0-9]*[a-z]+)/', $value, $matches)) {

0 commit comments

Comments
 (0)