create
[ class tree: create ] [ index: create ] [ all elements ]

example

  1. <?php
  2.  
  3. /**
  4.  * Inserts current date and hour into a Word document
  5.  *
  6.  * @category   Phpdocx
  7.  * @package    examples
  8.  * @subpackage easy
  9.  * @copyright  Copyright (c) 2009-2013 Narcea Producciones Multimedia S.L.
  10.  *              (http://www.2mdc.com)
  11.  * @license    http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  12.  * @version    2012.12.26
  13.  * @link       http://www.phpdocx.com
  14.  * @since      2012.12.26
  15.  */
  16. require_once '../../classes/CreateDocx.inc';
  17.  
  18. $docx new CreateDocx();
  19.  
  20. $options_1 array('b' => 'on',
  21.                  'sz' => 12,
  22.                  'color' => 'b70000',
  23.                  'dateFormat' => 'dd/MM/yyyy H:mm:ss',
  24.                  'rawWordML' => true);
  25.  
  26. $date $docx->addDateAndHour($options_1);
  27.  
  28. $WordMLFragment $docx->createWordMLFragment(array($date));
  29.  
  30. $docx->addHeader(array('default' => $WordMLFragment));
  31.  
  32. $docx->addText('Let us include now different examples of the addDateAndHour with different date formatting:');
  33.  
  34. $options_2 array('jc' => 'center'
  35.                  'b' => 'on',
  36.                  'sz' => 14,
  37.                  'color' => '333333',
  38.                  'dateFormat' => "dd' of 'MMMM' of 'yyyy' at 'H:mm");
  39.  
  40. $docx->addDateAndHour($options_2);
  41.  
  42. $options_3 array('b' => 'on',
  43.                  'sz' => 11,
  44.                  'color' => 'blue',
  45.                  'dateFormat' => "MM'-'dd'-'yy");
  46.  
  47. $docx->addDateAndHour($options_3);
  48.  
  49. $docx->createDocx('../docx/example_dateAndHour');

Documentation generated on Mon, 13 Jan 2014 13:44:05 +0100 by phpDocumentor 1.4.4