Skip to content

rename 'Object' classes to 'OLEObject' (php 7.2 compatibility) #1185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 65 commits into from
Dec 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
13a1c9f
A chart object can also be added to a table cell
Jul 29, 2015
d11b246
Fix Empty Dropdown Entry
Aug 6, 2015
f7afdeb
Added support for linebreaks <br /> in Shared\Html::addHtml()
anrikun Nov 12, 2015
0857f36
Add TextRun as container for CheckBox
solovyovbdc Feb 12, 2016
05387fa
enable password setting in word
mariahaubner Mar 10, 2017
483a167
refactoring of hash function
mariahaubner Mar 10, 2017
703e341
refactored hash function to word settings
mariahaubner Mar 10, 2017
0221414
randomly genereate salt for word password protection
mariahaubner Mar 10, 2017
7624663
add test
mariahaubner Mar 10, 2017
71574d1
Code Review; minor changes to salt handling, corrected some comments
Mar 13, 2017
9474e97
rename 'Object' classes to 'ObjectElement' (php72 compatibility)
SailorMax Nov 8, 2017
2a84625
changelog note
SailorMax Nov 8, 2017
2c2fbf9
Merge branch 'develop' into php72_support_object_classes
troosan Nov 22, 2017
7b30145
Merge branch 'develop' into feature/EnablePasswordProtection
troosan Nov 22, 2017
ad83196
move password encoding in separate class
troosan Nov 23, 2017
2e56251
Add unit tests for PasswordEncoder
troosan Nov 24, 2017
2138ea9
Update .travis.yml
troosan Dec 4, 2017
015e5df
Merge branch 'develop' into php72_support_object_classes
troosan Dec 4, 2017
04c289f
Merge branch 'develop' into php72_support_object_classes
troosan Dec 4, 2017
86115b9
update installation instructions
troosan Dec 4, 2017
cfc89b7
Merge branch 'develop' into feature/EnablePasswordProtection
troosan Dec 4, 2017
3b7b894
Merge branch 'develop' into feature/EnablePasswordProtection
troosan Dec 4, 2017
05e2f1b
use non deprecated method
troosan Dec 5, 2017
8f512bf
Merge branch 'develop-html-br' of https://github.com/anrikun/PHPWord
troosan Dec 5, 2017
9081ed9
fix warning
troosan Dec 5, 2017
c079bf7
update changelog
troosan Dec 5, 2017
fd156bf
Merge branch 'develop' into html_br
troosan Dec 5, 2017
905029a
Merge branch 'develop' into html_br
troosan Dec 5, 2017
0c7593b
Merge pull request #582 from SSchwaiger/patch-2
troosan Dec 5, 2017
d4c6427
Merge pull request #727 from irond/container_for_checkbox
troosan Dec 5, 2017
88bbe49
Merge pull request #1217 from troosan/html_br
troosan Dec 5, 2017
f6dd78d
update doc and changelog
troosan Dec 5, 2017
194e5c4
Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into d…
troosan Dec 5, 2017
253b060
correctly parse on/off values (w:val="true|false|1|0|on|off")
troosan Dec 13, 2017
dc7cb1e
update changelog & doc
troosan Dec 13, 2017
9e02941
align with pull request submitted in PHPOffice/Commom
troosan Dec 13, 2017
f7d2ad7
formatting
troosan Dec 13, 2017
ad38d4c
Merge branch 'feature/EnablePasswordProtection' of https://github.com…
troosan Dec 13, 2017
5a57409
fix tests
troosan Dec 13, 2017
5d5362a
sort imports
troosan Dec 13, 2017
87acd37
Clean elses
carusogabriel Dec 14, 2017
219f3bc
Merge pull request #1221 from troosan/fix_parsing_of_on-off
troosan Dec 18, 2017
46a037e
add composer scripts
troosan Dec 18, 2017
81dd5a2
rename ObjectElement to OLEObject
troosan Dec 18, 2017
0f200d9
Merge pull request #1222 from carusogabriel/clean-elses
troosan Dec 19, 2017
8929917
Merge pull request #592 from ComputerTinker/ComputerTinker-FixEmptyDr…
troosan Dec 19, 2017
7908491
revert mistakenly deleted line
troosan Dec 19, 2017
200c2f1
Merge pull request #1019 from jun-i-corn/feature/EnablePasswordProtec…
troosan Dec 20, 2017
3e6745f
HTML image support & TextRun paragraph style (#934)
adambalint-srg Dec 20, 2017
ed704da
set release date
troosan Dec 25, 2017
56720df
update version
troosan Dec 25, 2017
6daf31b
Merge pull request #1226 from PHPOffice/develop
troosan Dec 25, 2017
7250b15
Title can be added in Cell
troosan Dec 25, 2017
4767703
Merge branch 'master' of https://github.com/PHPOffice/PHPWord into up…
troosan Dec 25, 2017
512cf95
randomise temp directory name to avoid collisions
troosan Dec 25, 2017
fce1bf2
format code
troosan Dec 25, 2017
b614497
fix dependencies to have 7.1 compatible build (#1228)
troosan Dec 29, 2017
fd7ee76
create alias for develop branch
troosan Dec 29, 2017
d2b9e88
add parsing of "align" HTML attribute
troosan Dec 29, 2017
1d8e7b8
split composer scripts, add description (only works with composer 1.6)
troosan Dec 29, 2017
b20cd4f
output the source code of the sample that was run
troosan Dec 29, 2017
46e179d
add instructions on how to run the samples in a browser
troosan Dec 29, 2017
709ea1e
update changelog [skip ci]
troosan Dec 29, 2017
537d07e
rename ObjectElement to OLEObject
troosan Dec 18, 2017
ab913b9
Merge branch 'php72_support_object_classes' of
troosan Dec 29, 2017
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
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tools:
ruleset: phpmd.xml.dist
external_code_coverage:
enabled: true
timeout: 900
timeout: 1200
php_cpd: true
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
# min_mass: 40
Expand Down
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2

matrix:
include:
- php: 5.6
env: COVERAGE=1
allow_failures:
<<<<<<< HEAD
=======
- php: 7.0
- php: 7.1
>>>>>>> branch 'php72_support_object_classes' of https://github.com/SailorMax/PHPWord
- php: 7.2

cache:
directories:
Expand Down
24 changes: 19 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

v0.14.0 (?? Dec 2017)
v0.15.0 (?? ??? 2018)
----------------------
### Added
- Parsing of "align" HTML attribute - @troosan #1231

### Fixed

v0.14.0 (29 Dec 2017)
----------------------
This release fixes several bugs and adds some new features.
This is the last version to support PHP 5.3
This version brings compatibility with PHP 7.0 & 7.1

### Added
- Possibility to control the footnote numbering - @troosan #1068
Expand All @@ -18,15 +25,20 @@ This is the last version to support PHP 5.3
- Support for Comments - @troosan #1067
- Support for paragraph textAlignment - @troosan #1165
- Add support for HTML underline tag <u> in addHtml - @zNightFalLz #1186
- Allow to change cell width unit - @guillaume-ro-fr #986
- Add support for HTML <br> in addHtml - @anrikun @troosan #659
- Allow to change cell width unit - guillaume-ro-fr #986
- Allow to change the line height rule @troosan
- Implement PageBreak for odt writer @cookiekiller #863 #824
- Allow to force an update of all fields on opening a document - @troosan #951
- Allow adding a CheckBox in a TextRun - @irond #727
- Add support for HTML img tag - @srggroup #934
- Add support for password protection for docx - @mariahaubner #1019

### Fixed
- Loosen dependency to Zend
- Images are not being printed when generating PDF - @hubertinio #1074 #431
- Fixed some PHP 7 warnings - @likeuntomurphy #927
- Fixed some PHP 7 warnings - @ likeuntomurphy #927
- Fixed PHP 7.2 compatibility (renamed `Object` class names to `ObjectElement`) - @SailorMax #1185
- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892
- Fixed image loading over https - @troosan #988
- Impossibility to set different even and odd page headers - @troosan #981
Expand All @@ -40,8 +52,10 @@ This is the last version to support PHP 5.3
- Padded the $args array to remove error - @kaigoh #1150, @reformed #870
- Fix incorrect image size between windows and mac - @bskrtich #874
- Fix adding HTML table to document - @mogilvie @arivanbastos #324
- Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219
- Fix error on Empty Dropdown Entry - @ComputerTinker #592

###Deprecated
### Deprecated
- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection();

v0.13.0 (31 July 2016)
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,22 @@ PHPWord requires the following:
## Installation

PHPWord is installed via [Composer](https://getcomposer.org/).
You just need to [add dependency](https://getcomposer.org/doc/04-schema.md#package-links>) on PHPWord into your package.
To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links>) to PHPWord in your project, either

Example:
Run the following to use the latest stable version
```sh
composer require phpoffice/phpword
```
or if you want the latest master version
```sh
composer require phpoffice/phpword:dev-master
```

You can of course also manually edit your composer.json file
```json
{
"require": {
"phpoffice/phpword": "v0.13.*"
"phpoffice/phpword": "v0.14.*"
}
}
```
Expand Down Expand Up @@ -153,7 +161,8 @@ $objWriter->save('helloWorld.html');
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
```

More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail.
More examples are provided in the [samples folder](samples/). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http://localhost:8000](http://localhost:8000) to view the samples.
You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail.

## Contributing

Expand Down
37 changes: 32 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,46 @@
"name": "Antoine de Troostembergh"
}
],
"scripts": {
"test": [
"./vendor/bin/phpunit --color=always"
],
"test-no-coverage": [
"./vendor/bin/phpunit --color=always --no-coverage"
],
"check": [
"./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff",
"./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
"./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"@test"
],
"fix": [
"./vendor/bin/php-cs-fixer fix --ansi"
]
},
"scripts-descriptions": {
"test": "Runs all unit tests",
"test-no-coverage": "Runs all unit tests, without code coverage",
"check": "Runs PHP CheckStyle and PHP Mess detector",
"fix": "Fixes issues found by PHP-CS"
},
"require": {
"php": ">=5.3.3",
"php": "^5.3.3 || ^7.0",
"ext-xml": "*",
"zendframework/zend-escaper": "^2.2",
"zendframework/zend-stdlib": "^2.2 || ^3.0",
"phpoffice/common": "^0.2"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36",
"phpunit/phpunit": "^4.8.36 || ^5.0",
"phpdocumentor/phpdocumentor":"2.*",
"twig/twig":"1.27",
"squizlabs/php_codesniffer": "^2.7",
"friendsofphp/php-cs-fixer": "^2.0",
"phpmd/phpmd": "2.*",
"phploc/phploc": "2.*",
"phploc/phploc": "2.* || 3.* || 4.*",
"dompdf/dompdf":"0.8.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*"
"mpdf/mpdf": "5.* || 6.* || 7.*"
},
"suggest": {
"ext-zip": "Allows writing OOXML and ODF",
Expand All @@ -64,5 +86,10 @@
"psr-4": {
"PhpOffice\\PhpWord\\": "src/PhpWord"
}
},
"extra": {
"branch-alias": {
"dev-develop": "0.15.0-dev"
}
}
}
17 changes: 12 additions & 5 deletions docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
Issue tracker is **ONLY** used for reporting bugs. NO NEW FEATURE ACCEPTED! Use [stackoverflow](https://stackoverflow.com/questions/tagged/phpword) for supporting issues.
This is:

- [ ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)

# Expected Behavior

Please describe the behavior you are expecting.

# Current Behavior
### Current Behavior

What is the current behavior?

# Failure Information
### Failure Information

Please help provide information about the failure.

## How to Reproduce
### How to Reproduce

Please provide a code sample that reproduces the issue.

```php
<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->...
```

## Context
### Context

* PHP version:
* PHPWord version: 0.14
7 changes: 3 additions & 4 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Description
### Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

# Checklist:
### Checklist:

- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have run phpunit, phpcs, php-cs-fixer, phpmd
- [ ] I have run `composer check` and no errors were reported
- [ ] The new code is covered by unit tests
- [ ] I have update the documentation to describe the changes
21 changes: 18 additions & 3 deletions docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 15 | Endnote | v | - | - | v\*\* | v\*\* | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 16 | CheckBox | v | v | v | v | - | - |
| 16 | CheckBox | v | v | v | v | v | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 17 | TextBox | v | v | v | v | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 18 | Field | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 19 | Line | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 20 | Chart | v | | | v | | |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+

Legend:

Expand Down Expand Up @@ -408,7 +410,7 @@ For instance for the INDEX field, you can do the following (See `Index Field for
$section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText);

Line
------
----

Line elements can be added to sections by using ``addLine``.

Expand All @@ -428,8 +430,21 @@ Available line style attributes:
- ``height``. Line-object height in pt.
- ``flip``. Flip the line element: true, false.

Chart
-----

Charts can be added using

.. code-block:: php

$categories = array('A', 'B', 'C', 'D', 'E');
$series = array(1, 3, 2, 5, 4);
$chart = $section->addChart('line', $categories, $series);

check out the Sample_32_Chart.php for more options and styling.

Comments
---------
--------

Comments can be added to a document by using ``addComment``.
The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``.
Expand Down
11 changes: 11 additions & 0 deletions docs/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,17 @@ points to twips.
// 2 cm right margin
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2));

Document protection
-------------------

The document (or parts of it) can be password protected.

.. code-block:: php

$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(DocProtect::READ_ONLY);
$documentProtection->setPassword('myPassword');

Automatically Recalculate Fields on Open
----------------------------------------

Expand Down
20 changes: 0 additions & 20 deletions run_tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion samples/Sample_26_Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</li>
</ul>';

$html .= '<table style="width: 50%; border: 6px #0000FF double;">
$html .= '<table align="center" style="width: 50%; border: 6px #0000FF double;">
<thead>
<tr style="background-color: #FF0000; text-align: center; color: #FFFFFF; font-weight: bold; ">
<th style="width: 50pt">header a</th>
Expand Down
21 changes: 21 additions & 0 deletions samples/Sample_38_Protection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
use PhpOffice\PhpWord\SimpleType\DocProtect;

include_once 'Sample_Header.php';

// New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();

$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(DocProtect::READ_ONLY);
$documentProtection->setPassword('myPassword');

$section = $phpWord->addSection();
$section->addText('this document is password protected');

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
15 changes: 13 additions & 2 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@
// Populate samples
$files = '';
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
$sampleFiles = array();
while (false !== ($sampleFile = readdir($handle))) {
$sampleFiles[] = $sampleFile;
}
sort($sampleFiles);
closedir($handle);

foreach ($sampleFiles as $file) {
if (preg_match('/^Sample_\d+_/', $file)) {
$name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
$files .= "<li><a href='{$file}'>{$name}</a></li>";
}
}
closedir($handle);
}

/**
Expand Down Expand Up @@ -78,6 +84,11 @@ function write($phpWord, $filename, $writers)
}

$result .= getEndingNotes($writers);
$result .= '<pre><code>';
if (file_exists($filename . '.php')) {
$result .= highlight_file($filename . '.php', true);
}
$result .= '</code></pre>';

return $result;
}
Expand Down
Loading