Merge branch 'develop' into feature-add-table-indent-option
This commit is contained in:
commit
b394247740
|
|
@ -20,7 +20,8 @@ v0.15.0 (?? ??? 2018)
|
|||
- Added support for Image text wrapping distance @troosan #1310
|
||||
- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316
|
||||
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
|
||||
- Add support for table indent (tblInd) @Trainmaster
|
||||
- Add support for table indent (tblInd) @Trainmaster #1343
|
||||
- Added parsing of internal links in HTML reader @lalop #1336
|
||||
|
||||
### Fixed
|
||||
- Fix reading of docx default style - @troosan #1238
|
||||
|
|
@ -36,6 +37,7 @@ v0.15.0 (?? ??? 2018)
|
|||
|
||||
### Changed
|
||||
- Remove zend-stdlib dependency @Trainmaster #1284
|
||||
- The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`.
|
||||
|
||||
|
||||
v0.14.0 (29 Dec 2017)
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ To add an image, use the ``addImage`` method to sections, headers, footers, text
|
|||
|
||||
$section->addImage($src, [$style]);
|
||||
|
||||
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string.
|
||||
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. Warning: Do not pass user-generated strings here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing file paths or URLs instead of image data.
|
||||
- ``$style``. See :ref:`image-style`.
|
||||
|
||||
Examples:
|
||||
|
|
@ -435,8 +435,8 @@ Available line style attributes:
|
|||
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
|
||||
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
|
||||
- ``endArrow``. End type of arrow: block, open, classic, diamond, oval.
|
||||
- ``width``. Line-object width in pt.
|
||||
- ``height``. Line-object height in pt.
|
||||
- ``width``. Line-object width in *pt*.
|
||||
- ``height``. Line-object height in *pt*.
|
||||
- ``flip``. Flip the line element: true, false.
|
||||
|
||||
Chart
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ Image
|
|||
Available Image style options:
|
||||
|
||||
- ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
||||
- ``height``. Height in pixels.
|
||||
- ``height``. Height in *pt*.
|
||||
- ``marginLeft``. Left margin in inches, can be negative.
|
||||
- ``marginTop``. Top margin in inches, can be negative.
|
||||
- ``width``. Width in pixels.
|
||||
- ``width``. Width in *pt*.
|
||||
- ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*.
|
||||
- ``wrapDistanceTop``. Top text wrapping in pixels.
|
||||
- ``wrapDistanceBottom``. Bottom text wrapping in pixels.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ function write($phpWord, $filename, $writers)
|
|||
* Get ending notes
|
||||
*
|
||||
* @param array $writers
|
||||
*
|
||||
* @param mixed $filename
|
||||
* @return string
|
||||
*/
|
||||
function getEndingNotes($writers, $filename)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ class Html
|
|||
* Add HTML parts.
|
||||
*
|
||||
* Note: $stylesheet parameter is removed to avoid PHPMD error for unused parameter
|
||||
* Warning: Do not pass user-generated HTML here, as that would allow an attacker to read arbitrary
|
||||
* files or perform server-side request forgery by passing local file paths or URLs in <img>.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added
|
||||
* @param string $html The code to parse
|
||||
|
|
@ -721,6 +723,10 @@ class Html
|
|||
}
|
||||
self::parseInlineStyle($node, $styles['font']);
|
||||
|
||||
if (strpos($target, '#') === 0) {
|
||||
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
|
||||
}
|
||||
|
||||
return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
$section = $phpWord->addSection();
|
||||
Html::addHtml($section, '<p style="line-height: 1.5;">test</p>');
|
||||
Html::addHtml($section, '<p style="line-height: 15pt;">test</p>');
|
||||
Html::addHtml($section, '<p style="line-height: 120%;">test</p>');
|
||||
|
||||
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing'));
|
||||
|
|
@ -134,6 +135,10 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing'));
|
||||
$this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line'));
|
||||
$this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule'));
|
||||
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:pPr/w:spacing'));
|
||||
$this->assertEquals(Paragraph::LINE_HEIGHT * 1.2, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:line'));
|
||||
$this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:lineRule'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -453,6 +458,17 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
|
||||
$this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue);
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$section->addBookmark('bookmark');
|
||||
$html = '<p><a href="#bookmark">internal link text</a></p>';
|
||||
Html::addHtml($section, $html);
|
||||
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
|
||||
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
|
||||
$this->assertTrue($doc->getElement('/w:document/w:body/w:p/w:hyperlink')->hasAttribute('w:anchor'));
|
||||
$this->assertEquals('bookmark', $doc->getElement('/w:document/w:body/w:p/w:hyperlink')->getAttribute('w:anchor'));
|
||||
}
|
||||
|
||||
public function testParseMalformedStyleIsIgnored()
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$phpWord = new PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$style = array('width' => 1000000, 'height' => 1000000);
|
||||
$style = array('width' => 1000000, 'height' => 1000000, 'showAxisLabels' => true, 'showGridX' => true, 'showGridY' => true);
|
||||
|
||||
$chartTypes = array('pie', 'doughnut', 'bar', 'line', 'area', 'scatter', 'radar');
|
||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class FontTest extends \PHPUnit\Framework\TestCase
|
|||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true));
|
||||
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true, 'lang' => 'ar-DZ'));
|
||||
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
|
||||
|
||||
$file = 'word/document.xml';
|
||||
|
|
|
|||
Loading…
Reference in New Issue