14 require
'../../../_src/_config.php';
21 $language = new \PhpOffice\PhpWord\Style\Language(\PhpOffice\PhpWord\Style\Language::EN_GB);
30 $phpWord->addFontStyle(
$fontStyleName, array(
'bold' =>
true,
'italic' =>
true,
'size' => 16,
'allCaps' =>
true,
'doubleStrikethrough' =>
true));
32 $phpWord->addParagraphStyle(
$paragraphStyleName, array(
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER,
'spaceAfter' => 100));
33 $phpWord->addTitleStyle(1, array(
'bold' =>
true), array(
'spaceAfter' => 240));
37 $section->addTitle(
'Welcome to PhpWord', 1);
41 $section->addText(
'Ce texte-ci est en français.', array(
'lang' => \PhpOffice\PhpWord\Style\Language::FR_BE));
55 $textrun->addText(
'color', array(
'color' =>
'996699'));
57 $textrun->addText(
'bold', array(
'bold' =>
true));
59 $textrun->addText(
'italic', array(
'italic' =>
true));
61 $textrun->addText(
'underline', array(
'underline' =>
'dash'));
63 $textrun->addText(
'strikethrough', array(
'strikethrough' =>
true));
65 $textrun->addText(
'doubleStrikethrough', array(
'doubleStrikethrough' =>
true));
67 $textrun->addText(
'superScript', array(
'superScript' =>
true));
69 $textrun->addText(
'subScript', array(
'subScript' =>
true));
71 $textrun->addText(
'smallCaps', array(
'smallCaps' =>
true));
73 $textrun->addText(
'allCaps', array(
'allCaps' =>
true));
75 $textrun->addText(
'fgColor', array(
'fgColor' =>
'yellow'));
77 $textrun->addText(
'scale', array(
'scale' => 200));
79 $textrun->addText(
'spacing', array(
'spacing' => 120));
81 $textrun->addText(
'kerning', array(
'kerning' => 10));
84 $section->addLink(
'https://github.com/PHPOffice/PHPWord',
'PHPWord on GitHub');
89 #echo write($phpWord, basename(__FILE__, '.php'), $writers); 95 header(
'Content-Description: File Transfer');
96 header(
'Content-Disposition: attachment; filename="helloWorld.docx"');
97 header(
'Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
98 header(
'Content-Transfer-Encoding: binary');
99 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
100 header(
'Expires: 0');