示例#1
0
$DAO = new DocumentoDAO();
$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*/
示例#2
0
<?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);
<?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';
}
示例#4
0
    $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'));
$phpWord->addFontStyle('localityFont', array('size' => 11, 'name' => 'Arial'));
$phpWord->addParagraphStyle('other', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true));
示例#5
0
文件: word.php 项目: kaantunc/MYK-BOR
$kurulusAd = $this->kurulusAd;
$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');
$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');
$section = $phpWord->addSection($sectionStyle);
foreach ($labelArr as $occid => $occArr) {
            $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');
    $section = $phpWord->addSection(array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 1080, 'marginRight' => 1080, 'marginTop' => 1080, 'marginBottom' => 0, 'headerHeight' => 0, 'footerHeight' => 600));
示例#8
0
<?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'));
示例#9
0
header('Content-Disposition: inline; filename="' . $file . '"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
#$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
#$xmlWriter->save("php://output");
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
// New Word document
// New section
$section = $phpWord->addSection();
// Define styles
$phpWord->addTitleStyle(1, array('size' => 35, 'bold' => true, 'color' => '#e83d84'));
// Adding Text element with font customized using named font style...
$pStyle = 'p';
$phpWord->addFontStyle($pStyle, array('name' => 'Arial', 'size' => 16, 'color' => '757575', 'bold' => false));
// Arc
$section->addTitle($obj->title, 1);
//$section->addText(htmlspecialchars_decode(strip_tags($obj->body)), $pStyle);
WaffleHtml::addHtml($section, $obj->body);
if ($obj->sidebar) {
    $sidebar = $phpWord->addSection();
    $sidebar->addTitle("Sidebar", 1);
    //$sidebar->addText(strip_tags($obj->sidebar), $pStyle);
    WaffleHtml::addHtml($sidebar, $obj->sidebar);
}
$nav = $phpWord->addSection();
$nav->addTitle("Navigation", 1);
foreach ($obj->nav as $anchor) {
    $nav->addLink($ME_URL . $anchor->slug, $anchor->title, array('name' => 'Arial', 'size' => 16, 'color' => 'e83d84', 'bold' => false));
    if ($anchor->nav) {
<?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.');
示例#11
0
<?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
$fontStyle = array('size' => 24);
$paragraphStyle = array('spacing' => 240, 'size' => 24);
$phpWord->addFontStyle('fontStyle', array('size' => 9));
$phpWord->addParagraphStyle('paragraphStyle', array('spacing' => 480));
$fontStyle = array('size' => 24);
$section = $phpWord->addSection();
$section->addText(htmlspecialchars('Text break with no style:', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak();
$section->addText(htmlspecialchars('Text break with defined font style:', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak(1, 'fontStyle');
$section->addText(htmlspecialchars('Text break with defined paragraph style:', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak(1, null, 'paragraphStyle');
$section->addText(htmlspecialchars('Text break with inline font style:', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak(1, $fontStyle);
$section->addText(htmlspecialchars('Text break with inline paragraph style:', ENT_COMPAT, 'UTF-8'));
$section->addTextBreak(1, null, $paragraphStyle);
$section->addText(htmlspecialchars('Done.', ENT_COMPAT, 'UTF-8'));
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
示例#12
0
        $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');
$imageCellStyle = array('valign' => 'top', 'width' => 2520, 'borderSize' => 0, 'borderColor' => 'ffffff');
示例#13
0
 /**
  * @Security("has_role('ROLE_USER')")
  */
 private function downloadQRCodeFile(Rucher $rucher, $ruches)
 {
     //Création de l'objet phpWord pour le fichier word
     $phpWord = new \PhpOffice\PhpWord\PhpWord();
     //Création du path pour gérer les fichiers temporaires
     $path = $this->get('kernel')->getRootDir() . "/../web/generate/";
     //Ajout d'une section
     $section = $phpWord->addSection();
     //Ajout d'un en-tête
     $phpWord->addFontStyle('eStyle', array('bold' => true, 'size' => 16));
     $phpWord->addFontStyle('rStyle', array('size' => 14));
     $header = $section->addHeader();
     $headerTable = $header->addTable();
     $headerTable->addRow();
     $headerTable->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(5))->addImage('logo.png', array('height' => 80));
     $cellText = $headerTable->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(11));
     $cellText->addText(htmlspecialchars($rucher->getExploitation()->getNom()), 'eStyle', array('align' => 'right'));
     $cellText->addText(htmlspecialchars($rucher->getNom()), 'rStyle', array('align' => 'right'));
     //Ajout d'un pied de page
     $footer = $section->addFooter();
     $footer->addPreserveText(htmlspecialchars('{PAGE}/{NUMPAGES}'), null, array('align' => 'right'));
     //Création du style des cellules
     $cellStyle = array('valign' => 'center');
     $phpWord->addFontStyle('qStyle', array('size' => 12));
     //Ajout de la table contenant les qr codes
     $table = $section->addTable();
     //Nombre de ruches dans le fichier, utile pour créer une nouvelle ligne
     $nbRuches = 0;
     foreach ($ruches as $ruche) {
         //3 QRCodes par ligne
         if ($nbRuches % 3 === 0) {
             $table->addRow(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(5.5));
         }
         $nbRuches++;
         //Construction de l'url pour accéder à la ruche
         $url = $this->generateUrl('kg_beekeeping_management_view_ruche', array('ruche_id' => $ruche->getId()), true);
         //Construction du QRCode pointant sur l'url de la ruche
         $options = array('code' => $url, 'type' => 'qrcode', 'format' => 'png');
         $barcode = $this->get('sgk_barcode.generator')->generate($options);
         //Path du fichier avec le QRCode
         $filename = 'qrcode' . $ruche->getId() . '.png';
         //Sauvegarde du fichier
         file_put_contents($path . $filename, base64_decode($barcode));
         //Ajout du QRCode dans le fichier ODT
         $cell = $table->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(5.33), $cellStyle);
         $cell->addText(htmlspecialchars($ruche->getNom()), 'qStyle', array('align' => 'center'));
         $cell->addImage('generate/' . $filename, array('width' => 151.18, 'height' => 151.18, 'wrappingStyle' => 'behind', 'align' => 'center'));
     }
     //Ajout de cellules vides si ligne incomplète
     $reste = 3 - $nbRuches % 3;
     if ($reste < 3) {
         while ($reste > 0) {
             $cell = $table->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(5.33), $cellStyle);
             $reste--;
         }
     }
     //Sauvegarde du fichier ODT
     $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
     $filename = $rucher->getId() . '_qr_codes_rucher_' . $rucher->getNom() . '.docx';
     $objWriter->save($path . $filename, 'Word2007', true);
     //Récupération du contenu du fichier
     $content = file_get_contents($path . $filename);
     //Création de la réponse avec le contentu du fichier (pour le download)
     $response = new Response();
     $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
     $response->headers->set('Content-Disposition', 'attachment;filename="' . $filename);
     $response->setContent($content);
     //Suppression des fichiers créés durant la création du fichier word
     unlink($path . $filename);
     foreach ($ruches as $ruche) {
         $filename = 'qrcode' . $ruche->getId() . '.png';
         unlink($path . $filename);
     }
     //Retour de la réponse
     return $response;
 }
示例#14
0
<?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();
示例#15
0
 /**
  *
  */
 public function exportMemberProfile($id)
 {
     $user = User::find($id);
     if (!$user) {
         return Redirect::route('members')->with('mError', 'Cet utilisateur est introuvable !');
     }
     $phpWord = new \PhpOffice\PhpWord\PhpWord();
     $phpWord->addTitleStyle(1, array('name' => 'Tahoma', 'size' => 30, 'bold' => true), array('align' => 'center', 'spaceBefore' => true, 'spaceAfter' => true));
     $phpWord->addTitleStyle(2, array('name' => 'Tahoma', 'size' => 14, 'color' => '666666', 'bold' => true), array('align' => 'center', 'spaceBefore' => true, 'spaceAfter' => true));
     $phpWord->addFontStyle('defaultText', array('name' => 'Tahoma', 'size' => 12, 'spaceBefore' => true, 'spaceAfter' => true));
     $section = $phpWord->addSection(array('marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(1), 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(1), 'marginRight' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)));
     $textrun = $section->addTextRun('Heading1');
     $textrun->addText($user->fullname);
     $section->addTextBreak();
     $textrun = $section->addTextRun('Heading2');
     $textrun->addText(htmlspecialchars($user->bio_short));
     $section->addTextBreak();
     $table = $section->addTable();
     $table->addRow();
     $cell1 = $table->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(14));
     foreach (explode("\n", htmlspecialchars($user->bio_long)) as $line) {
         $cell1->addText($line, 'defaultText');
     }
     $cell1->addTextBreak();
     if ($user->phone) {
         $cell1->addText(htmlspecialchars(sprintf('Tél: %s', $user->phoneFmt)), 'defaultText', array('align' => 'right'));
     }
     $cell1->addText(htmlspecialchars(sprintf('Email: %s', $user->email)), 'defaultText', array('align' => 'right'));
     if ($user->website) {
         $cell1->addText(htmlspecialchars($user->website), 'defaultText', array('align' => 'right'));
     }
     $cell2 = $table->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(5));
     $image_url = $user->largeAvatarUrl;
     $image_url = preg_replace('!^(.+)\\?.+$!', '$1', $image_url);
     if (false === strpos($image_url, 'http')) {
         $image_url = public_path() . $image_url;
     }
     $cell2->addImage($image_url, array('width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(5)));
     $filename = sprintf('%s.docx', Str::slug($user->fullname));
     $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
     $objWriter->save($filename);
     $content = file_get_contents($filename);
     unlink($filename);
     $headers = array("Content-Description" => "File Transfer", "Content-Transfer-Encoding" => "binary", "Content-type" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Content-Disposition" => "attachment; filename=" . $filename);
     return Response::make($content, 200, $headers);
 }
<?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
$paragraphStyleName = 'pStyle';
$phpWord->addParagraphStyle($paragraphStyleName, array('spacing' => 100));
$boldFontStyleName = 'BoldText';
$phpWord->addFontStyle($boldFontStyleName, array('bold' => true));
$coloredFontStyleName = 'ColoredText';
$phpWord->addFontStyle($coloredFontStyleName, array('color' => 'FF8080', 'bgColor' => 'FFFFCC'));
$linkFontStyleName = 'NLink';
$phpWord->addLinkStyle($linkFontStyleName, array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE));
// New portrait section
$section = $phpWord->addSection();
// Add text run
$textrun = $section->addTextRun($paragraphStyleName);
$textrun->addText('Each textrun can contain native text, link elements or an image.');
$textrun->addText(' No break is placed after adding an element.', $boldFontStyleName);
$textrun->addText(' Both ');
$textrun->addText('superscript', array('superScript' => true));
$textrun->addText(' and ');
$textrun->addText('subscript', array('subScript' => true));
$textrun->addText(' are also available.');
$textrun->addText(' All elements are placed inside a paragraph with the optionally given paragraph style.', $coloredFontStyleName);
$textrun->addText(' Sample Link: ');
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName);
$textrun->addText(' Sample Image: ');
$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
示例#17
0
$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('fromAddress', array('align' => 'left', 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true));
    $phpWord->addFontStyle('fromAddressFont', array('size' => 10, 'name' => 'Arial'));
    $phpWord->addParagraphStyle('toAddress', array('align' => 'left', 'indent' => 2, 'lineHeight' => 1.0, 'spaceAfter' => 0, 'keepNext' => true, 'keepLines' => true));
    $phpWord->addFontStyle('toAddressFont', array('size' => 14, 'name' => 'Arial'));
    $section = $phpWord->addSection(array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 360, 'marginRight' => 360, 'marginTop' => 360, 'marginBottom' => 360, 'headerHeight' => 0, 'footerHeight' => 0));
    $textrun = $section->addTextRun('fromAddress');
    $textrun->addText(htmlspecialchars($addressArr['institutionname'] . ' (' . $addressArr['institutioncode'] . ')'), 'fromAddressFont');
    $textrun->addTextBreak(1);
    if ($addressArr['institutionname2']) {
        $textrun->addText(htmlspecialchars($addressArr['institutionname2']), 'fromAddressFont');
        $textrun->addTextBreak(1);
    }
    if ($addressArr['address1']) {
        $textrun->addText(htmlspecialchars($addressArr['address1']), 'fromAddressFont');
        $textrun->addTextBreak(1);
    }
    if ($addressArr['address2']) {
示例#18
0
<?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'));
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');
$section = $phpWord->addSection(array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 1080, 'marginRight' => 1080, 'marginTop' => 1080, 'marginBottom' => 1080, 'headerHeight' => 0, 'footerHeight' => 0));
示例#20
0
$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']) {
        $textrun->addText(htmlspecialchars($invoiceArr['institutionname2']), 'toAddressFont');
示例#21
0
文件: pword.php 项目: kingspp/Genie
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');
$section->addText("Semester: VIII",'aFonti');
$section->addTextBreak($lineSpace);
}
if (!is_null($ending_date)) {
    $ending_date = strtotime($ending_date);
    $ending_date = date('Y-m-d', $ending_date);
}
$postal_name = $dataobject->postal_name;
$postal_address = $dataobject->postal_address;
$document_holder = $dataobject->document_holder;
$document_holder_address = $dataobject->document_holder_address;
/*****************************************************************************
CREATING THE DOCUMENT TEMPLATE
*****************************************************************************/
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
/*****************************************************************************
FONTS
*****************************************************************************/
$baseFont = 'baseText';
$phpWord->addFontStyle($baseFont, array('name' => 'Times New Roman', 'size' => 13, 'color' => '000000', 'bold' => false));
$titleFont = 'titleText';
$phpWord->addFontStyle($titleFont, array('name' => 'Times New Roman', 'size' => 15, 'color' => '000000', 'bold' => true));
/*****************************************************************************
CONTENT OF COVER
*****************************************************************************/
$section->addText(htmlspecialchars('ADATOK' . "\n" . "\n"), $titleFont);
$section->addText(htmlspecialchars('CÉG NEVE: ' . $company_name . "\n" . 'VEZETŐ NEVE: ' . $manager_name . "\n" . 'VEZETŐ CÍME: ' . $manager_address . "\n" . 'TELEFON: ' . $company_phone . "\n" . 'EMAIL: ' . $company_email . "\n" . 'DÁTUM: ' . $starting_date . ' - ' . $ending_date . "\n" . 'POSTANÉV: ' . $postal_name . "\n" . 'POSTACÍM: ' . $postal_address . "\n" . "IRATŐRZŐ NEVE: " . $document_holder . "\n" . "IRATŐRZŐ CÍME: " . $document_holder_address), $baseFont);
/*****************************************************************************
CREATING THE WORD DOCUMENT
*****************************************************************************/
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('../../cover.docx');
示例#23
0
/* Note: any element you append to a document must reside inside of a Section. */
// Adding an empty Section to the document...
$section = $phpWord->addSection();
// Adding Text element to the Section having font styled by default...
$section->addText(htmlspecialchars('"Learn from yesterday, live for today, hope for tomorrow. ' . 'The important thing is not to stop questioning." ' . '(Albert Einstein)'));
/*
 * Note: it's possible to customize font style of the Text element you add in three ways:
 * - inline;
 * - using named font style (new font style object will be implicitly created);
 * - using explicitly created font style object.
 */
// Adding Text element with font customized inline...
$section->addText(htmlspecialchars('"Great achievement is usually born of great sacrifice, ' . 'and is never the result of selfishness." ' . '(Napoleon Hill)'), array('name' => 'Tahoma', 'size' => 10));
// Adding Text element with font customized using named font style...
$fontStyleName = 'oneUserDefinedStyle';
$phpWord->addFontStyle($fontStyleName, array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true));
$section->addText(htmlspecialchars('"The greatest accomplishment is not in never falling, ' . 'but in rising again after you fall." ' . '(Vince Lombardi)'), $fontStyleName);
// Adding Text element with font customized using explicitly created font style object...
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText(htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)'));
$myTextElement->setFontStyle($fontStyle);
// Saving the document as OOXML file...
$pro_name = "test";
ob_end_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/force-download");
示例#24
0
// Every element you want to append to the word document is placed in a section.
// New portrait section
$sectionStyle = array('orientation' => 'portrait', 'marginTop' => 2 * $cmToTwips, 'marginBottom' => 2 * $cmToTwips, 'marginLeft' => 2 * $cmToTwips, 'marginRight' => 2 * $cmToTwips, 'headerHeight' => 1 * $cmToTwips, 'footerHeight' => 1 * $cmToTwips, 'colsNum' => 1);
$section = $phpWord->addSection($sectionStyle);
// Add header for all pages
$header = $section->addHeader();
//$header->addText("Header");
$headerimage = $this->request->getThemeDirectoryPath() . "/graphics/logos/" . $this->request->config->get('report_img');
if (file_exists($headerimage)) {
    $header->addImage($headerimage, array('height' => 30, 'wrappingStyle' => 'inline'));
}
// Add footer
$footer = $section->addFooter();
$footer->addPreserveText('{PAGE}/{NUMPAGES}', null, array('align' => 'right'));
// Defining font style for headers
$phpWord->addFontStyle('headerStyle', array('name' => 'Verdana', 'size' => 12, 'color' => '444477'));
// Defining font style for display values
$phpWord->addFontStyle('displayValueStyle', array('name' => 'Verdana', 'size' => 14, 'color' => '000000'));
$styleHeaderFont = array('bold' => true, 'size' => 13, 'name' => 'Calibri');
$styleBundleNameFont = array('bold' => false, 'underline' => 'single', 'color' => '666666', 'size' => 11, 'name' => 'Calibri');
$styleContentFont = array('bold' => false, 'size' => 11, 'name' => 'Calibri');
// Define table style arrays
$styleTable = array('borderSize' => 0, 'borderColor' => 'ffffff', 'cellMargin' => 80);
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF');
// Define cell style arrays
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center');
// Define font style for first row
$fontStyle = array('bold' => true, 'align' => 'center');
// Add table style
$phpWord->addTableStyle('myOwnTableStyle', $styleTable, $styleFirstRow);
}
$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');
    $textrun->addText(htmlspecialchars('List of specimens loaned to: ' . $invoiceArr['institutioncode']), 'headerFont');
    $a_class = $this->template == 'panel/em-cartaz' ? 'active' : '';
    $url = $app->createUrl('panel', 'em-cartaz');
    echo "<li><a class='{$a_class}' href='{$url}'><span class='icon icon-em-cartaz'></span> Em Cartaz</a></li>";
});
$app->hook('GET(panel.em-cartaz-<<download|preview>>)', function () use($app, $defaultFrom, $defaultTo) {
    if (!$app->user->is('admin') && !$app->user->is('staff')) {
        //throw new MapasCulturais\Exceptions\PermissionDenied;
        $app->pass();
    }
    $from = isset($this->getData['from']) ? new DateTime($this->getData['from']) : $defaultFrom;
    $to = isset($this->getData['to']) ? new DateTime($this->getData['to']) : $defaultTo;
    $phpWord = new \PhpOffice\PhpWord\PhpWord();
    // Every element you want to append to the word document is placed in a section.
    // To create a basic section:
    $section = $phpWord->addSection();
    $defaultFont = $phpWord->addFontStyle('defaultFont', array('name' => 'Arial', 'size' => 12));
    $documentHead = $phpWord->addFontStyle('documentHead', array('name' => 'Arial', 'size' => 18, 'color' => '44AA88', 'bold' => true));
    $eventTitleFont = $phpWord->addFontStyle('eventTitle', array('name' => 'Arial', 'size' => 12, 'color' => '880000', 'bold' => true));
    $linguagemStyle = $phpWord->addFontStyle('linguagemStyle', array('name' => 'Arial', 'size' => 12, 'color' => 'FF0000', 'bold' => true));
    $linguagens = array('Cinema', 'Dança', 'Teatro', 'Música Popular', 'Música Erudita', 'Exposição', 'Curso ou Oficina', 'Palestra, Debate ou Encontro');
    $section->addText('ROTEIRO GERAL (SITE) REVISTA', $documentHead);
    $getEventTextBlock = function ($event) use($app) {
        //        return "TEXT {$event->name}";
        $eventText = trim($event->shortDescription);
        if (!empty($event->classificacaoEtaria)) {
            $eventText .= $event->classificacaoEtaria;
        }
        $eventText .= '. ';
        // Group occurrences by space
        $spaces = array();
        foreach ($event->occurrences as $occurrence) {
示例#27
0
 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';
     }
 }