odtphp

hello friends today i work on odtphp

OdtPHP is an oriented object libary for PHP 5+. It allows you to generate automatically OpenOffice text documents from templates. You can use it directly within your PHP scripts (without OpenOffice).
OdtPHP is very easy to use : with a minimum of code, you will be able to generate simple documents by replacing tags from template and by inserting some images. You can also take advantage from advanced features in order to create complex OpenOffice files by repeating parts of the document or lines of array.
Features
OdtPHP allows you to replace tags from your OpenOffice template by text content or pictures. The library also handles loops that can be imbricated as you want. Moreover, odtPHP allows you to simply repeat lines of OpenOffice tables. Eventually, you can export the final result in a file on your server or directly to the client browser.

Requirements
1. Linux Operating System
1. Apache Web Server
2. MySql
3. PHP
3. Download odtphp-1.0.1.zip link http://sourceforge.net/projects/odtphp/files/

untar the folder and place in www folder

create a example.odt file and example.php file . both file place in /www/odtphp/tests folder

now open your example.odt file and assign the attributes  this attributes gave the help to edit the file

1){titre}   //this attributes work for title

2){message} //this attributes work for message

3){im age} //this attributes work for image

put this simple code in example.php file

<?php
require_once(‘../library/odf.php’);
$odf = new odf(“example.odt”);
$odf->setVars(‘titre’,’helllo mr’);
$message=”PHP (sigle de PHP: Hypertext Preprocessor), est un langage de scripts libre
principalement utilisé pour produire des pages Web dynamiques via un serveur HTTP, mais
pouvant également fonctionner comme n’importe quel langage interprété de façon locale,
en exécutant les programmes en ligne de commande.”;
$odf->setVars(‘message’,$message);
$odf->setImage(‘image’, ‘./images/anaska.jpg’);
$odf->exportAsAttachedFile();
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s