/**
  * Start with the 5th word and increase the amount of context
  * until it reaches the edges of the token list. Check the
  * next tokens.
  */
 public function testNextContext()
 {
     for ($i = 0; $i < 5; $i++) {
         $doc = new WordDocument($this->tokens, 4, $i);
         list($_, $_, $next) = $doc->getDocumentData();
         $this->assertCount($i, $next, "With {$i} words context next should be {$i} words long");
         for ($j = 5; $j < 5 + $i; $j++) {
             $this->assertEquals($this->tokens[$j], $next[$j - 5]);
         }
     }
 }
Example #2
0
/  Author: Alexey Kichaev
/  Home page: http://webli.ru/phpdocx/
/  License: MIT or GPL
/  GITHub: https://github.com/alkich/PHPDocx
/  Date: 14/03/2012
/
/***************************************/

// Выявляем все ошибки
error_reporting( E_ALL | E_NOTICE );

// Подключаем класс
include 'PHPDocx_0.9.2.php';

// Создаем и пишем в файл. Деструктор закрывает
$w = new WordDocument( "example.docx" );

// Использование метода assign
/******************************
/
/ $w->assign( 'text' );
/ $w->assign( 'image.png' );
/ $xml = $w->assign( 'image.png', true );
/ $w->assign( $w->assign( 'image.png' ) );
/
/******************************/

$w->assign('image.jpg');
$w->assign('Кто узнал эту женщину - тот настоящий знаток женской красоты.');

$w->create();