Exemplo n.º 1
1
$table1->addCell()->addText("Costo");
$total = 0;
foreach ($alumns as $al) {
    $medic = $al->getMedic();
    $pacient = $al->getPacient();
    $table1->addRow();
    $table1->addCell(3000)->addText($al->title);
    $table1->addCell(3000)->addText($pacient->name . " " . $pacient->lastname);
    $table1->addCell(3000)->addText($medic->name . " " . $medic->lastname);
    $table1->addCell(3000)->addText($al->date_at . " " . $al->time_at);
    $table1->addCell(3000)->addText($al->getStatus()->name);
    $table1->addCell(3000)->addText($al->getPayment()->name);
    $table1->addCell(3000)->addText("\$ " . number_format($al->price, 2, ".", ","));
    $total += $al->price;
}
$section1->addText("TOTAL: \$ " . number_format($total, 2, ".", ","), array("size" => 18));
$word->addTableStyle('table1', $styleTable, $styleFirstRow);
/// datos bancarios
$section1->addText("");
$section1->addText("");
$section1->addText("");
$section1->addText("Generado por BookMedik v2.0");
$filename = "report-" . time() . ".docx";
#$word->setReadDataOnly(true);
$word->save($filename, "Word2007");
//chmod($filename,0444);
header("Content-Disposition: attachment; filename='{$filename}'");
readfile($filename);
// or echo file_get_contents($filename);
unlink($filename);
// remove temp file
Exemplo n.º 2
1
}
$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));
$title = str_replace('"', '"', $clManager->getClName());
$title = str_replace(''', "'", $title);
$textrun = $section->addTextRun('defaultPara');
$textrun->addLink('http://' . $_SERVER['HTTP_HOST'] . $clientRoot . '/checklists/checklist.php?cl=' . $clValue . "&proj=" . $pid . "&dynclid=" . $dynClid, htmlspecialchars($title), 'titleFont');
$textrun->addTextBreak(1);
if ($clValue) {
    if ($clArray['type'] == 'rarespp') {
        $locality = str_replace('"', '"', $clArray["locality"]);
        $locality = str_replace(''', "'", $locality);
        $textrun->addText(htmlspecialchars('Sensitive species checklist for: '), 'topicFont');
        $textrun->addText(htmlspecialchars($locality), 'textFont');
        $textrun->addTextBreak(1);
Exemplo n.º 3
0
$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);
while ($vo_result->nextHit()) {
    $table = $section->addTable('myOwnTableStyle');
    $table->addRow();
    $list = $va_display_list;
    // First column : media
    $mediaCell = $table->addCell(5 * $cmToTwips);
    $va_info = $vo_result->getMediaInfo('ca_object_representations.media', "medium");
    if ($va_info['MIMETYPE'] == 'image/jpeg') {
        // don't try to insert anything non-jpeg into an Excel file
        $vs_path = $vo_result->getMediaPath('ca_object_representations.media', "medium");
        if (is_file($vs_path)) {
            $mediaCell->addImage($vs_path, array('width' => 195, 'wrappingStyle' => 'inline'));
        }
    }
    // Second column : bundles
Exemplo n.º 4
0
$table = $section->addTable();
for ($r = 1; $r <= 8; $r++) {
    $table->addRow();
    for ($c = 1; $c <= 5; $c++) {
        $table->addCell(1750)->addText(htmlspecialchars("Row {$r}, Cell {$c}"));
    }
}
// 2. Advanced table
$section->addTextBreak(1);
$section->addText(htmlspecialchars('Fancy table'), $header);
$styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80);
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
$fontStyle = array('bold' => true, 'align' => 'center');
$phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow);
$table = $section->addTable('Fancy Table');
$table->addRow(900);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 1'), $fontStyle);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 2'), $fontStyle);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 3'), $fontStyle);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 4'), $fontStyle);
$table->addCell(500, $styleCellBTLR)->addText(htmlspecialchars('Row 5'), $fontStyle);
for ($i = 1; $i <= 8; $i++) {
    $table->addRow();
    $table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
    $table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
    $table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
    $table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
    $text = 0 == $i % 2 ? 'X' : '';
    $table->addCell(500)->addText(htmlspecialchars($text));
$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) {
    $headerStr = trim($lHeader);
    $footerStr = trim($lFooter);
    $dupCnt = $_POST['q-' . $occid];
    for ($i = 0; $i < $dupCnt; $i++) {
        $section->addText(htmlspecialchars(' '), 'dividerFont', 'firstLine');
        $table = $section->addTable('defaultTable');
        $table->addRow();
        $cell = $table->addCell(5000, $cellStyle);
        if ($headerStr) {
            $textrun = $cell->addTextRun('header');
            $textrun->addText(htmlspecialchars($headerStr), 'headerfooterFont');
        }
Exemplo n.º 6
0
$theader->addRow();
$theader->addCell(8000, array('valign' => 'left'))->addText($adH . '(' . $seviyeH . ')', array('name' => 'Times New Roman', 'size' => 11), 'leftHeadStyle');
$theader->addCell(8000, array('valign' => 'right'))->addText($kodH . ' / ' . $onayH . ' / ' . $revH, array('name' => 'Times New Roman', 'size' => 11), 'rightHeadStyle');
$theader->addRow();
$theader->addCell(8000, array('valign' => 'left'))->addText('Ulusal Meslek Standardı', array('name' => 'Times New Roman', 'size' => 11), 'leftHeadStyle');
$theader->addCell(8000, array('valign' => 'right'))->addText('Referans Kodu / Onay Tarihi / Rev. No', array('name' => 'Times New Roman', 'size' => 11), 'rightHeadStyle');
//header Son
//2. Sayfa Table
$styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 600);
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '00000', 'bgColor' => '66BBFF');
// Define cell style arrays
$styleCell = array('valign' => 'center');
// Define font style for first row
$fontStyle = array('bold' => true, 'name' => 'Times New Roman', 'size' => 12);
// Add table style
$phpWord->addTableStyle('myOwnTableStyle', $styleTable);
$section = $phpWord->createSection(array('orientation' => 'portrait'));
$cellStyle = array('spacing' => 0, 'align' => 'left', 'spaceBefore' => 0, 'spaceAfter' => 400);
// Add table
$table = $section->addTable('myOwnTableStyle');
$table->addRow(2);
$table->addCell(5000, array('borderSize' => 6, 'valign' => 'left'))->addText('Meslek:', $fontStyle, $cellStyle);
$table->addCell(5000, array('borderSize' => 6, 'valign' => 'left'))->addText($std, $fontStyle, $cellStyle);
$table->addRow(2);
$table->addCell(5000, array('borderSize' => 6, 'valign' => 'left'))->addText('Seviye:', $fontStyle, $cellStyle);
$footCell = $table->addCell(5000, array('borderSize' => 6, 'valign' => 'left'));
$footRun = $footCell->addTextRun();
$footRun->addText($seviye, $fontStyle, $cellStyle);
$footNote = $footRun->addFootnote();
$footNote->addText('Mesleğin yeterlilik seviyesi, sekizli (8) seviye matrisinde seviye (' . $seviyeId . ') olarak belirlenmiştir.', array('name' => 'Times New Roman', 'size' => 10));
// $table->addCell(5000,array('borderSize'=>6,'valign'=>'left'))->addText('Seviye:',$fontStyle,$cellStyle);
 $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";
         } else {
             $titre_document = "Plan-cadre en archive";
for ($r = 1; $r <= 8; $r++) {
    $table->addRow();
    for ($c = 1; $c <= 5; $c++) {
        $table->addCell(1750)->addText("Row {$r}, Cell {$c}");
    }
}
// 2. Advanced table
$section->addTextBreak(1);
$section->addText('Fancy table', $header);
$fancyTableStyleName = 'Fancy Table';
$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER);
$fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
$fancyTableCellStyle = array('valign' => 'center');
$fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
$fancyTableFontStyle = array('bold' => true);
$phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle);
$table = $section->addTable($fancyTableStyleName);
$table->addRow(900);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 1', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 2', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 3', $fancyTableFontStyle);
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 4', $fancyTableFontStyle);
$table->addCell(500, $fancyTableCellBtlrStyle)->addText('Row 5', $fancyTableFontStyle);
for ($i = 1; $i <= 8; $i++) {
    $table->addRow();
    $table->addCell(2000)->addText("Cell {$i}");
    $table->addCell(2000)->addText("Cell {$i}");
    $table->addCell(2000)->addText("Cell {$i}");
    $table->addCell(2000)->addText("Cell {$i}");
    $text = 0 == $i % 2 ? 'X' : '';
    $table->addCell(500)->addText($text);
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 $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));
 $textrun = $section->addTextRun('header');
 $textrun->addText(htmlspecialchars($addressArr['institutionname'] . ' (' . $addressArr['institutioncode'] . ')'), 'headerFont');
 $textrun->addTextBreak(1);
 if ($addressArr['institutionname2']) {
     $textrun->addText(htmlspecialchars($addressArr['institutionname2']), 'headerFont');
     $textrun->addTextBreak(1);
 }
 if ($addressArr['address1']) {
     $textrun->addText(htmlspecialchars($addressArr['address1']), 'headerFont');
     $textrun->addTextBreak(1);
 }
 if ($addressArr['address2']) {
     $textrun->addText(htmlspecialchars($addressArr['address2']), 'headerFont');
Exemplo n.º 11
0
 public function downloadWord()
 {
     // echo COMMON_PATH . 'Org/PhpWord/Autoloader.php';exit;
     require_once COMMON_PATH . 'Org/PhpWord/Autoloader.php';
     \PhpOffice\PhpWord\Autoloader::register();
     \PhpOffice\PhpWord\Settings::loadConfig();
     echo date('H:i:s'), ' Create new PhpWord object', EOL;
     $phpWord = new \PhpOffice\PhpWord\PhpWord();
     $section = $phpWord->addSection();
     $header = array('size' => 16, 'bold' => true);
     $styleTable = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 80, 'width' => '100%');
     $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
     $styleCell = array('align' => 'center');
     $fontStyle = array('bold' => true, 'align' => 'center');
     $section->addText("用户相关", $header);
     $phpWord->addTableStyle('Table', $styleTable);
     $table = $section->addTable('Table');
     $table->addRow(30);
     $table->addCell(2000, $styleCell)->addText("字段", $fontStyle);
     $table->addCell(1000, $styleCell)->addText("类型", $fontStyle);
     $table->addCell(800, $styleCell)->addText("必选", $fontStyle);
     $table->addCell()->addText("说明", $fontStyle);
     for ($i = 1; $i <= 8; $i++) {
         $table->addRow();
         $table->addCell(2000)->addText("userTel");
         $table->addCell(1000)->addText("字符串");
         $table->addCell(800)->addText("是");
         $table->addCell()->addText(htmlspecialchars("手机号码"));
     }
     $section->addPageBreak();
     $fileName = "word报表" . date("YmdHis") . ".docx";
     // header("Content-type: application/vnd.ms-word");
     // header("Content-Disposition:attachment;filename=".$fileName.".docx");
     // header('Cache-Control: max-age=0');
     $phpWord->save($fileName, 'Word2007');
 }
Exemplo n.º 12
0
$table1->addCell(8000)->addText($reservation->note);
$table1->addRow();
$table1->addCell(4000)->addText("Enfermedad", array("bold" => true));
$table1->addCell(8000)->addText($reservation->sick);
$table1->addRow();
$table1->addCell(4000)->addText("Sintomas", array("bold" => true));
$table1->addCell(8000)->addText($reservation->symtoms);
$table1->addRow();
$table1->addCell(4000)->addText("Medicamentos", array("bold" => true));
$table1->addCell(8000)->addText($reservation->medicaments);
$table1->addRow();
$table1->addCell()->addText("Estado", array("bold" => true));
$table1->addCell()->addText($reservation->getStatus()->name);
$table1->addRow();
$table1->addCell()->addText("Pago", array("bold" => true));
$table1->addCell()->addText($reservation->getPayment()->name);
$word->addTableStyle('table1', $styleTable);
/// datos bancarios
$section1->addText("");
$section1->addText("");
$section1->addText("");
$section1->addText("Generado por BookMedik v2.5");
$filename = "reservation-" . time() . ".docx";
#$word->setReadDataOnly(true);
$word->save($filename, "Word2007");
//chmod($filename,0444);
header("Content-Disposition: attachment; filename='{$filename}'");
readfile($filename);
// or echo file_get_contents($filename);
unlink($filename);
// remove temp file
Exemplo n.º 13
0
$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');
$section = $phpWord->addSection(array('pageSizeW' => 12240, 'pageSizeH' => 15840, 'marginLeft' => 1080, 'marginRight' => 1080, 'marginTop' => 1080, 'marginBottom' => 1080, 'headerHeight' => 100, 'footerHeight' => 0));
if ($exportType == 'translation' && $transExportArr) {
    $header = $section->addHeader();
    $header->addPreserveText($sciName . ' - p.{PAGE} ' . date("Y-m-d"), null, array('align' => 'right'));
    $textrun = $section->addTextRun('titlePara');
    if ($GLOSSARY_EXPORT_BANNER) {
        $textrun->addImage('http://' . $_SERVER['HTTP_HOST'] . '/' . $clientRoot . '/images/layout/' . $GLOSSARY_EXPORT_BANNER, array('width' => 500, 'align' => 'center'));
        $textrun->addTextBreak(1);
    }
    $textrun->addText(htmlspecialchars('Translation Table for ' . $sciName), 'titleFont');
    $textrun->addTextBreak(1);
    if ($definitions == 'nodef') {
        $textrun = $section->addTextRun('transTermPara');
      ----------------------------------------------
 */
 $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
 $section_template = $php_word->addSection();
 //
 $nom_etablissement = "Collège Lionel-Groulx";
 $section_template->addText($nom_etablissement);
Exemplo n.º 15
0
 /**
  * just an example
  * */
 public static function Report($cid)
 {
     $m = InvoicePallet::model()->findByAttributes(array('id' => $cid));
     $n = Supplier::model()->findByAttributes(array('number' => $m->supplier_no));
     $i = Pallet::model()->findByAttributes(array('id' => $m->pid));
     spl_autoload_unregister(array('YiiBase', 'autoload'));
     require_once Yii::getPathOfAlias('webroot') . '/assets/phpword/samples/Sample_Header.php';
     spl_autoload_register(array('YiiBase', 'autoload'));
     $phpWord = new \PhpOffice\PhpWord\PhpWord();
     $phpWord->setDefaultFontName('新宋体');
     $phpWord->setDefaultFontSize(12);
     $phpWord->setDefaultParagraphStyle(array('align' => 'both', 'lineHeight' => '2'));
     $section = $phpWord->addSection();
     $section->addText('开票通知', array('bold' => true, 'size' => 24), array('align' => 'center', 'space' => array('before' => 200, 'after' => 100)));
     $section->addText('注意:请收到立即开票!谢谢!', array('bold' => true, 'size' => 20), array('align' => 'center', 'space' => array('before' => 200, 'after' => 200)));
     $section->addText('TO:' . ' ' . $n->name . '        传真:', null, array('align' => 'left'));
     $section->addText('公司名称:拓泓贸易(上海)有限公司', null, array('align' => 'left'));
     $section->addText('纳税人识别号:310112690186868', null, array('align' => 'left'));
     $section->addText('开票地址电话:上海市闵行区元江路5500号D1幢869室(021-54846073)', null, array('align' => 'left'));
     $section->addText('开户行及账号:上海浦东发展银行闵行支行 98280154740006293', null, array('align' => 'left'));
     $section->addTextBreak(1);
     $section->addText('开票资料如下:', array('bold' => true, 'size' => 16), array('align' => 'left'));
     $styleTable = array('borderSize' => 2, 'borderColor' => '686868', 'align' => 'center');
     $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
     $styleCell = array('valign' => 'center', 'halign' => 'center');
     $fontStyle = array('bold' => false, 'size' => 11, 'borderSize' => 2);
     $center = array('spaceBefore' => 10, 'spaceAfter' => 0, 'align' => 'center', 'valign' => 'center');
     $phpWord->addTableStyle('table1', $styleTable, array('align' => 'center'));
     $table = $section->addTable('table1');
     $table->addRow();
     $table->addCell(1800)->addText('开票品名', $fontStyle, $center);
     $table->addCell(1000)->addText('型号', $fontStyle, $center);
     $table->addCell(800)->addText('数量', $fontStyle, $center);
     $table->addCell(800)->addText('单位', $fontStyle, $center);
     $table->addCell(1000)->addText('单价', $fontStyle, $center);
     $table->addCell(1800)->addText('总价', $fontStyle, $center);
     $table->addCell(2500)->addText('合同号', $fontStyle, $center);
     $table->addRow();
     $table->addCell(1800)->addText($m->type, $fontStyle, $center);
     $table->addCell(1000)->addText($m->model, $fontStyle, $center);
     $table->addCell(800)->addText($m->num, $fontStyle, $center);
     $table->addCell(800)->addText($m->unit, $fontStyle, $center);
     $table->addCell(800)->addText($m->unit_price, $fontStyle, $center);
     $table->addCell(1800)->addText($m->unit_price * $m->num, $fontStyle, $center);
     $table->addCell(2500)->addText($i->purchase_contract_no, $fontStyle, $center);
     $table->addRow();
     $table->addCell(1800)->addText('合计', $fontStyle, $center);
     $table->addCell(1000)->addText('', $fontStyle, $center);
     $table->addCell(800)->addText('', $fontStyle, $center);
     $table->addCell(800)->addText('', $fontStyle, $center);
     $table->addCell(800)->addText('', $fontStyle, $center);
     $table->addCell(1800)->addText('¥' . $m->unit_price * $m->num, $fontStyle, $center);
     $table->addCell(2500)->addText($i->purchase_contract_no, $fontStyle, $center);
     $section->addText('请开票后,全套发票寄至以下地址:', array('bold' => true, 'size' => 12), array('align' => 'left'));
     $section->addText('上海市闵行区曲吴路589号9号楼205', null, array('align' => 'left'));
     $section->addText('拓泓贸易(上海)有限公司', null, array('align' => 'left'));
     $section->addText('电话:021-54846073 	13661561440', null, array('align' => 'left'));
     $section->addText('联系人:叶建伟', null, array('align' => 'left'));
     $section->addText('如有疑问,请今日联系!', null, array('align' => 'left'));
     $section->addText('日期:' . date('Y-m-d'), null, array('align' => 'left'));
     $fileName = "{$n->name}.doc";
     //         $fileName = iconv ( "utf-8", "gb2312", $fileName);
     //         $fileName = mb_convert_encoding($fileName, "utf-8", "auto");
     $absPath = Yii::getPathOfAlias('webroot');
     $relPath = '/uploads/files/';
     $file = $absPath . $relPath . $fileName;
     $fPath = $relPath . $fileName;
     $fName = '开票通知 - ' . date("Ymd");
     $res = array('name' => $fName, 'url' => $fPath);
     write($phpWord, $file, $writers);
     return $res;
 }
Exemplo n.º 16
0
    if ($i == 0) {
        $cad = 'C.C.P. ';
        $i = 1;
    }
    $texto = $cad . trim($ccp);
    $section->addText(htmlspecialchars($texto), array('size' => 7, 'bold' => false), array('space' => array('before' => 80, 'after' => 80), 'align' => 'left'));
}
$section = $phpWord->addSection(array('orientation' => 'landscape'));
$styleTable = array('borderSize' => 10, 'borderColor' => 'DDDDDD', 'cellMargin' => 5);
$styleFirstRow = array('borderBottomSize' => 1, 'borderBottomColor' => '0000FF', 'bgColor' => 'DDDDDD');
$styleCell = array('valign' => 'center');
$styleCell1 = array('gridSpan' => 2, 'valign' => 'center');
$fontStyle = array('bold' => true, 'align' => 'center');
$fontStyleCel = array('bold' => false, 'align' => 'center', 'size' => 8);
$fontStyleCe2 = array('bold' => false, 'size' => 8);
$phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow);
$table = $section->addTable('Fancy Table');
$table->addRow(300);
$table->addCell(7500, array('gridSpan' => 3, 'valign' => 'center'))->addText(htmlspecialchars('ANEXO'), $fontStyle);
$table->addCell(7500, array('gridSpan' => 5, 'valign' => 'center'))->addText(htmlspecialchars($dataSec['NomSec']), $fontStyle);
$table->addCell(3000, array('gridSpan' => 2, 'valign' => 'center'))->addText(htmlspecialchars($dataOfi['NomSolPre'] . '
                                                                                203200-' . $dataOfi['PfjOfi'] . '-' . substr($dataOfi['CveOfi'], 2, 4) . '/' . substr($ano, 2, 2)), $fontStyle);
$qry = "select distinct(idObr) from doficio \r\n                where idOfi = '" . $idOficioPdf . "'";
$rs = $cnx->Execute($qry);
$numRows = $rs->_numOfRows;
if ($numRows > 0) {
    $tipfuente = array('S/T', 'Federal', 'Estatal');
    $table->addRow(150);
    $table->addCell(1500, array('valign' => 'center'))->addText(htmlspecialchars('Id Obra'), $fontStyle);
    $table->addCell(6000, array('gridSpan' => 2, 'valign' => 'center'))->addText(htmlspecialchars('Nombre Obra'), $fontStyle);
    $table->addCell(4500, array('gridSpan' => 3, 'valign' => 'center'))->addText(htmlspecialchars('Fuente'), $fontStyle);
$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');
    $section->addTextBreak(1);
    $textrun = $section->addTextRun('info');
    $textrun->addText(htmlspecialchars($addressArr['institutioncode'] . ' Loan ID: ' . $invoiceArr['loanidentifierown']), 'infoFont');
    $textrun->addTextBreak(1);
    $textrun->addText(htmlspecialchars('Date sent: ' . $invoiceArr['datesent']), 'infoFont');
    $textrun->addTextBreak(1);
    $textrun->addText(htmlspecialchars('Total specimens: ' . ($specTotal ? $specTotal['speccount'] : 0)), 'infoFont');
    $section->addTextBreak(1);
    $table = $section->addTable('headerTable');
    $table->addRow();
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);
}