$pp = ($total - $read[3]) / $total; $pp = $pp * 100; include "libchart/libchart/classes/libchart.php"; $chart = new VerticalBarChart(700, 500); $dataSet = new XYDataSet(); $dataSet->addPoint(new Point("FCD", $read[0])); $dataSet->addPoint(new Point("First Class", $read[1])); $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');
public function vytvorZiadostHlasovaniePostouNonSR($obec, $n2k) { $phpWord = new \PhpOffice\PhpWord\PhpWord(); /* Note: any element you append to a document must reside inside of a Section. */ $phpWord->addParagraphStyle('pStylel', array('spacing' => 5)); $phpWord->addParagraphStyle('pStylec', array('spacing' => 5, 'align' => 'center')); $phpWord->addParagraphStyle('pStyler', array('spacing' => 5, 'align' => 'right')); $section = $phpWord->addSection(); $textrun = $section->addTextRun('pStyler'); $textrun->addText(htmlspecialchars("ŽIADOSŤ VYPLŇTE VEĽKÝMI PÍSMENAMI."), array('bold' => true)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun = $section->addTextRun('pStylec'); $textrun->addText(htmlspecialchars("Žiadosť\to voľbu poštou"), array("size" => "14")); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("pre voľby do Národnej rady Slovenskej republiky v roku 2016"), array("size" => "14")); $textrun = $section->addTextRun('pStylel'); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $this->spracujAdresuPrijemcu($textrun, $obec, $n2k); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Podľa § 59 ods. 1 zákona č. 180/2014 Z. z. o podmienkach výkonu volebného práva a o zmene a doplnení niektorých zákonov žiadam o voľbu poštou pre voľby do Národnej rady Slovenskej republiky v roku 2016 a o zaslanie hlasovacích lístkov a obálok na adresu:")); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Meno:\t\t\t\t")); $textrun->addText(htmlspecialchars("MENO"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Priezvisko:\t\t\t")); $textrun->addText(htmlspecialchars("PRIEZVISKO"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Rodné priezvisko:\t\t")); $textrun->addText(htmlspecialchars("RODNÉ PRIEZVISKO"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Rodné číslo:\t\t\t")); $textrun->addText(htmlspecialchars("RODNÉ ČÍSLO"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Ulica:\t\t\t\t")); $textrun->addText(htmlspecialchars("ULICA"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Číslo domu:\t\t\t")); $textrun->addText(htmlspecialchars("ČÍSLO DOMU"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Obec:\t\t\t\t")); $textrun->addText(htmlspecialchars("OBEC"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("PSČ:\t\t\t\t")); $textrun->addText(htmlspecialchars("PSČ"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Štát:\t\t\t\t")); $textrun->addText(htmlspecialchars("ŠTÁT"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Prílohy:")); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("- čestné vyhlásenie voliča, že nemá trvalý pobyt na území Slovenskej republiky.")); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("- fotokópia časti cestovného dokladu Slovenskej republiky s osobnými údajmi voliča alebo fotokópia osvedčenia o štátnom občianstve Slovenskej republiky voliča.")); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("V ")); $textrun->addText(htmlspecialchars("MIESTO KDE SA NACHÁDZATE"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addText(htmlspecialchars(", dňa ")); $textrun->addText(htmlspecialchars("DNEŠNÝ DÁTUM"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun = $section->addTextRun('pStyler'); $textrun->addText(htmlspecialchars("MENO ALEBO PODPIS"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $section = $phpWord->addSection(); $textrun = $section->addTextRun('pStylec'); $textrun->addText(htmlspecialchars("meno, priezvisko, rodné číslo alebo dátum narodenia, adresa trvalého pobytu v cudzine"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("ČESTNÉ VYHLÁSENIE"), array('size' => 20)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("Na účely voľby poštou do Národnej rady Slovenskej republiky v roku 2016"), array('size' => 12)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("čestne vyhlasujem,"), array('size' => 12, 'bold' => true)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addText(htmlspecialchars("že nemám trvalý pobyt na území Slovenskej republiky."), array('size' => 12)); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun->addTextBreak(); $textrun = $section->addTextRun('pStylel'); $textrun->addText(htmlspecialchars("V ")); $textrun->addText(htmlspecialchars("MIESTO KDE SA NACHÁDZATE"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addText(htmlspecialchars(", dňa ")); $textrun->addText(htmlspecialchars("DNEŠNÝ DÁTUM"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $textrun->addTextBreak(); $textrun = $section->addTextRun('pStyler'); $textrun->addText(htmlspecialchars("MENO ALEBO PODPIS"), array('bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); $section = $phpWord->addSection(); $textrun = $section->addTextRun('pStylec'); $textrun->addText(htmlspecialchars("fotokópia časti cestovného dokladu Slovenskej republiky s osobnými údajmi voliča alebo fotokópia osvedčenia o štátnom občianstve Slovenskej republiky voliča"), array('size' => '30', 'bgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)); return $phpWord; }
<?php defined('_JEXEC') or die('Restricted access'); $atData = $this->atData; $atTar = $this->atTar; require_once 'libraries/PHPWord-master/src/PhpWord/Autoloader.php'; \PhpOffice\PhpWord\Autoloader::register(); $phpWord = new \PhpOffice\PhpWord\PhpWord(); // Baslik Style $phpWord->addFontStyle('rBasStyle', array('bold' => true, 'name' => 'Times New Roman', 'size' => 12)); $phpWord->addParagraphStyle('pBasStyle', array('align' => 'center', 'spaceAfter' => 100)); //İçerik Style $phpWord->addFontStyle('rIcStyle', array('name' => 'Times New Roman', 'size' => 12)); $phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100)); //İçerikBas Style $phpWord->addFontStyle('rIcBasStyle', array('name' => 'Times New Roman', 'size' => 12, 'bold' => true)); $phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100)); // New portrait section $section = $phpWord->addSection(array('orientation' => 'portrait')); $section->addText('EK-8', 'rBasStyle', array('align' => 'right')); $section->addText('Avrupa Topluluğu (AT) Yüklenicileri Tarafından 2.000 TL’nin Üstünde Yapılan Alımlara İlişkin Üçer Aylık Bildirim Tablosu', 'rBasStyle', array('align' => 'center')); $section->addText('(KDV İstisna Sertifikası alınan vergi idaresine gönderilecektir)', 'rIcStyle', array('align' => 'center')); $section->addTextBreak(1); $styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMarginLeft' => 20); $styleFirstRow = array('borderBottomSize' => 6, 'borderBottomColor' => '000000'); $styleCell = array('borderRightColor' => '000000', 'borderRightSize' => 6, 'valign' => 'center'); $fontStyleBold = array('bold' => true, 'name' => 'Times New Roman', 'size' => 12); $fontStyle = array('name' => 'Times New Roman', 'size' => 12); $phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow); $table = $section->addTable('Fancy Table'); $table->addRow();
<?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);
public function gera_word() { $this->load->library('word2'); // Set writers $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'); // Set PDF renderer if (Settings::getPdfRendererPath() === null) { $writers['PDF'] = null; } // Return to the caller script when runs by CLI //if (CLI) { // return; //} // Set titles and names //$pageHeading = str_replace('_', ' ', SCRIPT_FILENAME); $pageHeading = "page heading"; //$pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - "; $pageTitle = "titulo da pagina"; //$pageTitle .= 'PHPWord'; //$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>"; // Populate samples $files = ''; if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if (preg_match('/^Sample_\\d+_/', $file)) { $name = str_replace('_', ' ', preg_replace('/(Sample_|\\.php)/', '', $file)); $files .= "<li><a href='{$file}'>{$name}</a></li>"; } } closedir($handle); } //include_once 'Sample_Header.php'; require_once APPPATH . "third_party/PHPWord2/PhpWord.php"; // New Word Document echo date('H:i:s'), " Create new PhpWord object"; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true)); $phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100)); $phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240)); // New portrait section $section = $phpWord->addSection(); // Simple text $section->addTitle('Welcome to PhpWord', 1); $section->addText('Hello World!'); // Two text break $section->addTextBreak(2); // Defined style $section->addText('I am styled by a font style definition.', 'rStyle'); $section->addText('I am styled by a paragraph style definition.', null, 'pStyle'); $section->addText('I am styled by both font and paragraph style.', 'rStyle', 'pStyle'); $section->addPageBreak(); // Inline font style $fontStyle['name'] = 'Times New Roman'; $fontStyle['size'] = 20; $fontStyle['bold'] = true; $fontStyle['italic'] = true; $fontStyle['underline'] = 'dash'; $fontStyle['strikethrough'] = true; $fontStyle['superScript'] = true; $fontStyle['color'] = 'FF0000'; $fontStyle['fgColor'] = 'yellow'; $fontStyle['smallCaps'] = true; $section->addText('I am inline styled.', $fontStyle); $section->addTextBreak(); // Link $section->addLink('http://www.google.com', 'Google'); $section->addTextBreak(); // Image //$section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18)); // Save file //echo write($phpWord, basename(__FILE__, '.php'), $writers); //if (!CLI) { //include_once 'Sample_Footer.php'; // } // Save file echo $this->write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { //include_once 'Sample_Footer.php'; } }
} $labelManager->setCollid($collid); $isEditor = 0; if ($symbUid) { if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collid, $userRights["CollAdmin"]) || array_key_exists("CollEditor", $userRights) && in_array($collid, $userRights["CollEditor"])) { $isEditor = 1; } } if ($isEditor && $action) { $labelArr = $labelManager->getAnnoArray($_POST['detid'], $speciesAuthors); if ($clearQueue) { $labelManager->clearAnnoQueue($_POST['detid']); } } $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('firstLine', array('lineHeight' => 0.1, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addParagraphStyle('lastLine', array('spaceAfter' => 50, 'lineHeight' => 0.1)); $phpWord->addFontStyle('dividerFont', array('size' => 1)); $phpWord->addParagraphStyle('header', array('align' => 'center', 'lineHeight' => 1.0, 'spaceAfter' => 40, 'keepNext' => true, 'keepLines' => true)); $phpWord->addParagraphStyle('footer', array('align' => 'center', 'lineHeight' => 1.0, 'spaceBefore' => 40, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('headerfooterFont', array('bold' => true, 'size' => 9, 'name' => 'Arial')); $phpWord->addParagraphStyle('other', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 30, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addParagraphStyle('scientificname', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('scientificnameFont', array('bold' => true, 'italic' => true, 'size' => 10, 'name' => 'Arial')); $phpWord->addFontStyle('scientificnameinterFont', array('bold' => true, 'size' => 10, 'name' => 'Arial')); $phpWord->addFontStyle('scientificnameauthFont', array('size' => 10, 'name' => 'Arial')); $phpWord->addFontStyle('identifiedFont', array('size' => 8, 'name' => 'Arial')); $tableStyle = array('width' => 100, 'borderColor' => '000000', 'borderSize' => 2, 'cellMargin' => 75); $colRowStyle = array('cantSplit' => true); $phpWord->addTableStyle('defaultTable', $tableStyle, $colRowStyle); $cellStyle = array('valign' => 'top');
$sektor = "MYK " . $bilgi["SEKTOR_ADI"] . " Sektör Komitesi"; $resmi = $bilgi["RESMI_GAZETE_TARIH"] != null ? $bilgi["RESMI_GAZETE_TARIH"] . " / " . $bilgi["RESMI_GAZETE_SAYI"] : ""; $karar = $bilgi["KARAR_TARIHI"] != null ? $bilgi["KARAR_TARIHI"] . " Tarih ve " . $bilgi["KARAR_SAYI"] . " Sayılı Karar" : "....... Tarih ve ....... Sayılı Karar"; $adH = $standart_bilgileri[0]["STANDART_ADI"]; $seviyeH = $standart_bilgileri[0]["SEVIYE_ADI"]; $kodH = $standart_bilgileri[0]["STANDART_KODU"]; $onayH = $standart_bilgileri[0]["KARAR_TARIHI"]; $revH = $standart_bilgileri[0]["REVIZYON_NO"]; $kodH = $kodH ? $kodH : ".............."; $onayH = $onayH ? $onayH : ".............."; $revH = $revH == '00' || $revH == '0' ? '...' : $revH; //Bilgiler Son // New Word Document // Baslik Style $phpWord->addFontStyle('rBasStyle', array('bold' => true, 'name' => 'Times New Roman', 'size' => 14)); $phpWord->addParagraphStyle('pBasStyle', array('align' => 'center', 'spaceAfter' => 100)); //İçerik Style $phpWord->addFontStyle('rIcStyle', array('name' => 'Times New Roman', 'size' => 12)); $phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100)); //İçerikBas Style $phpWord->addFontStyle('rIcBasStyle', array('name' => 'Times New Roman', 'size' => 12, 'bold' => true)); $phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100)); // New portrait section $section = $phpWord->createSection(array('orientation' => 'portrait')); // Kapak $section->addImage('images/myk_logo.jpg', array('width' => 152, 'height' => 187, 'align' => 'center')); $section->addTextBreak(3); $section->addText('ULUSAL MESLEK STANDARDI', 'rBasStyle', 'pBasStyle'); $section->addTextBreak(3); $section->addText($std, 'rBasStyle', 'pBasStyle'); $section->addText($seviye, 'rBasStyle', 'pBasStyle');
<?php include_once 'Sample_Header.php'; // New Word Document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); // Ads styles $phpWord->addParagraphStyle('multipleTab', array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('left', 1550), new \PhpOffice\PhpWord\Style\Tab('center', 3200), new \PhpOffice\PhpWord\Style\Tab('right', 5300)))); $phpWord->addParagraphStyle('rightTab', array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090)))); $phpWord->addParagraphStyle('centerTab', array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('center', 4680)))); // New portrait section $section = $phpWord->addSection(); // Add listitem elements $section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, 'multipleTab'); $section->addText("Left Aligned\tRight Aligned", null, 'rightTab'); $section->addText("\tCenter Aligned", null, 'centerTab'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }
$contributorsArr = $singleExportArr['contributors']; $imgcontributorsArr = $singleExportArr['imgcontributors']; unset($singleExportArr['glossSciName']); unset($singleExportArr['references']); unset($singleExportArr['contributors']); unset($singleExportArr['imgcontributors']); ksort($referencesArr); ksort($contributorsArr); ksort($imgcontributorsArr); ksort($singleExportArr, SORT_STRING | SORT_FLAG_CASE); $fileName = $sciName . '_SingleLanguage'; } } $fileName = str_replace(" ", "_", $fileName); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('titlePara', array('align' => 'center', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addFontStyle('titleFont', array('bold' => true, 'size' => 16, 'name' => 'Microsoft Sans Serif')); $phpWord->addParagraphStyle('transTermPara', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addFontStyle('transTermTopicNodefFont', array('bold' => true, 'size' => 15, 'name' => 'Microsoft Sans Serif')); $phpWord->addFontStyle('transTermTopicDefFont', array('bold' => true, 'size' => 14, 'name' => 'Microsoft Sans Serif')); $phpWord->addParagraphStyle('transDefPara', array('align' => 'left', 'lineHeight' => 1.0, 'indent' => 0.78125, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addParagraphStyle('transDefList', array('align' => 'left', 'lineHeight' => 1.0, 'indent' => 0.78125, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addFontStyle('transMainTermNodefFont', array('bold' => false, 'size' => 12, 'name' => 'Microsoft Sans Serif', 'color' => '21304B')); $phpWord->addFontStyle('transTransTermNodefFont', array('bold' => false, 'size' => 12, 'name' => 'Microsoft Sans Serif', 'color' => '000000')); $phpWord->addFontStyle('transMainTermDefFont', array('bold' => true, 'size' => 12, 'name' => 'Microsoft Sans Serif', 'color' => '21304B')); $phpWord->addFontStyle('transTransTermDefFont', array('bold' => true, 'size' => 12, 'name' => 'Microsoft Sans Serif', 'color' => '000000')); $phpWord->addFontStyle('transDefTextFont', array('bold' => false, 'size' => 12, 'name' => 'Microsoft Sans Serif', 'color' => '000000')); $tableStyle = array('width' => 100, 'cellMargin' => 60); $colRowStyle = array('cantSplit' => true, 'exactHeight' => 180); $phpWord->addTableStyle('exportTable', $tableStyle, $colRowStyle); $nodefCellStyle = array('valign' => 'center', 'width' => 2520, 'borderSize' => 0, 'borderColor' => 'ffffff');
$resultado = $DAO->Listar("SELECT a.dat_ata, a.id, ac.assunto, ac.local, ac.destinatario, ac.observacao, a.cod_ata FROM " . MYSQL_BASE_ATAS . " a, " . MYSQL_BASE_ATAS_CONTEUDO . " ac WHERE a.id= ac.id_ata AND a.id = " . $id); foreach ($resultado as $item) { $documento->setDataAta($item['dat_ata']); $documento->setId($item['id']); $documento->setAssunto($item['assunto']); $documento->setLocal($item['local']); $documento->setDestinatario($item['destinatario']); $documento->setObservacao($item['observacao']); $documento->setCodDoc($item['cod_ata']); } // New Word Document // echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $header = array('size' => 16, 'bold' => true, 'name' => 'Arial', 'align' => 'center'); $phpWord->addFontStyle('rStyle', array('name' => 'Arial', 'bold' => true)); $phpWord->addParagraphStyle('pStyle', array('align' => 'center')); $section = $phpWord->addSection(); /*Style da tabela*/ $styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 10); $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => 'FFFFFF'); $styleCell = array('valign' => 'center'); $styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); $fontStyle = array('bold' => true, 'align' => 'center'); $localStyle = array('bold' => true, 'underline' => 'single'); $cellColSpan = array('gridSpan' => 2, 'valign' => 'center'); $phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow); /*Fim - Style da tabela*/ /*Cabe�alho*/ $subsequent = $section->addHeader(); /*Fim - Cabe�alho*/ //Adicionando a tabela no cabecalho
} else { $maximo = $count_indireta; } } else { if ($count_direta > $count_indireta) { $maximo = $count_direta; } else { $maximo = $count_indireta; } } // New Word Document // echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $header = array('bold' => true, 'name' => 'Arial', 'align' => 'center'); $phpWord->addFontStyle('rStyle', array('name' => 'Arial', 'bold' => true)); $phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceBefore' => 10, 'spaceAfter' => 10)); $phpWord->addParagraphStyle('l2Style', array('align' => 'left', 'spaceBefore' => 10, 'spaceAfter' => 10)); $phpWord->addParagraphStyle('lStyle', array('align' => 'left', 'spaceBefore' => 10, 'spaceAfter' => 10)); $phpWord->setDefaultFontSize(8); //Tamanho da fonte por default $section = $phpWord->addSection(); /*Style da tabela*/ $styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 10); $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => 'FFFFFF'); $styleCell = array('valign' => 'center'); $styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); $fontStyle = array('bold' => true, 'align' => 'center'); $localStyle = array('bold' => true, 'underline' => 'single'); $cellColSpan = array('gridSpan' => 2, 'valign' => 'center'); $cellColSpan3 = array('gridSpan' => 3, 'valign' => 'center'); $cellColSpan4 = array('gridSpan' => 4, 'valign' => 'center');
---------------------------------------------- Début de la création du document. Le code qui suit pourrait être considéré comme un template si on arrive à le paramétrer correctement. ---------------------------------------------- */ $php_word = new \PhpOffice\PhpWord\PhpWord(); // ---------------------------------------------- // début de la définition des différents styles // possibilité d'exporter cela dans un autre document // pour mieux paramétrer le // http://phpword.readthedocs.org/en/latest/styles.html $style_font_titre = array('size' => 14, 'bold' => true); $style_font_texte = array('size' => 12); $style_align_right = array("align" => "right"); $php_word->addParagraphStyle("style_align_right", $style_align_right); $style_align_center = array("align" => "center"); $php_word->addParagraphStyle("style_align_center", $style_align_center); $style_table = array('width' => 50000, 'borderSize' => 6, 'cellMargin' => 100, 'align' => 'center'); $php_word->addTableStyle('style_table', $style_table); //$style_first_row = array('bgcolor'=>'66BBFF'); $style_cellule_titre = array('valign' => 'center', 'gridspan' => 3); $style_row = array('cantSplit' => true, 'exactHeight' => 500); $style_row_titre = array('tblHeader' => false, 'cantSplit' => true, 'exactHeight' => 500); $table_width = 10000; // variable avec nom significatif pour son utilisation $saut_ligne = ""; // Fin de la définiton des styles // ---------------------------------------------- // ---------------------------------------------- // Section de l'indentification du cours
function exportResultStudent($student, $topic, $student_mark_id = 0) { $CI =& get_instance(); $topic = (object) $topic; ob_start(); $CI->load->library('stringobj'); $CI->load->library('utils'); $CI->load->library('commonobj'); $CI->load->model('student_answer_model'); $CI->load->model('topic_model'); $CI->load->model('topic_file_model'); $student_id = $student->student_id; $student_name = $student->fullname; $indentity_number = $student->indentity_number; $student_id = intval($student_id); $data = array('topic_manage_id' => $topic->topic_manage_id, 'class_id' => $student->class_id); $folderName = $CI->commonobj->encrypt(implode(',', $data)); $file_path = PATH_FILES_NO_ROOT . $folderName; if (!file_exists($file_path)) { mkdir($file_path, 0777); } $data['folder_name'] = $folderName; $CI->topic_file_model->create_ignore($data); $file_path .= '/'; $filename = $file_path . $CI->stringobj->createAlias($student_name, '-') . '-' . $indentity_number . '-' . date('dmYHis') . DOCX; $answers_student = $CI->student_answer_model->getAnswerOfStudentId($student_id, $topic->topic_id, $student_mark_id); $studentAnswerList = $CI->utils->makeList('question_id', $answers_student); $topicDetails = $CI->topic_model->getData($topic->topic_id); // Include the PHPWord.php, all other classes were loaded by an autoloader require_once APPPATH . 'libraries/PhpOffice/PhpWord/PHPWord.php'; // New Word Document $PHPWord = new \PhpOffice\PhpWord\PhpWord(); // New portrait section $section = $PHPWord->createSection(); $styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80); // Add table style $PHPWord->addParagraphStyle('pStyle', array('lineHeight' => 2)); $PHPWord->addTableStyle('myOwnTableStyle', $styleTable); $this->_writeInfoStudent($section, $student, $topic); $this->_writeAnswerOfStudent($section, $answers_student); $this->_writeAnswerOfStudentDetail($section, $studentAnswerList, $topicDetails); // write docx $xmlWriter = IOFactory::createWriter($PHPWord, 'Word2007'); $xmlWriter->save($filename); }
<?php include_once 'Sample_Header.php'; // New Word Document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true)); $phpWord->addParagraphStyle('pStyle', array('alignment' => 'center', 'spaceAfter' => 100)); $phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240)); // New portrait section $section = $phpWord->addSection(); // Simple text $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.', 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(); // Inline font style $fontStyle['name'] = 'Times New Roman'; $fontStyle['size'] = 20; $textrun = $section->addTextRun(); $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'));
<?php include_once 'Sample_Header.php'; // New Word Document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); \PhpOffice\PhpWord\Settings::setCompatibility(false); // New portrait section $section = $phpWord->addSection(); // Add style definitions $phpWord->addParagraphStyle('pStyle', array('spacing' => 100)); $phpWord->addFontStyle('BoldText', array('bold' => true)); $phpWord->addFontStyle('ColoredText', array('color' => 'FF8080')); $phpWord->addLinkStyle('NLink', array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); // Add text elements $textrun = $section->addTextRun('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. ', 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, ', 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 ', 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.', 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.', ENT_COMPAT, 'UTF-8'));
<?php include_once 'Sample_Header.php'; // New Word Document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true)); $phpWord->addParagraphStyle('pStyle', array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'spaceAfter' => 100)); $phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240)); // New portrait section $section = $phpWord->addSection(); // Simple text $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.', 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(); // Inline font style $fontStyle['name'] = 'Times New Roman'; $fontStyle['size'] = 20; $textrun = $section->addTextRun(); $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'));
<?php include_once 'Sample_Header.php'; // New Word document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); // Define styles $fontStyleName = 'myOwnStyle'; $phpWord->addFontStyle($fontStyleName, array('color' => 'FF0000')); $paragraphStyleName = 'P-Style'; $phpWord->addParagraphStyle($paragraphStyleName, array('spaceAfter' => 95)); $multilevelNumberingStyleName = 'multilevel'; $phpWord->addNumberingStyle($multilevelNumberingStyleName, 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)))); $predefinedMultilevelStyle = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED); // New section $section = $phpWord->addSection(); // Lists $section->addText('Multilevel list.'); $section->addListItem('List Item I', 0, null, $multilevelNumberingStyleName); $section->addListItem('List Item I.a', 1, null, $multilevelNumberingStyleName); $section->addListItem('List Item I.b', 1, null, $multilevelNumberingStyleName); $section->addListItem('List Item II', 0, null, $multilevelNumberingStyleName); $section->addListItem('List Item II.a', 1, null, $multilevelNumberingStyleName); $section->addListItem('List Item III', 0, null, $multilevelNumberingStyleName); $section->addTextBreak(2); $section->addText('Basic simple bulleted list.'); $section->addListItem('List Item 1'); $section->addListItem('List Item 2'); $section->addListItem('List Item 3'); $section->addTextBreak(2); $section->addText('Continue from multilevel list above.');
$result = fetchAllInfoPlanCadre($_SESSION['id_plancadre']); $info_plancadre = $result[0]; $etat = $info_plancadre["Etat"]; $nom_cours = "Titre du cours : " . $info_plancadre["NomCours"]; $code_cours = "Numéro du cours : " . $info_plancadre["CodeCours"]; $nom_programme = $info_plancadre["NomProgramme"]; $code_programme = $info_plancadre["CodeProgramme"]; $programme_cours = $nom_programme . "(" . $code_programme . ")"; $ponderation_cours = "Pondération : " . $info_plancadre["Ponderation"]; $nombre_unites_cours = "Nombre d'unité(s) : " . $info_plancadre["NombreUnites"]; $prealable_cours = "Préalable(s) : " . "Aucun"; $type_enseignement = $info_plancadre['TypeCours']; $php_word = new \PhpOffice\PhpWord\PhpWord(); // ---------------------------------------------- // ajout des styles au document $php_word->addParagraphStyle("style_align_right", $GLOBALS["style_align_right"]); $php_word->addParagraphStyle("style_align_center", $GLOBALS["style_align_center"]); $php_word->addTableStyle('style_table', $GLOBALS["style_table"]); // ---------------------------------------------- // ---------------------------------------------- // Section de l'indentification du cours $section_template = $php_word->addSection(); // $nom_etablissement = "Collège Lionel-Groulx"; $section_template->addText($nom_etablissement); $section_template->addText($type_enseignement, null, "style_align_right"); $section_template->addText($programme_cours, null, "style_align_right"); switch ($info_plancadre["Etat"]) { case 'Adopté': if ($info_plancadre["Officiel"] > 0) { $titre_document = "Plan-cadre officiel";
if ($invoiceArr['totalboxes'] == 1) { $numBoxes = 1; } else { $numBoxes = $invoiceArr['totalboxes']; } } else { if ($invoiceArr['totalboxesreturned'] == 1) { $numBoxes = 1; } else { $numBoxes = $invoiceArr['totalboxesreturned']; } } } if ($export) { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('header', array('align' => 'center', 'lineHeight' => 1.0, 'spaceAfter' => 450)); $phpWord->addFontStyle('headerFont', array('size' => 12, 'bold' => true, 'name' => 'Arial')); $phpWord->addParagraphStyle('toAddress', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $phpWord->addFontStyle('toAddressFont', array('size' => 10, 'name' => 'Arial')); $phpWord->addParagraphStyle('identifier', array('align' => 'right', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $phpWord->addFontStyle('identifierFont', array('size' => 10, 'bold' => true, 'name' => 'Arial')); $phpWord->addParagraphStyle('sendwhom', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $phpWord->addFontStyle('sendwhomFont', array('size' => 10, 'name' => 'Arial')); $phpWord->addParagraphStyle('returnamtdue', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $phpWord->addFontStyle('returnamtdueFont', array('size' => 10, 'bold' => true, 'name' => 'Arial')); $phpWord->addParagraphStyle('other', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $phpWord->addFontStyle('otherFont', array('size' => 10, 'name' => 'Arial')); $tableStyle = array('width' => 100); $colRowStyle = array('cantSplit' => true); $phpWord->addTableStyle('headTable', $tableStyle, $colRowStyle); $cellStyle = array('valign' => 'top');
} $identifier = 0; if ($loanId) { $identifier = $loanId; } elseif ($exchangeId) { $identifier = $exchangeId; } if ($institution) { $invoiceArr = $loanManager->getToAddress($institution); } else { $invoiceArr = $loanManager->getInvoiceInfo($identifier, $loanType); } $addressArr = $loanManager->getFromAddress($collId); if ($export) { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('acctnum', array('align' => 'left', 'indent' => 5.5, 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('acctnumFont', array('size' => 8, 'name' => 'Arial')); $phpWord->addParagraphStyle('toAddress', array('align' => 'left', 'indent' => 6, 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('toAddressFont', array('size' => 12, 'name' => 'Arial')); $section = $phpWord->addSection(array('pageSizeW' => 13662.992125984, 'pageSizeH' => 5952.755905512, 'marginLeft' => 360, 'marginRight' => 360, 'marginTop' => 360, 'marginBottom' => 360, 'headerHeight' => 0, 'footerHeight' => 0)); $section->addTextBreak(5); if ($accountNum) { $section->addText(htmlspecialchars('Acct. #' . $accountNum), 'acctnumFont', 'acctnum'); } $section->addTextBreak(1); $textrun = $section->addTextRun('toAddress'); $textrun->addText(htmlspecialchars($invoiceArr['contact']), 'toAddressFont'); $textrun->addTextBreak(1); $textrun->addText(htmlspecialchars($invoiceArr['institutionname'] . ' (' . $invoiceArr['institutioncode'] . ')'), 'toAddressFont'); $textrun->addTextBreak(1); if ($invoiceArr['institutionname2']) {
} if ($showAlphaTaxa) { $clManager->setShowAlphaTaxa(); } $clid = $clManager->getClid(); $pid = $clManager->getPid(); $isEditor = false; if ($isAdmin || array_key_exists("ClAdmin", $userRights) && in_array($clid, $userRights["ClAdmin"])) { $isEditor = true; } $taxaArray = array(); if ($clValue || $dynClid) { $taxaArray = $clManager->getTaxaList($pageNumber, 0); } $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('defaultPara', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addFontStyle('titleFont', array('bold' => true, 'size' => 20, 'name' => 'Arial')); $phpWord->addFontStyle('topicFont', array('bold' => true, 'size' => 12, 'name' => 'Arial')); $phpWord->addFontStyle('textFont', array('size' => 12, 'name' => 'Arial')); $phpWord->addParagraphStyle('linePara', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0, 'keepNext' => true)); $phpWord->addParagraphStyle('familyPara', array('align' => 'left', 'lineHeight' => 1.0, 'spaceBefore' => 225, 'spaceAfter' => 75, 'keepNext' => true)); $phpWord->addFontStyle('familyFont', array('bold' => true, 'size' => 16, 'name' => 'Arial')); $phpWord->addParagraphStyle('scinamePara', array('align' => 'left', 'lineHeight' => 1.0, 'indent' => 0.3125, 'spaceBefore' => 0, 'spaceAfter' => 45, 'keepNext' => true)); $phpWord->addFontStyle('scientificnameFont', array('bold' => true, 'italic' => true, 'size' => 12, 'name' => 'Arial')); $phpWord->addParagraphStyle('notesvouchersPara', array('align' => 'left', 'lineHeight' => 1.0, 'indent' => 0.78125, 'spaceBefore' => 0, 'spaceAfter' => 45)); $phpWord->addParagraphStyle('imagePara', array('align' => 'center', 'lineHeight' => 1.0, 'spaceBefore' => 0, 'spaceAfter' => 0)); $tableStyle = array('width' => 100); $colRowStyle = array('cantSplit' => true, 'exactHeight' => 3750); $phpWord->addTableStyle('imageTable', $tableStyle, $colRowStyle); $imageCellStyle = array('valign' => 'center', 'width' => 2475, 'borderSize' => 15, 'borderColor' => '808080'); $blankCellStyle = array('valign' => 'center', 'width' => 2475, 'borderSize' => 15, 'borderColor' => '000000');
<?php include_once 'Sample_Header.php'; // New Word document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); // Define styles $fontStyle24 = array('size' => 24); $paragraphStyle24 = array('spacing' => 240, 'size' => 24); $fontStyleName = 'fontStyle'; $phpWord->addFontStyle($fontStyleName, array('size' => 9)); $paragraphStyleName = 'paragraphStyle'; $phpWord->addParagraphStyle($paragraphStyleName, array('spacing' => 480)); // New section $section = $phpWord->addSection(); $section->addText('Text break with no style:'); $section->addTextBreak(); $section->addText('Text break with defined font style:'); $section->addTextBreak(1, $fontStyleName); $section->addText('Text break with defined paragraph style:'); $section->addTextBreak(1, null, $paragraphStyleName); $section->addText('Text break with inline font style:'); $section->addTextBreak(1, $fontStyle24); $section->addText('Text break with inline paragraph style:'); $section->addTextBreak(1, null, $paragraphStyle24); $section->addText('Done.'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }
$loanManager->setCollId($collId); } $spanish = $language == 'span' ? 1 : 0; $identifier = 0; if ($loanId) { $identifier = $loanId; } elseif ($exchangeId) { $identifier = $exchangeId; } $invoiceArr = $loanManager->getInvoiceInfo($identifier, $loanType); $addressArr = $loanManager->getFromAddress($collId); $specTotal = $loanManager->getSpecTotal($loanId); $specList = $loanManager->getSpecList($loanId); if ($export) { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('header', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('headerFont', array('size' => 14, 'name' => 'Arial')); $phpWord->addParagraphStyle('info', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('infoFont', array('size' => 11, 'name' => 'Arial')); $phpWord->addFontStyle('colHeaderFont', array('size' => 8, 'bold' => true, 'name' => 'Arial')); $phpWord->addFontStyle('colFont', array('size' => 8, 'name' => 'Arial')); $phpWord->addParagraphStyle('colHeadSpace', array('lineHeight' => 1.5, 'spaceAfter' => 0)); $phpWord->addParagraphStyle('colSpace', array('lineHeight' => 1.3, 'spaceAfter' => 0)); $tableHeadStyle = array('borderBottomSize' => 10, 'borderBottomColor' => '000000', 'width' => 100); $tableStyle = array('width' => 100); $colRowStyle = array('cantSplit' => true); $phpWord->addTableStyle('headerTable', $tableHeadStyle, $colRowStyle); $phpWord->addTableStyle('listTable', $tableStyle, $colRowStyle); $cellStyle = array('valign' => 'bottom'); $section = $phpWord->addSection(array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 1080, 'marginRight' => 1080, 'marginTop' => 1080, 'marginBottom' => 1080, 'headerHeight' => 0, 'footerHeight' => 0)); $textrun = $section->addTextRun('header');
if ($rowsPerPage == 3) { $lineWidth = 220; $sectionStyle = array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 360, 'marginRight' => 360, 'marginTop' => 360, 'marginBottom' => 360, 'headerHeight' => 0, 'footerHeight' => 0, 'colsNum' => 3, 'colsSpace' => 690, 'breakType' => 'continuous'); } $labelManager->setCollid($collid); $isEditor = 0; if ($symbUid) { if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collid, $userRights["CollAdmin"]) || array_key_exists("CollEditor", $userRights) && in_array($collid, $userRights["CollEditor"])) { $isEditor = 1; } } if ($isEditor && $action) { $labelArr = $labelManager->getLabelArray($_POST['occid'], $speciesAuthors); } $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('firstLine', array('lineHeight' => 0.1, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addParagraphStyle('lastLine', array('spaceAfter' => 300, 'lineHeight' => 0.1)); $phpWord->addFontStyle('dividerFont', array('size' => 1)); $phpWord->addParagraphStyle('barcodeonly', array('align' => 'center', 'lineHeight' => 1.0, 'spaceAfter' => 300, 'keepNext' => true, 'keepLines' => true)); $phpWord->addParagraphStyle('lheader', array('align' => 'center', 'lineHeight' => 1.0, 'spaceAfter' => 150, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('lheaderFont', array('bold' => true, 'size' => 14, 'name' => 'Arial')); $phpWord->addParagraphStyle('family', array('align' => 'right', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('familyFont', array('size' => 10, 'name' => 'Arial')); $phpWord->addParagraphStyle('scientificname', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('scientificnameFont', array('bold' => true, 'italic' => true, 'size' => 11, 'name' => 'Arial')); $phpWord->addFontStyle('scientificnameinterFont', array('bold' => true, 'size' => 11, 'name' => 'Arial')); $phpWord->addFontStyle('scientificnameauthFont', array('size' => 11, 'name' => 'Arial')); $phpWord->addParagraphStyle('identified', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'indent' => 0.3125, 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('identifiedFont', array('size' => 10, 'name' => 'Arial')); $phpWord->addParagraphStyle('loc1', array('spaceBefore' => 150, 'lineHeight' => 1.0, 'spaceAfter' => 0, 'align' => 'left', 'keepNext' => true, 'keepLines' => true)); $phpWord->addFontStyle('countrystateFont', array('size' => 11, 'bold' => true, 'name' => 'Arial'));
function buildPlanCadre($id_plancadre) { $result = fetchAllInfoPlanCadre($id_plancadre); $info_plancadre = $result[0]; $etat = $info_plancadre["Etat"]; $nom_cours = "Titre du cours : " . $info_plancadre["NomCours"]; $code_cours = "Numéro du cours : " . $info_plancadre["CodeCours"]; $nom_programme = $info_plancadre["NomProgramme"]; $code_programme = $info_plancadre["CodeProgramme"]; $programme_cours = $nom_programme . "(" . $code_programme . ")"; $ponderation_cours = "Pondération : " . $info_plancadre["Ponderation"]; $nombre_unites_cours = "Nombre d'unité(s) : " . $info_plancadre["NombreUnites"]; $prealable_cours = "Préalable(s) : " . "Aucun"; $type_enseignement = $info_plancadre['TypeCours']; // le nom des fichiers textes serra : // clé primaire du plancadre + code ou le nom du cours + le nom de la section // exemple : 2_420-EDA-05_PresentationCours.txt $path_presentation = "../plancadre/" . $id_plancadre . "_" . $code_cours . "_" . "presentation" . ".txt"; $path_integration = "../plancadre/" . $id_plancadre . "_" . $code_cours . "_" . "integration" . ".txt"; $path_evalutation = "../plancadre/" . $id_plancadre . "_" . $code_cours . "_" . "evaluation" . ".txt"; $path_competences = "../plancadre/" . $id_plancadre . "_" . $code_cours . "_" . "competences" . ".txt"; $path_apprentissage = "../plancadre/" . $id_plancadre . "_" . $code_cours . "_" . "apprentissage" . ".txt"; $presentation = ReadFrom($path_presentation); $integration = ReadFrom($path_integration); $evaluation = ReadFrom($path_evalutation); $competences = ReadFrom($path_competences); $apprentissage = ReadFrom($path_apprentissage); /* ---------------------------------------------- Début de la création du document. Le code qui suit pourrait être considéré comme un template si on arrive à le paramétrer correctement. ---------------------------------------------- */ $php_word = new \PhpOffice\PhpWord\PhpWord(); // ---------------------------------------------- // ajout des styles au document $php_word->addParagraphStyle("style_align_right", $GLOBALS["style_align_right"]); $php_word->addParagraphStyle("style_align_center", $GLOBALS["style_align_center"]); $php_word->addTableStyle('style_table', $GLOBALS["style_table"]); // ---------------------------------------------- // ---------------------------------------------- // Section de l'indentification du cours $section_template = $php_word->addSection(); // $nom_etablissement = "Collège Lionel-Groulx"; $section_template->addText($nom_etablissement); $section_template->addText($type_enseignement, null, "style_align_right"); $section_template->addText($programme_cours, null, "style_align_right"); switch ($info_plancadre["Etat"]) { case 'Adopté': if ($info_plancadre["Officiel"] > 0) { $titre_document = "Plan-cadre officiel"; } else { $titre_document = "Plan-cadre en archive"; } break; case 'Validé': case 'Élaboration': default: $titre_document = "Plan-cadre en élaboration"; break; } // espace avant et après le titre du document $section_template->addText($GLOBALS["saut_ligne"]); $section_template->addText($titre_document, $GLOBALS["style_font_titre"], $GLOBALS["style_align_center"]); $section_template->addText($GLOBALS["saut_ligne"]); $table_identification = $section_template->addTable('style_table'); $nombre_colonnes = 3; $cell_width = $GLOBALS["table_width"] / $nombre_colonnes; $table_identification->addRow($GLOBALS["style_row"]); $table_identification->addCell($cell_width, $GLOBALS["style_cellule_titre"])->addText("Identification du cours", $GLOBALS["style_font_titre"], $GLOBALS["style_align_center"]); $table_identification->addRow($GLOBALS["style_row"]); $table_identification->addCell($cell_width)->addText("Discipline", null, $GLOBALS["style_align_center"]); $table_identification->addCell($cell_width)->addText($nom_cours, null, $GLOBALS["style_align_center"]); $table_identification->addCell($cell_width)->addText($code_cours, null, $GLOBALS["style_align_center"]); $table_identification->addRow($GLOBALS["style_row"]); $table_identification->addCell($cell_width)->addText($ponderation_cours, null, $GLOBALS["style_align_center"]); $table_identification->addCell($cell_width)->addText($nombre_unites_cours, null, $GLOBALS["style_align_center"]); $table_identification->addCell($cell_width)->addText("test", null, $GLOBALS["style_align_center"]); // Fin de la section de l'indentification du cours // ---------------------------------------------- // ---------------------------------------------- // Section de la présentation du cours $titre = "Présentation du cours"; addSection($php_word, $titre, $presentation); // Fin de la section de la présentation du cours // ---------------------------------------------- // ---------------------------------------------- // Section de l'objectif d'intégration $titre = "Objectif d'intégration"; addSection($php_word, $titre, $integration); // Fin de la section de l'objectif d'intégration // ---------------------------------------------- // ---------------------------------------------- // Section de l'évaluation des apprentissages $titre = 'Évaluation des apprentissages'; addSection($php_word, $titre, $evaluation); // Fin de la section de l'évaluation des apprentissages // ---------------------------------------------- // ---------------------------------------------- // Section de l'énoncé des compétences $titre_section = "Énoncé des compétences"; addSection($php_word, $titre, $competences); // Fin de la section de l'énoncé des compétences // ---------------------------------------------- // ---------------------------------------------- // Section des objectifs d'apprentissage $titre = "Objectifs d'apprentissage"; addSection($php_word, $titre, $apprentissage); // Fin de la section des objectifs d'apprentissage // ---------------------------------------------- $path_docx = "../plancadre/" . $id_plancadre . "_" . $code_cours . ".docx"; $php_word->save($path_docx); }