PHP Classes

File: wordtest.php

Recommend this page to a friend!
  Classes of Sebastian Zdrojewski   lib_word   wordtest.php   Download  
File: wordtest.php
Role: Example script
Content type: text/plain
Description: Proof concept
Class: lib_word
Manipulate Microsoft Word documents using COM
Author: By
Last change:
Date: 13 years ago
Size: 723 bytes
 

Contents

Class file image Download
<?php
/*
 * Author: En3pY
 * Created on: 20/JUN/2010
 * File Name: wordtest.php
 *
 * File description:
 * Proof concept of the class declaration and execution
 *
 */

class report extends lib_word {
    public function
buildWordDocument() {
       
$this->start();
       
$this->set_fileFormat( 'pdf' );
       
       
$this->set_field( 'custom_field_1', 'Field value 1' );
       
$this->set_field( 'custom_field_2', 'Another field value' );
       
$this->set_field( 'custom_field_3', true );
       
$this->set_field( 'custom_field_4', '12345/2010' );
       
       
$this->finish();
    }
}

$wordObj = new report();

$wordObj->set_template( 'template.docx' );
$wordObj->set_output( 'prova-01.pdf' );

$wordObj->buildWordDocument();

?>