PHP Classes

vsWord Required php version

Recommend this page to a friend!

      VS PHP Word HTML  >  All threads  >  vsWord Required php version  >  (Un) Subscribe thread alerts  
Subject:vsWord Required php version
Summary:vsWord Required php version
Messages:2
Author:Aven Yang
Date:2015-10-03 20:46:22
 

  1. vsWord Required php version   Reply   Report abuse  
Picture of Aven Yang Aven Yang - 2015-10-03 20:46:22
I an newbie of php. Thank you very much for your classes.

For some reasons, I can not get any docx file after running examples.

My questions are

1).Looks like vsword doesn't support by php 5.2, is it correct ?

2). I found downloaded examples do not have full php end syntax ( ?> ). Here is table.php, for example. Why ?

<?php

/**
* A simple example or creating a document with a table.
* In the table cell in inserted plain text, list and image.
*/

require_once '../vsword/VsWord.php';
VsWord::autoLoad();

$doc = new VsWord();
$body = $doc->getDocument()->getBody();

$table = new TableCompositeNode();
$body->addNode($table);
$style = new TableStyle(1);
$table->setStyle($style);
$doc->getStyle()->addStyle($style);

//add row
$tr = new TableRowCompositeNode();
$table->addNode($tr);
//add cols
$col = new TableColCompositeNode();
$col->addText("Large text... Large text...Large text...Large text...Large text...Large text...Large text...");
$col->getLastPCompositeNode()->addNode( new BrNode() );
$tr->addNode($col);

$col = new TableColCompositeNode();
$col->addText("Large text... Large text...Large text...Large text...Large text...Large text...Large text...");
$col->getLastPCompositeNode()->addNode( new BrNode() );
$tr->addNode($col);
//add row
$tr = new TableRowCompositeNode();
$table->addNode($tr);

$col = new TableColCompositeNode();
$tr->addNode($col);

$list = new ListCompositeNode();
$col->addNode($list);
$col->getLastPCompositeNode()->addNode( new BrNode() );

for($i = 1; $i <= 10; $i ++) {
$item = new ListItemCompositeNode();
$item->addText("List item $i");
$list->addNode( $item );
}

//add image in col
$attach = $doc->getAttachImage(dirname(__FILE__).DIRECTORY_SEPARATOR.'img1.jpg');
$drawingNode = new DrawingNode();
$drawingNode->addImage($attach);

$col = new TableColCompositeNode();
$tr->addNode($col);
$col->getLastPCompositeNode()->addNode( $drawingNode );


$doc->saveAs('./table.docx');

  2. Re: vsWord Required php version   Reply   Report abuse  
Picture of Raskin Veniamin Raskin Veniamin - 2015-10-04 20:12:07 - In reply to message 1 from Aven Yang
Hello.

1) I recommend update version to 5.3
2) Close tag in PHP not necessary

Good luck