Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
2a5c667
#51 (updated tests, refactored a little).
Feb 6, 2015
8bb4573
#51 (updated tests, refactored a little).
Feb 6, 2015
cc305bc
Fixed broken paragraph alignment for OpenXml.
Feb 21, 2015
4eefb60
#51 (updated tests, refactored a little).
Feb 21, 2015
f902549
Minor refactoring.
Feb 21, 2015
2c040d2
Minor refactoring.
Feb 21, 2015
25a5ba2
Minor refactoring.
Feb 21, 2015
fbdd5f1
Minor refactoring.
Feb 21, 2015
e0dea8e
Fixed broken paragraph alignment for OpenXml.
Feb 21, 2015
cb6ad0e
Fixed broken paragraph alignment for OpenXml.
Feb 21, 2015
17ee9e1
Fixed broken paragraph alignment for OpenXml.
Mar 1, 2015
18c5462
Fixed broken paragraph alignment for OpenXml.
Mar 1, 2015
f2cd42f
#495.
Mar 22, 2015
0198aec
#495.
Mar 22, 2015
a38ec77
#495.
Mar 22, 2015
8e9f865
Removed typo.
Mar 22, 2015
75022c5
#495.
Mar 22, 2015
f33abcd
Performance improvement for #513.
Apr 11, 2015
520a7a8
Performance improvement for #513.
Apr 11, 2015
a5c3645
Performance improvement for #513.
Apr 11, 2015
b7387be
Reimplemented #498.
Apr 14, 2015
d5e276a
Reimplemented #498.
Apr 14, 2015
fef4a36
Implementation for #371.
Apr 14, 2015
6ef9ac2
Merge remote-tracking branch 'origin/develop' into develop
Apr 14, 2015
9770f44
Shortened names of ``TemplateProcessor`` properties.
Apr 14, 2015
4212c7e
Added Gitter badge.
May 26, 2015
7fdc50b
Changed Gitter badge to the Shields version.
May 26, 2015
1cd4fbf
Performance improvement for #513.
Jun 2, 2015
1383cef
Performance improvement for #513.
Jun 2, 2015
26b0eac
`.travis.yml` clanup.
Jun 23, 2015
858ab18
`.travis.yml` cleanup.
Jun 23, 2015
1b56db2
`.travis.yml` cleanup.
Jun 23, 2015
7a2125c
`.travis.yml` cleanup.
Jun 23, 2015
988eaca
Fix for #532.
Jul 2, 2015
db8221d
Fix for #532.
Jul 2, 2015
07e0d4c
Fix for #532.
Jul 2, 2015
637c2bc
Playing with Travis CI.
Jul 2, 2015
c1cfd50
Playing with Travis CI.
Jul 2, 2015
b0ff13c
Playing with Travis CI.
Jul 2, 2015
cd2e7f7
Playing with Travis CI.
Jul 4, 2015
75b479f
Removed redundant *.md documentation.
Aug 8, 2015
90295fe
#532.
Aug 16, 2015
adf20d3
#513.
Aug 30, 2015
3a58c81
Released v0.12.1.
Aug 30, 2015
a123ce4
Template processor setValue() improvements #614
kazitanvirahsan Sep 10, 2015
873d41a
Update Template processor setValue() improvements #614
kazitanvirahsan Sep 10, 2015
b446a23
Update 2 Template processor setValue() improvements #614
kazitanvirahsan Sep 10, 2015
94c0d02
Next round of refactoring of alignment-related functionality.
Oct 10, 2015
505cc76
Fixed build.
Oct 10, 2015
12823a5
Fixed build.
Oct 10, 2015
09e5e35
Changed init value of the NumberingLevel.alignment property.
Oct 21, 2015
d3908de
Updated change log due to the changes previously committed.
Oct 23, 2015
d74c0bd
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
3965f11
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
015a34f
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
f884527
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
e3c8852
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
4ebd668
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
e24fec7
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
e771b47
Added backward compatibility for deprecated alignment options.
Nov 14, 2015
c75bbf1
Merge branch 'master' into develop
Nov 14, 2015
ef3c3b8
Reorganized unit tests.
Nov 15, 2015
c75056f
Reorganized unit tests.
Nov 15, 2015
95c0971
Reorganized unit tests.
Nov 15, 2015
e6d73d8
Removed custom autoloader.
Nov 21, 2015
43fb23d
Copyright update.
Dec 5, 2015
7bd6cbd
Copyright update.
Dec 5, 2015
9f0b437
Copyright update.
Dec 5, 2015
529edcb
Merge pull request #617 from kazitanvirahsan/develop
Dec 12, 2015
5781f65
#617.
Dec 12, 2015
f359825
Reviewed and merged #658.
Jan 23, 2016
3981e01
Add PHP 7.0 into the build script.
Jan 23, 2016
ea4388d
Improved coverage for `\PhpOffice\PhpWord\Element\Section` (#665).
Jan 23, 2016
a621447
Improved coverage for `\PhpOffice\PhpWord\Element\Section` (#665).
Jan 23, 2016
8bc2364
Improved coverage for `\PhpOffice\PhpWord\Element\Section` (#665).
Jan 23, 2016
995dc68
Improved coverage for `\PhpOffice\PhpWord\Element\Section` (#665).
Jan 23, 2016
53a5369
Reviewed and merged #612.
Feb 6, 2016
16495a0
Reviewed and merged #612.
Feb 6, 2016
28f801b
#704.
Feb 23, 2016
1c5bb3a
#548.
Apr 9, 2016
d579736
#618.
Apr 23, 2016
40984dc
Update DOC: Add note about direction of text inside cell
githubjeka May 24, 2016
023977a
Merge pull request #803 from githubjeka/patch-1
Progi1984 May 24, 2016
d9627e1
Update Sample_09_Tables.php
githubjeka May 25, 2016
38ca52e
Merge pull request #804 from githubjeka/patch-1
Progi1984 May 26, 2016
d3f3a4a
Update Sample_09_Tables.php
githubjeka May 30, 2016
4954f28
Merge pull request #807 from githubjeka/patch-1
Progi1984 May 30, 2016
ec3c62b
#483. Output escaping for OOXML.
Jun 4, 2016
a07dc6c
#483. Output escaping for OOXML.
Jun 4, 2016
a2d3079
Fixed build.
Jun 4, 2016
ebbb3a5
#483. Output escaping for ODF.
Jun 13, 2016
508d619
Fixed build.
Jun 13, 2016
4c7e139
#483. Output escaping for HTML.
Jun 28, 2016
649da97
Fixed build.
Jun 28, 2016
3f1e0ac
#483. Output escaping for RTF.
Jul 8, 2016
e2ea1ee
Fixed tests.
Jul 8, 2016
7deb010
Fixed formatting.
Jul 8, 2016
fb863cd
https://github.com/PHPOffice/PHPWord/issues/335.
Jul 30, 2016
54013a6
https://github.com/PHPOffice/PHPWord/issues/399.
Jul 30, 2016
7817524
https://github.com/PHPOffice/PHPWord/issues/399.
Jul 30, 2016
1827eab
Removed deprecated code.
Jul 30, 2016
2bcfacf
Updated copyright.
Jul 31, 2016
4486e2b
Updated change log.
Jul 31, 2016
31cc01a
Updated change log.
Jul 31, 2016
0a3f873
Updated change log.
Jul 31, 2016
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
Next Next commit
#51 (updated tests, refactored a little).
  • Loading branch information
Roman Syroeshko committed Feb 6, 2015
commit 2a5c66784b5e723d0cdae9249f80d44522196a3b
14 changes: 10 additions & 4 deletions docs/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
htmlspecialchars(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
. '(Albert Einstein)',
ENT_COMPAT,
'UTF-8'
)
);

Expand All @@ -44,7 +46,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
htmlspecialchars(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)'
. '(Napoleon Hill)',
ENT_COMPAT,
'UTF-8'
),
array('name' => 'Tahoma', 'size' => 10)
);
Expand All @@ -59,7 +63,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
htmlspecialchars(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)'
. '(Vince Lombardi)',
ENT_COMPAT,
'UTF-8'
),
$fontStyleName
);
Expand All @@ -70,7 +76,7 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText(
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)', ENT_COMPAT, 'UTF-8')
);
$myTextElement->setFontStyle($fontStyle);

Expand Down
14 changes: 10 additions & 4 deletions docs/src/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ $section->addText(
htmlspecialchars(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
. '(Albert Einstein)',
ENT_COMPAT,
'UTF-8'
)
);

Expand All @@ -244,7 +246,9 @@ $section->addText(
htmlspecialchars(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)'
. '(Napoleon Hill)',
ENT_COMPAT,
'UTF-8'
),
array('name' => 'Tahoma', 'size' => 10)
);
Expand All @@ -259,7 +263,9 @@ $section->addText(
htmlspecialchars(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)'
. '(Vince Lombardi)',
ENT_COMPAT,
'UTF-8'
),
$fontStyleName
);
Expand All @@ -270,7 +276,7 @@ $fontStyle->setBold(true);
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText(
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)', ENT_COMPAT, 'UTF-8')
);
$myTextElement->setFontStyle($fontStyle);

Expand Down
72 changes: 36 additions & 36 deletions samples/Sample_01_SimpleText.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
$section = $phpWord->addSection();

// Simple text
$section->addTitle(htmlspecialchars('Welcome to PhpWord'), 1);
$section->addText(htmlspecialchars('Hello World!'));
$section->addTitle(htmlspecialchars('Welcome to PhpWord', ENT_COMPAT, 'UTF-8'), 1);
$section->addText(htmlspecialchars('Hello World!', ENT_COMPAT, 'UTF-8'));

// Two text break
$section->addTextBreak(2);

// Defined style
$section->addText(htmlspecialchars('I am styled by a font style definition.'), 'rStyle');
$section->addText(htmlspecialchars('I am styled by a paragraph style definition.'), null, 'pStyle');
$section->addText(htmlspecialchars('I am styled by both font and paragraph style.'), 'rStyle', 'pStyle');
$section->addText(htmlspecialchars('I am styled by a font style definition.', ENT_COMPAT, 'UTF-8'), 'rStyle');
$section->addText(htmlspecialchars('I am styled by a paragraph style definition.', ENT_COMPAT, 'UTF-8'), null, 'pStyle');
$section->addText(htmlspecialchars('I am styled by both font and paragraph style.', ENT_COMPAT, 'UTF-8'), 'rStyle', 'pStyle');

$section->addTextBreak();

Expand All @@ -30,39 +30,39 @@
$fontStyle['size'] = 20;

$textrun = $section->addTextRun();
$textrun->addText(htmlspecialchars('I am inline styled '), $fontStyle);
$textrun->addText(htmlspecialchars('with '));
$textrun->addText(htmlspecialchars('color'), array('color' => '996699'));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('bold'), array('bold' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('italic'), array('italic' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('underline'), array('underline' => 'dash'));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('strikethrough'), array('strikethrough' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('doubleStrikethrough'), array('doubleStrikethrough' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('superScript'), array('superScript' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('subScript'), array('subScript' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('smallCaps'), array('smallCaps' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('allCaps'), array('allCaps' => true));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('fgColor'), array('fgColor' => 'yellow'));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('scale'), array('scale' => 200));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('spacing'), array('spacing' => 120));
$textrun->addText(htmlspecialchars(', '));
$textrun->addText(htmlspecialchars('kerning'), array('kerning' => 10));
$textrun->addText(htmlspecialchars('. '));
$textrun->addText(htmlspecialchars('I am inline styled ', ENT_COMPAT, 'UTF-8'), $fontStyle);
$textrun->addText(htmlspecialchars('with ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('color', ENT_COMPAT, 'UTF-8'), array('color' => '996699'));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('bold', ENT_COMPAT, 'UTF-8'), array('bold' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('italic', ENT_COMPAT, 'UTF-8'), array('italic' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('underline', ENT_COMPAT, 'UTF-8'), array('underline' => 'dash'));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('strikethrough', ENT_COMPAT, 'UTF-8'), array('strikethrough' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('doubleStrikethrough', ENT_COMPAT, 'UTF-8'), array('doubleStrikethrough' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('superScript', ENT_COMPAT, 'UTF-8'), array('superScript' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('subScript', ENT_COMPAT, 'UTF-8'), array('subScript' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('smallCaps', ENT_COMPAT, 'UTF-8'), array('smallCaps' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('allCaps', ENT_COMPAT, 'UTF-8'), array('allCaps' => true));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('fgColor', ENT_COMPAT, 'UTF-8'), array('fgColor' => 'yellow'));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('scale', ENT_COMPAT, 'UTF-8'), array('scale' => 200));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('spacing', ENT_COMPAT, 'UTF-8'), array('spacing' => 120));
$textrun->addText(htmlspecialchars(', ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('kerning', ENT_COMPAT, 'UTF-8'), array('kerning' => 10));
$textrun->addText(htmlspecialchars('. ', ENT_COMPAT, 'UTF-8'));

// Link
$section->addLink('http://www.google.com', htmlspecialchars('Google'));
$section->addLink('https://github.com/PHPOffice/PHPWord', htmlspecialchars('PHPWord on GitHub', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak();

// Image
Expand Down
6 changes: 3 additions & 3 deletions samples/Sample_02_TabStops.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
$section = $phpWord->addSection();

// Add listitem elements
$section->addText(htmlspecialchars("Multiple Tabs:\tOne\tTwo\tThree"), null, 'multipleTab');
$section->addText(htmlspecialchars("Left Aligned\tRight Aligned"), null, 'rightTab');
$section->addText(htmlspecialchars("\tCenter Aligned"), null, 'centerTab');
$section->addText(htmlspecialchars("Multiple Tabs:\tOne\tTwo\tThree", ENT_COMPAT, 'UTF-8'), null, 'multipleTab');
$section->addText(htmlspecialchars("Left Aligned\tRight Aligned", ENT_COMPAT, 'UTF-8'), null, 'rightTab');
$section->addText(htmlspecialchars("\tCenter Aligned", ENT_COMPAT, 'UTF-8'), null, 'centerTab');

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
Expand Down
14 changes: 8 additions & 6 deletions samples/Sample_03_Sections.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

// New portrait section
$section = $phpWord->addSection(array('borderColor' => '00FF00', 'borderSize' => 12));
$section->addText(htmlspecialchars('I am placed on a default section.'));
$section->addText(htmlspecialchars('I am placed on a default section.', ENT_COMPAT, 'UTF-8'));

// New landscape section
$section = $phpWord->addSection(array('orientation' => 'landscape'));
$section->addText(
htmlspecialchars(
'I am placed on a landscape section. Every page starting from this section will be landscape style.'
'I am placed on a landscape section. Every page starting from this section will be landscape style.',
ENT_COMPAT,
'UTF-8'
)
);
$section->addPageBreak();
Expand All @@ -23,7 +25,7 @@
$section = $phpWord->addSection(
array('paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)
);
$section->addText(htmlspecialchars('This section uses other margins with folio papersize.'));
$section->addText(htmlspecialchars('This section uses other margins with folio papersize.', ENT_COMPAT, 'UTF-8'));

// New portrait section with Header & Footer
$section = $phpWord->addSection(
Expand All @@ -36,9 +38,9 @@
'footerHeight' => 50,
)
);
$section->addText(htmlspecialchars('This section and we play with header/footer height.'));
$section->addHeader()->addText(htmlspecialchars('Header'));
$section->addFooter()->addText(htmlspecialchars('Footer'));
$section->addText(htmlspecialchars('This section and we play with header/footer height.', ENT_COMPAT, 'UTF-8'));
$section->addHeader()->addText(htmlspecialchars('Header', ENT_COMPAT, 'UTF-8'));
$section->addFooter()->addText(htmlspecialchars('Footer', ENT_COMPAT, 'UTF-8'));

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
Expand Down
26 changes: 13 additions & 13 deletions samples/Sample_04_Textrun.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
// Add text run
$textrun = $section->addTextRun('pStyle');

$textrun->addText(htmlspecialchars('Each textrun can contain native text, link elements or an image.'));
$textrun->addText(htmlspecialchars(' No break is placed after adding an element.'), 'BoldText');
$textrun->addText(htmlspecialchars(' Both '));
$textrun->addText(htmlspecialchars('superscript'), array('superScript' => true));
$textrun->addText(htmlspecialchars(' and '));
$textrun->addText(htmlspecialchars('subscript'), array('subScript' => true));
$textrun->addText(htmlspecialchars(' are also available.'));
$textrun->addText(htmlspecialchars('Each textrun can contain native text, link elements or an image.', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars(' No break is placed after adding an element.', ENT_COMPAT, 'UTF-8'), 'BoldText');
$textrun->addText(htmlspecialchars(' Both ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('superscript', ENT_COMPAT, 'UTF-8'), array('superScript' => true));
$textrun->addText(htmlspecialchars(' and ', ENT_COMPAT, 'UTF-8'));
$textrun->addText(htmlspecialchars('subscript', ENT_COMPAT, 'UTF-8'), array('subScript' => true));
$textrun->addText(htmlspecialchars(' are also available.', ENT_COMPAT, 'UTF-8'));
$textrun->addText(
htmlspecialchars(' All elements are placed inside a paragraph with the optionally given p-Style.'),
htmlspecialchars(' All elements are placed inside a paragraph with the optionally given p-Style.', ENT_COMPAT, 'UTF-8'),
'ColoredText'
);
$textrun->addText(htmlspecialchars(' Sample Link: '));
$textrun->addLink('http://www.google.com', null, 'NLink');
$textrun->addText(htmlspecialchars(' Sample Image: '));
$textrun->addText(htmlspecialchars(' Sample Link: ', ENT_COMPAT, 'UTF-8'));
$textrun->addLink('https://github.com/PHPOffice/PHPWord', htmlspecialchars('PHPWord on GitHub', ENT_COMPAT, 'UTF-8'), 'NLink');
$textrun->addText(htmlspecialchars(' Sample Image: ', ENT_COMPAT, 'UTF-8'));
$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
$textrun->addText(htmlspecialchars(' Sample Object: '));
$textrun->addText(htmlspecialchars(' Sample Object: ', ENT_COMPAT, 'UTF-8'));
$textrun->addObject('resources/_sheet.xls');
$textrun->addText(htmlspecialchars(' Here is some more text. '));
$textrun->addText(htmlspecialchars(' Here is some more text. ', ENT_COMPAT, 'UTF-8'));

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
Expand Down
10 changes: 5 additions & 5 deletions samples/Sample_05_Multicolumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// Normal
$section = $phpWord->addSection();
$section->addText(htmlspecialchars("Normal paragraph. {$filler}"));
$section->addText(htmlspecialchars("Normal paragraph. {$filler}", ENT_COMPAT, 'UTF-8'));

// Two columns
$section = $phpWord->addSection(
Expand All @@ -21,11 +21,11 @@
'breakType' => 'continuous',
)
);
$section->addText(htmlspecialchars("Two columns, one inch (1440 twips) spacing. {$filler}"));
$section->addText(htmlspecialchars("Two columns, one inch (1440 twips) spacing. {$filler}", ENT_COMPAT, 'UTF-8'));

// Normal
$section = $phpWord->addSection(array('breakType' => 'continuous'));
$section->addText(htmlspecialchars("Normal paragraph again. {$filler}"));
$section->addText(htmlspecialchars("Normal paragraph again. {$filler}", ENT_COMPAT, 'UTF-8'));

// Three columns
$section = $phpWord->addSection(
Expand All @@ -35,11 +35,11 @@
'breakType' => 'continuous',
)
);
$section->addText(htmlspecialchars("Three columns, half inch (720 twips) spacing. {$filler}"));
$section->addText(htmlspecialchars("Three columns, half inch (720 twips) spacing. {$filler}", ENT_COMPAT, 'UTF-8'));

// Normal
$section = $phpWord->addSection(array('breakType' => 'continuous'));
$section->addText(htmlspecialchars('Normal paragraph again.'));
$section->addText(htmlspecialchars('Normal paragraph again.', ENT_COMPAT, 'UTF-8'));

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
Expand Down
26 changes: 14 additions & 12 deletions samples/Sample_06_Footnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@

// Add text elements
$textrun = $section->addTextRun('pStyle');
$textrun->addText(htmlspecialchars('This is some lead text in a paragraph with a following footnote. '), 'pStyle');
$textrun->addText(htmlspecialchars('This is some lead text in a paragraph with a following footnote. ', ENT_COMPAT, 'UTF-8'), 'pStyle');

$footnote = $textrun->addFootnote();
$footnote->addText(htmlspecialchars('Just like a textrun, a footnote can contain native texts. '));
$footnote->addText(htmlspecialchars('No break is placed after adding an element. '), 'BoldText');
$footnote->addText(htmlspecialchars('All elements are placed inside a paragraph. '), 'ColoredText');
$footnote->addText(htmlspecialchars('Just like a textrun, a footnote can contain native texts. ', ENT_COMPAT, 'UTF-8'));
$footnote->addText(htmlspecialchars('No break is placed after adding an element. ', ENT_COMPAT, 'UTF-8'), 'BoldText');
$footnote->addText(htmlspecialchars('All elements are placed inside a paragraph. ', ENT_COMPAT, 'UTF-8'), 'ColoredText');
$footnote->addTextBreak();
$footnote->addText(htmlspecialchars('But you can insert a manual text break like above, '));
$footnote->addText(htmlspecialchars('links like '));
$footnote->addLink('http://www.google.com', null, 'NLink');
$footnote->addText(htmlspecialchars(', image like '));
$footnote->addText(htmlspecialchars('But you can insert a manual text break like above, ', ENT_COMPAT, 'UTF-8'));
$footnote->addText(htmlspecialchars('links like ', ENT_COMPAT, 'UTF-8'));
$footnote->addLink('https://github.com/PHPOffice/PHPWord', htmlspecialchars('PHPWord on GitHub', ENT_COMPAT, 'UTF-8'), 'NLink');
$footnote->addText(htmlspecialchars(', image like ', ENT_COMPAT, 'UTF-8'));
$footnote->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
$footnote->addText(htmlspecialchars(', or object like '));
$footnote->addText(htmlspecialchars(', or object like ', ENT_COMPAT, 'UTF-8'));
$footnote->addObject('resources/_sheet.xls');
$footnote->addText(htmlspecialchars('But you can only put footnote in section, not in header or footer.'));
$footnote->addText(htmlspecialchars('But you can only put footnote in section, not in header or footer.', ENT_COMPAT, 'UTF-8'));

$section->addText(
htmlspecialchars(
'You can also create the footnote directly from the section making it wrap in a paragraph '
. 'like the footnote below this paragraph. But is is best used from within a textrun.'
. 'like the footnote below this paragraph. But is is best used from within a textrun.',
ENT_COMPAT,
'UTF-8'
)
);
$footnote = $section->addFootnote();
$footnote->addText(htmlspecialchars('The reference for this is wrapped in its own line'));
$footnote->addText(htmlspecialchars('The reference for this is wrapped in its own line', ENT_COMPAT, 'UTF-8'));

// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
Expand Down
Loading