<?php

include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$section = $phpWord->addSection();
// Style definition
$phpWord->addFontStyle('myOwnStyle', array('color' => 'FF0000'));
$phpWord->addParagraphStyle('P-Style', array('spaceAfter' => 95));
$phpWord->addNumberingStyle('multilevel', array('type' => 'multilevel', 'levels' => array(array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360), array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720))));
$predefinedMultilevel = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED);
// Lists
$section->addText(htmlspecialchars('Multilevel list.', ENT_COMPAT, 'UTF-8'));
$section->addListItem(htmlspecialchars('List Item I', ENT_COMPAT, 'UTF-8'), 0, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item I.a', ENT_COMPAT, 'UTF-8'), 1, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item I.b', ENT_COMPAT, 'UTF-8'), 1, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item II', ENT_COMPAT, 'UTF-8'), 0, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item II.a', ENT_COMPAT, 'UTF-8'), 1, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item III', ENT_COMPAT, 'UTF-8'), 0, null, 'multilevel');
$section->addTextBreak(2);
$section->addText(htmlspecialchars('Basic simple bulleted list.', ENT_COMPAT, 'UTF-8'));
$section->addListItem(htmlspecialchars('List Item 1', ENT_COMPAT, 'UTF-8'));
$section->addListItem(htmlspecialchars('List Item 2', ENT_COMPAT, 'UTF-8'));
$section->addListItem(htmlspecialchars('List Item 3', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak(2);
$section->addText(htmlspecialchars('Continue from multilevel list above.', ENT_COMPAT, 'UTF-8'));
$section->addListItem(htmlspecialchars('List Item IV', ENT_COMPAT, 'UTF-8'), 0, null, 'multilevel');
$section->addListItem(htmlspecialchars('List Item IV.a', ENT_COMPAT, 'UTF-8'), 1, null, 'multilevel');
$section->addTextBreak(2);
Exemple #2
0
$dataSet->addPoint(new Point("Second Class", $read[2]));
$dataSet->addPoint(new Point("Fail", $read[3]));
$chart->setDataSet($dataSet);
//$chart->setUpperBound	(	120) 	;
$chart->setTitle("Maharaja institute of Technology, EC Branch, 8th Sem");
$chart->render("demo1.png");
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addParagraphStyle('tStyle', array('align' => 'center', 'spaceAfter' => 100));
$phpWord->addParagraphStyle('nStyle', array('align' => 'justify'));
$phpWord->addFontStyle('tFont', array('name' => 'Times New Roman', 'bold' => true, 'italic' => true, 'size' => 24, 'allCaps' => true));
$phpWord->addFontStyle('hFont', array('name' => 'Times New Roman', 'bold' => false, 'italic' => false, 'size' => 10, 'allCaps' => true));
$phpWord->addFontStyle('aFont', array('name' => 'Times New Roman', 'bold' => true, 'italic' => false, 'size' => 9));
$phpWord->addFontStyle('aFonti', array('name' => 'Times New Roman', 'bold' => true, 'italic' => true, 'size' => 9));
$phpWord->addFontStyle('nFont', array('name' => 'Times New Roman', 'bold' => false, 'italic' => false, 'size' => 10));
$phpWord->addNumberingStyle('multilevel', array('type' => 'multilevel', 'levels' => array(array('format' => 'upperRoman', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360), array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720))));
//Title
$section = $phpWord->addSection();
$section->addText(htmlspecialchars("Maharaja Institute of Techonology"), 'tFont', 'tStyle');
$section->addTextBreak($lineSpace);
/*
$section = $phpWord->addSection();
//Abstract
$section->addText("Branch:   E&CE",'aFonti');
$section->addText("Semester: VIII",'aFonti');
$section->addTextBreak($lineSpace);
*/
$branch = strtoupper($branch);
$pp = round($pp, 2);
$section->addText(htmlspecialchars("Branch   : {$branch}"), null, null);
$section->addText(htmlspecialchars("Semester : {$year}"), null, null);