Skip to content

Commit c67da2e

Browse files
committed
WIP
1 parent 06c2f56 commit c67da2e

File tree

154 files changed

+3419
-2323
lines changed

Some content is hidden

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

154 files changed

+3419
-2323
lines changed

.travis.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ language: php
33
dist: precise
44

55
php:
6-
- 5.3
7-
- 5.4
8-
- 5.5
9-
- 5.6
106
- 7.0
117
- 7.1
128
- 7.2
@@ -16,12 +12,9 @@ matrix:
1612
include:
1713
- php: 7.0
1814
env: COVERAGE=1
19-
- php: 5.3
20-
env: COMPOSER_MEMORY_LIMIT=2G
2115
- php: 7.3
2216
env: DEPENDENCIES="--ignore-platform-reqs"
2317
exclude:
24-
- php: 5.3
2518
- php: 7.0
2619
- php: 7.3
2720

docs/elements.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ Table style can be defined with ``addTableStyle``:
218218
.. code-block:: php
219219
220220
$tableStyle = array(
221-
'borderColor' => '006699',
221+
'borderColor' => new Hex('006699'),
222222
'borderSize' => 6,
223223
'cellMargin' => 50
224224
);
225-
$firstRowStyle = array('bgColor' => '66BBFF');
225+
$firstRowStyle = array('bgColor' => new Hex('66BBFF'));
226226
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
227227
$table = $section->addTable('myTable');
228228

docs/general.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
4848
$fontStyleName = 'oneUserDefinedStyle';
4949
$phpWord->addFontStyle(
5050
$fontStyleName,
51-
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
51+
array('name' => 'Tahoma', 'size' => 10, 'color' => new Hex('1B2232'), 'bold' => true)
5252
);
5353
$section->addText(
5454
'"The greatest accomplishment is not in never falling, '

docs/recipes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Apply 'HeadingN' paragraph style to TextRun or Link. Sample code:
7575
$phpWord = new \PhpOffice\PhpWord\PhpWord();
7676
$phpWord->addTitleStyle(1, array('size' => 16, 'bold' => true));
7777
$phpWord->addTitleStyle(2, array('size' => 14, 'bold' => true));
78-
$phpWord->addFontStyle('Link', array('color' => '0000FF', 'underline' => 'single'));
78+
$phpWord->addFontStyle('Link', array('color' => new Hex('0000FF'), 'underline' => 'single'));
7979
8080
$section = $phpWord->addSection();
8181

docs/styles.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Available Font style options:
4848
- ``color``. Font color, e.g. *FF0000*.
4949
- ``doubleStrikethrough``. Double strikethrough, *true* or *false*.
5050
- ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*.
51-
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values
51+
See ``\PhpOffice\PhpWord\Style\Colors\ForegroundColor::$allowed_colors`` variable for possible values
5252
- ``hint``. Font content type, *default*, *eastAsia*, or *cs*.
5353
- ``italic``. Italic, *true* or *false*.
5454
- ``name``. Font name, e.g. *Arial*.
@@ -105,15 +105,14 @@ Available Table style options:
105105

106106
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
107107
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
108-
- ``bgColor``. Background color, e.g. '9966CC'.
109-
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
110-
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
111-
- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*.
112-
- ``indent``. Table indent from leading margin. Must be an instance of ``\PhpOffice\PhpWord\ComplexType\TblWidth``.
113-
- ``width``. Table width in Fiftieths of a Percent or Twentieths of a Point.
114-
- ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*.
108+
- ``bgColor``. Background color. Must be an instance of ``\PhpOffice\PhpWord\Style\Colors\ColorInterface``.
109+
- ``border(Top|Right|Bottom|Left)Color``. Border color. Must be an instance of ``\PhpOffice\PhpWord\Style\Colors\ColorInterface``.
110+
- ``border(Top|Right|Bottom|Left)Size``. Border size. Must be an instance of ``\PhpOffice\PhpWord\Style\Lengths\Absolute``.
111+
- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin. Must be an instance of ``\PhpOffice\PhpWord\Style\Lengths\Absolute``.
112+
- ``indent``. Table indent from leading margin. Must be an instance of ``\PhpOffice\PhpWord\Lengths\Length``.
113+
- ``width``. Table width. Must be an instance of ``\PhpOffice\PhpWord\Lengths\Length``.
115114
- ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants.
116-
- ``cellSpacing`` Cell spacing in *twip*
115+
- ``cellSpacing`` Cell spacing. Must be an instance of ``\PhpOffice\PhpWord\Lengths\Absolute``
117116
- ``position`` Floating Table Positioning, see below for options
118117
- ``bidiVisual`` Present table as Right-To-Left
119118

docs/templates-processing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ The result will be
8989
9090
Customer: ${customer_name#1}
9191
Address: ${customer_address#1}
92-
92+
9393
Customer: ${customer_name#2}
9494
Address: ${customer_address#2}
95-
95+
9696
Customer: ${customer_name#3}
9797
Address: ${customer_address#3}
9898
@@ -113,7 +113,7 @@ The result will then be
113113
114114
Customer: Batman
115115
Address: Gotham City
116-
116+
117117
Customer: Superman
118118
Address: Metropolis
119119
@@ -234,7 +234,7 @@ See ``Sample_40_TemplateSetComplexValue.php`` for examples.
234234

235235
.. code-block:: php
236236
237-
$table = new Table(array('borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP));
237+
$table = new Table(array('borderSize' => 12, 'borderColor' => 'green', 'width' => Absolute::from("twip", 6000)));
238238
$table->addRow();
239239
$table->addCell(150)->addText('Cell A1');
240240
$table->addCell(150)->addText('Cell A2');

samples/Sample_01_SimpleText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
$textrun = $section->addTextRun();
4848
$textrun->addText('I am inline styled ', $fontStyle);
4949
$textrun->addText('with ');
50-
$textrun->addText('color', array('color' => '996699'));
50+
$textrun->addText('color', array('color' => new Hex('996699')));
5151
$textrun->addText(', ');
5252
$textrun->addText('bold', array('bold' => true));
5353
$textrun->addText(', ');

samples/Sample_03_Sections.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$phpWord = new \PhpOffice\PhpWord\PhpWord();
99

1010
// New portrait section
11-
$section = $phpWord->addSection(array('borderColor' => '00FF00', 'borderSize' => 12));
11+
$section = $phpWord->addSection(array('borderColor' => new Hex('00FF00'), 'borderSize' => 12));
1212
$section->addText('I am placed on a default section.');
1313

1414
// New landscape section

samples/Sample_04_Textrun.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
$phpWord->addFontStyle($boldFontStyleName, array('bold' => true));
1414

1515
$coloredFontStyleName = 'ColoredText';
16-
$phpWord->addFontStyle($coloredFontStyleName, array('color' => 'FF8080', 'bgColor' => 'FFFFCC'));
16+
$phpWord->addFontStyle($coloredFontStyleName, array('color' => new Hex('FF8080'), 'bgColor' => new Hex('FFFFCC')));
1717

1818
$linkFontStyleName = 'NLink';
19-
$phpWord->addLinkStyle($linkFontStyleName, array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
19+
$phpWord->addLinkStyle($linkFontStyleName, array('color' => new Hex('0000FF'), 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
2020

2121
// New portrait section
2222
$section = $phpWord->addSection();

samples/Sample_06_Footnote.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
$phpWord->addFontStyle($boldFontStyleName, array('bold' => true));
1818

1919
$coloredFontStyleName = 'ColoredText';
20-
$phpWord->addFontStyle($coloredFontStyleName, array('color' => 'FF8080', 'bgColor' => 'FFFFCC'));
20+
$phpWord->addFontStyle($coloredFontStyleName, array('color' => new Hex('FF8080'), 'bgColor' => new Hex('FFFFCC')));
2121

2222
$linkFontStyleName = 'NLink';
23-
$phpWord->addLinkStyle($linkFontStyleName, array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
23+
$phpWord->addLinkStyle($linkFontStyleName, array('color' => new Hex('0000FF'), 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
2424

2525
// New portrait section
2626
$section = $phpWord->addSection();

0 commit comments

Comments
 (0)