PHP Classes

File: examples/pagebreak.php

Recommend this page to a friend!
  Classes of Raskin Veniamin   VS PHP Word HTML   examples/pagebreak.php   Download  
File: examples/pagebreak.php
Role: Example script
Content type: text/plain
Description: Example script
Class: VS PHP Word HTML
Create DOCX Word document dynamically from HTML
Author: By
Last change:
Date: 9 years ago
Size: 748 bytes
 

Contents

Class file image Download
<?php
/**
* A simple example of creating document with a page break.
*/
require_once '../vsword/VsWord.php';
VsWord::autoLoad();

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

$title = new PCompositeNode();
$rTitle = new RCompositeNode();
$title->addNode($rTitle);
$rTitle->addTextStyle(new BoldStyleNode());
$rTitle->addTextStyle(new FontSizeStyleNode(36));
$rTitle->addText("Header 1");
$body->addNode( $title );

$body->addNode(new PageBreakNode());

$title = new PCompositeNode();
$rTitle = new RCompositeNode();
$title->addNode($rTitle);
$rTitle->addTextStyle(new BoldStyleNode());
$rTitle->addTextStyle(new FontSizeStyleNode(36));
$rTitle->addText("Header 2");
$body->addNode( $title );


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