当前位置: 首页>>代码示例>>PHP>>正文


PHP CreateDocx::addHeader方法代码示例

本文整理汇总了PHP中CreateDocx::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP CreateDocx::addHeader方法的具体用法?PHP CreateDocx::addHeader怎么用?PHP CreateDocx::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CreateDocx的用法示例。


在下文中一共展示了CreateDocx::addHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Create a Word fragment with an image to be inserted in the header of the document
$imageOptions = array('src' => '../../img/image.png', 'dpi' => 300);
$headerImage = new WordFragment($docx, 'defaultHeader');
$headerImage->addImage($imageOptions);
$docx->addHeader(array('default' => $headerImage));
//add some text
$docx->addText('This document has a header with just one image.');
$docx->createDocx('example_addHeader_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:13,代码来源:sample_1.php

示例2: exportCompleteReportDOC

 /**
  * Exports the complete report as a DOCX file
  * @return	boolean		False on error
  * @todo use unoconv
  */
 public function exportCompleteReportDOC($data)
 {
     $_course = api_get_course_info();
     $filename = 'gb_results_' . $_course['code'] . '_' . gmdate('YmdGis');
     $filepath = api_get_path(SYS_ARCHIVE_PATH) . $filename;
     //build the results
     $inc = api_get_path(LIBRARY_PATH) . 'phpdocx/classes/CreateDocx.inc';
     require_once api_get_path(LIBRARY_PATH) . 'phpdocx/classes/CreateDocx.inc';
     $docx = new CreateDocx();
     $paramsHeader = array('font' => 'Courrier', 'jc' => 'left', 'textWrap' => 5);
     $docx->addHeader(get_lang('FlatView'), $paramsHeader);
     $params = array('font' => 'Courrier', 'border' => 'single', 'border_sz' => 20);
     $lines = 0;
     $values[] = implode("\t", $data[0]);
     foreach ($data[1] as $line) {
         $values[] = implode("\t", $line);
         $lines++;
     }
     //$data = array();
     //$docx->addTable($data, $params);
     $docx->addList($values, $params);
     //$docx->addFooter('', $paramsHeader);
     $paramsPage = array('orient' => 'landscape');
     $docx->createDocx($filepath, $paramsPage);
     //output the results
     $data = file_get_contents($filepath . '.docx');
     $len = strlen($data);
     //header("Content-type: application/vnd.ms-word");
     header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
     //header('Content-Type: application/force-download');
     header('Content-length: ' . $len);
     header("Content-Disposition: attachment; filename=\"{$filename}.docx\"");
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0,pre-check=0');
     header('Pragma: public');
     echo $data;
     return true;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:43,代码来源:gradebook_result.class.php

示例3: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Date in the header
$options_1 = array('bold' => true, 'fontSize' => 12, 'color' => 'b70000', 'dateFormat' => 'dd/MM/yyyy H:mm:ss');
$date = new WordFragment($docx);
$date->addDateAndHour($options_1);
$docx->addHeader(array('default' => $date));
$docx->addText('Let us include now different examples of the addDateAndHour with different date formatting:');
$options_2 = array('textAlign' => 'center', 'bold' => true, 'fontSize' => 14, 'color' => '333333', 'dateFormat' => "dd' of 'MMMM' of 'yyyy' at 'H:mm");
$docx->addDateAndHour($options_2);
$options_3 = array('bold' => true, 'fontSize' => 11, 'color' => '0000FF', 'dateFormat' => "MM'-'dd'-'yy");
$docx->addDateAndHour($options_3);
$docx->createDocx('example_addDateAndHour_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:16,代码来源:sample_1.php

示例4: CreateDocx

<?php

/**
 * Create a DOCX file. Header
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage intermediate
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    LGPL
 * @version    2.0
 * @link       http://www.phpdocx.com
 * @since      File available since Release 2.0
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$paramsHeader = array('font' => 'Times New Roman', 'jc' => 'right', 'textWrap' => 5);
$docx->addHeader('Header text', $paramsHeader);
$docx->createDocx('example_header');
开发者ID:aodkrisda,项目名称:PHP-Digital-Format-Convert-Epub-Mobi-PDF,代码行数:20,代码来源:Header.php

示例5: CreateDocx

<?php

/**
 * Create a DOCX file. Header and footer with font styles
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage intermediate
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    LGPL
 * @version    2.0
 * @link       http://www.phpdocx.com
 * @since      File available since Release 2.0
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$paramsHeader = array('name' => '../files/img/image.png', 'jc' => 'right', 'textWrap' => 5, 'font' => 'Arial');
$docx->addHeader('Header Arial', $paramsHeader);
$paramsHeader = array('font' => 'Times New Roman');
$docx->addHeader('Header Times New Roman', $paramsHeader);
$paramsFooter = array('pager' => 'true', 'pagerAlignment' => 'center', 'font' => 'Arial');
$docx->addFooter('Footer Arial', $paramsFooter);
$docx->createDocx('example_header_and_footer');
开发者ID:aodkrisda,项目名称:PHP-Digital-Format-Convert-Epub-Mobi-PDF,代码行数:24,代码来源:HeaderAndFooter.php

示例6: CreateDocx

require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//create a Word fragment with an image to be inserted in the header of the document
$imageOptions = array('src' => '../../img/image.png', 'dpi' => 600);
$headerImage = new WordFragment($docx, 'defaultHeader');
$headerImage->addImage($imageOptions);
//create a Word Fragment with a text
$textOptions = array('fontSize' => 13, 'b' => 'on', 'color' => '567899');
$headerText = new WordFragment($docx, 'defaultHeader');
$headerText->addText('PHPDocX Header Title', $textOptions);
//create a Word Fragment with page numbering
$pageNumberOptions = array('textAlign' => 'right', 'fontSize' => 11);
$headerPageNumber = new WordFragment($docx, 'defaultHeader');
$headerPageNumber->addPageNumber('numerical', $pageNumberOptions);
//create a Word Fragment with a table that will hold all elements
//Warning: we include an additional border none property to the table cells to improve
//PDF rendering
$valuesTable = array(array(array('value' => $headerImage, 'vAlign' => 'center'), array('value' => $headerText, 'vAlign' => 'center'), array('value' => $headerPageNumber, 'vAlign' => 'center')));
$widthTableCols = array(700, 7500, 500);
$paramsTable = array('border' => 'nil', 'columnWidths' => $widthTableCols);
$headerTable = new WordFragment($docx, 'defaultHeader');
$headerTable->addTable($valuesTable, $paramsTable);
//add some text to the body of the document
$docx->addHeader(array('default' => $headerTable));
//add some text in the first page of the document
$docx->addText('This document has a header with an image, some text and page numbering.');
//add a page break so we see the numbering at work
$docx->addBreak(array('type' => 'page'));
//add some text in the first page of the document
$docx->addText('Now some text in the second page.');
$docx->createDocx('example_addHeader_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:sample_2.php


注:本文中的CreateDocx::addHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。