This commit is contained in:
Progi1984 2014-12-10 19:55:07 +01:00
commit 2176232910
3 changed files with 127 additions and 102 deletions

View File

@ -2,64 +2,8 @@
This is the changelog between releases of PHPWord. Releases are listed in reverse chronological order with the latest version listed on top, while additions/changes in each release are listed in chronological order. Changes in each release are divided into three parts: added or change features, bugfixes, and miscellaneous improvements. Each line contains short information about the change made, the person who made it, and the related issue number(s) in GitHub. This is the changelog between releases of PHPWord. Releases are listed in reverse chronological order with the latest version listed on top, while additions/changes in each release are listed in chronological order. Changes in each release are divided into three parts: added or change features, bugfixes, and miscellaneous improvements. Each line contains short information about the change made, the person who made it, and the related issue number(s) in GitHub.
## 0.12.0 - Not yet released ## 0.11.2 - 10 December 2014
- Add new-page function for PDF generation. For multiple PDF-backends - @chc88 GH-426
This release added form fields (textinput, checkbox, and dropdown), drawing shapes (arc, curve, line, polyline, rect, oval), and basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) elements along with some new styles. Basic MsDoc reader is introduced.
### Features
- Element: Ability to add drawing shapes (arc, curve, line, polyline, rect, oval) using new `Shape` element - @ivanlanin GH-123
- Font: New `scale`, `spacing`, and `kerning` property of font style - @ivanlanin
- Paragraph: Added shading to the paragraph style for full width shading - @lrobert GH-264
- RTF Writer: Support for sections, margins, and borders - @ivanlanin GH-249
- Section: Ability to set paper size, e.g. A4, A3, and Legal - @ivanlanin GH-249
- General: New `PhpWord::save()` method to encapsulate `IOFactory` - @ivanlanin
- General: New `Shared\Converter` static class - @ivanlanin
- Chart: Basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) - @ivanlanin GH-278
- Chart: 3D charts and ability to set width and height - @ivanlanin
- FormField: Ability to add textinput, checkbox, and dropdown form elements - @ivanlanin GH-266
- Setting: Ability to define document protection (readOnly, comments, trackedChanges, forms) - @ivanlanin
- Setting: Ability to remove [Compatibility Mode] text in the MS Word title bar - @ivanlanin
- SDT: Ability to add structured document tag elements (comboBox, dropDownList, date) - @ivanlanin
- Paragraph: Support for paragraph with borders - @ivanlanin GH-294
- Word2007 Writer : Support for RTL - @Progi1984 GH-331
- MsDOC Reader: Basic MsDOC Reader - @Progi1984 GH-23 GH-287
- "absolute" horizontal and vertical positioning of Frame - @basjan GH-302
### Bugfixes
- Fix rare PclZip/realpath/PHP version problem - @andrew-kzoo GH-261
- `addHTML` encoding and ampersand fixes for PHP 5.3 - @bskrtich GH-270
- Page breaks on titles and tables - @ivanlanin GH-274
- Table inside vertical border does not rendered properly - @ivanlanin GH-280
- `add<elementName>` of container should be case insensitive, e.g. `addToc` should be accepted, not only `addTOC` - @ivanlanin GH-294
- Fix specific borders (and margins) were not written correctly in word2007 writer - @pscheit GH-327
- "HTML is not a valid writer" exception while running "Sample_36_RTL.php" - @RomanSyroeshko GH-340
- "addShape()" magic method in AbstractContainer is mistakenly named as "addObject()" - @GMTA GH-356
- `Element\Section::setPageSizeW()` and `Element\Section::setPageSizeH()` were mentioned in the docs but not implemented.
- Special Characters (ampersand) in Title break docx output - @RomanSyroeshko GH-401
- `<th>` tag is closed with `</td>` tag: - @franzholz GH-438
### Deprecated
- `Element\Link::getTarget()` replaced by `Element\Link::getSource()`
- `Element\Section::getSettings()` and `Element\Section::setSettings()` replaced by `Element\Section::getStyle()` and `Element\Section::setStyle()`
- `Shared\Drawing` and `Shared\Font` merged into `Shared\Converter`
- `DocumentProperties` replaced by `Metadata\DocInfo`
- `Template` replaced by `TemplateProcessor`
- `PhpWord->loadTemplate($filename)`
### Miscellaneous
- Docs: Add known issue on `README` about requirement for temporary folder to be writable and update `samples/index.php` for this requirement check - @ivanlanin GH-238
- Docs: Correct elements.rst about Line - @chrissharkman GH-292
- PclZip: Remove temporary file after used - @andrew-kzoo GH-265
- Autoloader: Add the ability to set the autoloader options - @bskrtich GH-267
- Element: Refactor elements to move set relation Id from container to element - @ivanlanin
- Introduced CreateTemporaryFileException, CopyFileException - @RomanSyroeshko
- Settings: added method to set user defined temporary directory - @RomanSyroeshko GH-310
- Renamed `Template` into `TemplateProcessor` - @RomanSyroeshko GH-216
- Reverted GH-51 - @RomanSyroeshko
## 0.11.1 - 2 June 2014 ## 0.11.1 - 2 June 2014

View File

@ -47,14 +47,6 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+ +-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 19 | Line | v | v | v | v | v | v | | 19 | Line | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+ +-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 20 | Shape | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 21 | Chart | v | - | - | - | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 22 | Form fields | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 23 | Bookmarks | v | - | - | v | v | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
Legend: Legend:
@ -79,6 +71,9 @@ as follow:
$section->addText($text, [$fontStyle], [$paragraphStyle]); $section->addText($text, [$fontStyle], [$paragraphStyle]);
$textrun = $section->addTextRun([$paragraphStyle]); $textrun = $section->addTextRun([$paragraphStyle]);
Text styles
~~~~~~~~~~~
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
define text formatting. There are 2 options to style the inserted text define text formatting. There are 2 options to style the inserted text
elements, i.e. inline style by using array or defined style by adding elements, i.e. inline style by using array or defined style by adding
@ -109,6 +104,47 @@ Defined style examples:
$phpWord->addParagraphStyle('pStyle', $paragraphStyle); $phpWord->addParagraphStyle('pStyle', $paragraphStyle);
$text = $section->addText('Hello world!', 'pStyle'); $text = $section->addText('Hello world!', 'pStyle');
Font style
^^^^^^^^^^
Available font styles:
- ``name`` Font name, e.g. *Arial*
- ``size`` Font size, e.g. *20*, *22*,
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
- ``bold`` Bold, *true* or *false*
- ``italic`` Italic, *true* or *false*
- ``superScript`` Superscript, *true* or *false*
- ``subScript`` Subscript, *true* or *false*
- ``underline`` Underline, *dash*, *dotted*, etc.
- ``strikethrough`` Strikethrough, *true* or *false*
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
- ``color`` Font color, e.g. *FF0000*
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
- ``bgColor`` Font background color, e.g. *FF0000*
- ``smallCaps`` Small caps, *true* or *false*
- ``allCaps`` All caps, *true* or *false*
Paragraph style
^^^^^^^^^^^^^^^
Available paragraph styles:
- ``align`` Paragraph alignment, *left*, *right* or *center*
- ``spaceBefore`` Space before paragraph
- ``spaceAfter`` Space after paragraph
- ``indent`` Indent by how much
- ``hanging`` Hanging by how much
- ``basedOn`` Parent style
- ``next`` Style for next paragraph
- ``widowControl`` Allow first/last line to display on a separate page,
*true* or *false*
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
- ``keepLines`` Keep all lines on one page, *true* or *false*
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
- ``tabs`` Set of custom tab stops
Titles Titles
~~~~~~ ~~~~~~
@ -131,13 +167,12 @@ You can add Hyperlinks to the document by using the function addLink:
.. code-block:: php .. code-block:: php
$section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle], [$isInternal]); $section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle]);
- ``$linkSrc`` The URL of the link. - ``$linkSrc`` The URL of the link.
- ``$linkName`` Placeholder of the URL that appears in the document. - ``$linkName`` Placeholder of the URL that appears in the document.
- ``$fontStyle`` See "Font style" section. - ``$fontStyle`` See "Font style" section.
- ``$paragraphStyle`` See "Paragraph style" section. - ``$paragraphStyle`` See "Paragraph style" section.
- ``$isInternal`` Set to true, if the link points to a bookmark inside the document
Preserve texts Preserve texts
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
@ -172,9 +207,9 @@ Page breaks
There are two ways to insert a page breaks, using the ``addPageBreak`` There are two ways to insert a page breaks, using the ``addPageBreak``
method or using the ``pageBreakBefore`` style of paragraph. method or using the ``pageBreakBefore`` style of paragraph.
.. code-block:: php :: code-block:: php
$section->addPageBreak(); \\$section->addPageBreak();
Lists Lists
----- -----
@ -217,6 +252,23 @@ You can also create your own numbering style by changing the
$section->addListItem('List Item I.b', 1, null, 'multilevel'); $section->addListItem('List Item I.b', 1, null, 'multilevel');
$section->addListItem('List Item II', 0, null, 'multilevel'); $section->addListItem('List Item II', 0, null, 'multilevel');
Level styles:
- ``start`` Starting value
- ``format`` Numbering format
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
- ``restart`` Restart numbering level symbol
- ``suffix`` Content between numbering symbol and paragraph text
tab\|space\|nothing
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
character
- ``align`` Numbering symbol align left\|center\|right\|both
- ``left`` See paragraph style
- ``hanging`` See paragraph style
- ``tabPos`` See paragraph style
- ``font`` Font name
- ``hint`` See font style
Tables Tables
------ ------
@ -242,6 +294,34 @@ Table style can be defined with ``addTableStyle``:
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle); $phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
$table = $section->addTable('myTable'); $table = $section->addTable('myTable');
Table, row, and cell styles
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Table styles:
- ``width`` Table width in percent
- ``bgColor`` Background color, e.g. '9966CC'
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
Row styles:
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
- ``exactHeight`` Row height is exact or at least
Cell styles:
- ``width`` Cell width in twips
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
- ``textDirection`` Direction of text
- ``bgColor`` Background color, e.g. '9966CC'
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
- ``gridSpan`` Number of columns spanned
- ``vMerge`` *restart* or *continue*
Cell span Cell span
~~~~~~~~~ ~~~~~~~~~
@ -288,6 +368,19 @@ Examples:
$textrun = $section->addTextRun(); $textrun = $section->addTextRun();
$textrun->addImage('http://php.net/logo.jpg'); $textrun->addImage('http://php.net/logo.jpg');
Image styles
~~~~~~~~~~~~
Available image styles:
- ``width`` Width in pixels
- ``height`` Height in pixels
- ``align`` Image alignment, *left*, *right*, or *center*
- ``marginTop`` Top margin in inches, can be negative
- ``marginLeft`` Left margin in inches, can be negative
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
*behind*, or *infront*
Watermarks Watermarks
~~~~~~~~~~ ~~~~~~~~~~
@ -390,56 +483,30 @@ Checkbox elements can be added to sections or table cells by using
Textboxes Textboxes
--------- ---------
To be completed. To be completed
Fields Fields
------ ------
To be completed. To be completed
Lines Line
----- ------
Line elements can be added to sections by using ``addLine``. Line elements can be added to sections by using ``addLine``.
.. code-block:: php .. code-block:: php
$linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => '#b2a68b'); $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552);
$section->addLine($lineStyle) $section->addLine($lineStyle)
Available line style attributes: Available line style attributes:
- ``weight`` Line width in twips - ``weight`` Line width in twips
- ``color`` Defines the color of stroke. The hex value must be introduced with #. - ``color`` Defines the color of stroke
- ``dash`` Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot - ``dash`` Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot
- ``beginArrow`` Start type of arrow: block, open, classic, diamond, oval - ``beginArrow`` Start type of arrow: block, open, classic, diamond, oval
- ``endArrow`` End type of arrow: block, open, classic, diamond, ovel - ``endArrow`` End type of arrow: block, open, classic, diamond, ovel
- ``width`` Line-object width in pt - ``width`` Line-object width in pt
- ``height`` Line-object height in pt - ``height`` Line-object height in pt
- ``flip`` Flip the line element: true, false - ``flip`` Flip the line element: true, false
Shapes
------
To be completed.
Charts
------
To be completed.
Form fields
-----------
To be completed.
Bookmarks
~~~~~
You can add Bookmarks to the document by using the function addBookmark:
.. code-block:: php
$section->addBookmark($name);
- ``$name`` The name of the bookmark which can be referenced in the addLink-Function as target. Should obviously be unique throughout the document.

View File

@ -24,4 +24,18 @@ namespace PhpOffice\PhpWord\Writer\HTML\Element;
*/ */
class PageBreak extends TextBreak class PageBreak extends TextBreak
{ {
/**
* Write page break
*
* @return string
*/
public function write()
{
/** @var \PhpOffice\PhpWord\Writer\HTML $parentWriter Type hint */
$parentWriter = $this->parentWriter;
if ($parentWriter->isPdf()) {
return '<pagebreak style="page-break-before: always;" pagebreak="true"></pagebreak>';
}
return "";
}
} }