Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b147919
write column width in ODT writer
troosan Apr 18, 2018
4d9e9bc
Merge branch 'develop' into column_width_for_odt
troosan Apr 25, 2018
94be56b
fix parsing of link style
troosan Apr 25, 2018
96a47ec
Drop GitHub pages
czosel Apr 26, 2018
65b0f06
New features when creating charts (#1332)
jaek-s May 11, 2018
e47ce1b
Coveralls integration
czosel May 19, 2018
453ddf0
Do not try to read document protection if not present
troosan May 20, 2018
7f46d95
Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into d…
troosan May 20, 2018
2480103
run coveralls when running build with code coverage
troosan May 20, 2018
2540641
disable external code coverage
troosan May 20, 2018
0b27bb9
update changelog
troosan May 20, 2018
cdb3633
Merge pull request #1360 from adfinis-forks/drop-gh-pages
troosan May 20, 2018
e6501eb
Update coverage badge
troosan May 20, 2018
90d4d30
Fix calls to the getEndingNotes method in the samples
WouterSioen May 23, 2018
c5d0f71
Merge pull request #1380 from WouterSioen/fix-get-ending-notes-calls
troosan May 23, 2018
0c9626c
add .gitattributes
troosan May 27, 2018
e02c5f7
Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into d…
troosan May 27, 2018
82f3a2a
Update documentation for Style::add*Style methods (#1383)
hultberg May 30, 2018
1a06173
Add parsing of html image in base64 format (#1382)
May 30, 2018
aa27109
Update Language.php
pianiomar May 31, 2018
0bd7c0b
Add constants for Italian
troosan May 31, 2018
4e37afa
Update CHANGELOG.md
troosan May 31, 2018
844a7c9
Merge pull request #1391 from omarpiani/develop
troosan Jun 1, 2018
d9ddc16
write column width in ODT writer
troosan Apr 18, 2018
da43a88
Address scrutinizer issues
troosan Jun 2, 2018
682b88b
Merge commit '4e37afa15da62cdd695a18db2a40d86615086e9d' into
troosan Jun 3, 2018
5b97190
remove unused imports
troosan Jun 3, 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
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build config
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/php_cs.dist export-ignore
/phpmd.xml.dist export-ignore
/phpstan.neon export-ignore

/composer.lock export-ignore

# git files
/.gitignore export-ignore
/.gitattributes export-ignore

# project directories
/build export-ignore
/docs export-ignore
/samples export-ignore

# tests
/phpunit.xml.dist export-ignore
/tests export-ignore
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tools:
config:
ruleset: phpmd.xml.dist
external_code_coverage:
enabled: true
enabled: false
timeout: 1200
php_cpd: true
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
Expand Down
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ before_script:
- composer self-update
- travis_wait composer install --prefer-source
## PHPDocumentor
- mkdir -p build/docs
##- mkdir -p build/docs
- mkdir -p build/coverage

script:
Expand All @@ -52,10 +52,8 @@ script:
## PHPLOC
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
## PHPDocumentor
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi

after_script:
## PHPDocumentor
- bash .travis_shell_after_success.sh
## Scrutinizer
- if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi
after_success:
## Coveralls
- if [ -n "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi
39 changes: 0 additions & 39 deletions .travis_shell_after_success.sh

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ v0.15.0 (?? ??? 2018)
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
- Add support for table indent (tblInd) @Trainmaster #1343
- Added parsing of internal links in HTML reader @lalop #1336
- Several improvements to charts @JAEK-S #1332
- Add parsing of html image in base64 format @jgpATs2w #1382

### Fixed
- Fix reading of docx default style - @troosan #1238
Expand All @@ -34,11 +36,14 @@ v0.15.0 (?? ??? 2018)
- Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292
- Fix parsing of Heading and Title formating @troosan @gthomas2 #465
- Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591
- Fix missing column width in ODText writer @potofcoffee #413

### Changed
- Remove zend-stdlib dependency @Trainmaster #1284
- The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`.

### Miscelaneous
- Drop GitHub pages, switch to coveralls for code coverage analysis @czosel #1360

v0.14.0 (29 Dec 2017)
----------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword)
[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPWord)
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?s=b5997ce59ac2816b4514f3a38de9900f6d492c1d)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/PHPWord/badge.svg?branch=develop)](https://coveralls.io/github/PHPOffice/PHPWord?branch=develop)
[![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads.png)](https://packagist.org/packages/phpoffice/phpword)
[![License](https://poser.pugx.org/phpoffice/phpword/license.png)](https://packagist.org/packages/phpoffice/phpword)
[![Join the chat at https://gitter.im/PHPOffice/PHPWord](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPWord)
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^5.0",
"phpdocumentor/phpdocumentor":"2.*",
"squizlabs/php_codesniffer": "^2.7",
"friendsofphp/php-cs-fixer": "^2.0",
"squizlabs/php_codesniffer": "^2.9",
"friendsofphp/php-cs-fixer": "^2.2",
"phpmd/phpmd": "2.*",
"phploc/phploc": "2.* || 3.* || 4.*",
"dompdf/dompdf":"0.8.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.* || 6.* || 7.*"
"mpdf/mpdf": "5.7.4 || 6.* || 7.*",
"php-coveralls/php-coveralls": "1.1.0 || ^2.0"
},
"suggest": {
"ext-zip": "Allows writing OOXML and ODF",
Expand Down
1 change: 0 additions & 1 deletion samples/Sample_01_SimpleText.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

include_once 'Sample_Header.php';

Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_07_TemplateCloneRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');

echo getEndingNotes(array('Word2007' => 'docx'));
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_07_TemplateCloneRow.docx');
if (!CLI) {
include_once 'Sample_Footer.php';
}
2 changes: 1 addition & 1 deletion samples/Sample_23_TemplateBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
echo date('H:i:s'), ' Saving the result document...', EOL;
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');

echo getEndingNotes(array('Word2007' => 'docx'));
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_23_TemplateBlock.docx');
if (!CLI) {
include_once 'Sample_Footer.php';
}
2 changes: 1 addition & 1 deletion samples/Sample_26_Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$html .= '<p>Some well-formed HTML snippet needs to be used</p>';
$html .= '<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>';

$html .= '<p>A link to <a href="http://phpword.readthedocs.io/">Read the docs</a></p>';
$html .= '<p>A link to <a href="http://phpword.readthedocs.io/" style="text-decoration: underline">Read the docs</a></p>';

$html .= '<p lang="he-IL" style="text-align: right; direction: rtl">היי, זה פסקה מימין לשמאל</p>';

Expand Down
4 changes: 2 additions & 2 deletions samples/Sample_32_Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
$section->addTitle('2D charts', 1);
$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous'));

$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar');
$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar');
$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column');
$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column');
$threeSeries = array('bar', 'line');
$categories = array('A', 'B', 'C', 'D', 'E');
$series1 = array(1, 3, 2, 5, 4);
Expand Down
10 changes: 10 additions & 0 deletions samples/resources/Sample_30_ReadHTML.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ <h1>Adding element via HTML</h1>
<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>
<p>Ordered (numbered) list:</p>
<ol><li>Item 1</li><li>Item 2</li></ol>

<p style="line-height:2">Double height</p>

<h2>Includes images</h2>
<img src="https://phpword.readthedocs.io/en/latest/_images/phpword.png" alt=""/>

<img src="https://localhost/gev/desarrollo/actividades/pruebas_14/5b064503587f7.jpeg" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b064503589db.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b0645035aac8.jpeg" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>

</body>
</html>
Empty file modified samples/results/.gitignore
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/PhpWord/Element/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public function getParent()
*
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
*/
public function setParentContainer(AbstractElement $container)
public function setParentContainer(self $container)
{
$this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1);
$this->parent = $container;
Expand Down
16 changes: 11 additions & 5 deletions src/PhpWord/Element/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ class Chart extends AbstractElement
* @param array $categories
* @param array $values
* @param array $style
* @param null|mixed $seriesName
*/
public function __construct($type, $categories, $values, $style = null)
public function __construct($type, $categories, $values, $style = null, $seriesName = null)
{
$this->setType($type);
$this->addSeries($categories, $values);
$this->addSeries($categories, $values, $seriesName);
$this->style = $this->setNewStyle(new ChartStyle(), $style, true);
}

Expand All @@ -86,7 +87,7 @@ public function getType()
*/
public function setType($value)
{
$enum = array('pie', 'doughnut', 'line', 'bar', 'column', 'area', 'radar', 'scatter');
$enum = array('pie', 'doughnut', 'line', 'bar', 'stacked_bar', 'percent_stacked_bar', 'column', 'stacked_column', 'percent_stacked_column', 'area', 'radar', 'scatter');
$this->type = $this->setEnumVal($value, $enum, 'pie');
}

Expand All @@ -95,10 +96,15 @@ public function setType($value)
*
* @param array $categories
* @param array $values
* @param null|mixed $name
*/
public function addSeries($categories, $values)
public function addSeries($categories, $values, $name = null)
{
$this->series[] = array('categories' => $categories, 'values' => $values);
$this->series[] = array(
'categories' => $categories,
'values' => $values,
'name' => $name,
);
}

/**
Expand Down
40 changes: 31 additions & 9 deletions src/PhpWord/Element/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,40 @@ public function setWidth($width)
public function countColumns()
{
$columnCount = 0;
if (is_array($this->rows)) {
$rowCount = count($this->rows);
for ($i = 0; $i < $rowCount; $i++) {
/** @var \PhpOffice\PhpWord\Element\Row $row Type hint */
$row = $this->rows[$i];
$cellCount = count($row->getCells());
if ($columnCount < $cellCount) {
$columnCount = $cellCount;
}

$rowCount = count($this->rows);
for ($i = 0; $i < $rowCount; $i++) {
/** @var \PhpOffice\PhpWord\Element\Row $row Type hint */
$row = $this->rows[$i];
$cellCount = count($row->getCells());
if ($columnCount < $cellCount) {
$columnCount = $cellCount;
}
}

return $columnCount;
}

/**
* The first declared cell width for each column
*
* @return int[]
*/
public function findFirstDefinedCellWidths()
{
$cellWidths = array();

foreach ($this->rows as $row) {
$cells = $row->getCells();
if (count($cells) <= count($cellWidths)) {
continue;
}
$cellWidths = array();
foreach ($cells as $cell) {
$cellWidths[] = $cell->getWidth();
}
}

return $cellWidths;
}
}
4 changes: 2 additions & 2 deletions src/PhpWord/PhpWord.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
* @method int addChart(Element\Chart $chart)
* @method int addComment(Element\Comment $comment)
*
* @method Style\Paragraph addParagraphStyle(string $styleName, array $styles)
* @method Style\Paragraph addParagraphStyle(string $styleName, mixed $styles)
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null)
* @method Style\Font addLinkStyle(string $styleName, mixed $styles)
* @method Style\Font addTitleStyle(int $depth, mixed $fontStyle, mixed $paragraphStyle = null)
* @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null)
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null)
* @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles)
*/
Expand Down
2 changes: 2 additions & 0 deletions src/PhpWord/Reader/Word2007/AbstractPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ private function findPossibleAttribute(XMLReader $xmlReader, \DOMElement $node,
return $possibleAttribute;
}
}

return null;
}

return $attributes;
Expand Down
4 changes: 3 additions & 1 deletion src/PhpWord/Reader/Word2007/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord,
$documentProtection = $phpWord->getSettings()->getDocumentProtection();

$edit = $xmlReader->getAttribute('w:edit', $node);
$documentProtection->setEditing($edit);
if ($edit !== null) {
$documentProtection->setEditing($edit);
}
}

/**
Expand Down
Loading