Skip to content
Snippets Groups Projects
Verified Commit fe096425 authored by Damien's avatar Damien
Browse files

[COMPOSER] OpenTbs Install

parent d0a4f0ed
No related branches found
No related tags found
No related merge requests found
Showing
with 791 additions and 0 deletions
/.idea/*
# OpenTBS
http://www.tinybutstrong.com/opentbs.php
With OpenTBS you can merge LibreOffice, OpenOffice and Ms Office documents with PHP using the TinyButStrong template engine.
Simple use OpenOffice - LibreOffice or Ms Office to edit your templates : DOCX, XLSX, PPTX, ODT, OSD, ODP and other formats.
That is the Natural Template philosophy.
## Documentation
For documentation see
http://www.tinybutstrong.com/opentbs.php?doc
## Demo
For online demo see
http://www.tinybutstrong.com/opentbs.php?demo
## Distribution repository
OpenTBS in on GitHub since version 1.3.2.
OpenTBS versions 1.9.11 or later can be installed with [Composer](http://getcomposer.org/download/).
The package is "tinybutstrong/opentbs"
= Release 1.9.11 =
== New features ==
* New command OPENTBS_CHART_DELETE_CATEGORY
* New command OPENTBS_GET_OPENED_FILES
* New command OPENTBS_WALK_OPENED_FILES
= Release 1.9.10 =
== Bug fixes ==
* DOCM, PPTM and XSLM documents (that is documents with macros) are merged correctly but Ms Office display an error message when the file is downloaded using $TBS->Show(OPENTBS_DOWNLOAD,...).
= Release 1.9.9 =
== Bug fixes ==
* XLSX sheet containing an empty and unformatted row may produce in some circumstances a corrupted result when merged.
= Release 1.9.8 =
== New features ==
* New command OPENTBS_MAKE_OPTIMIZED_TEMPLATE
== Bug fixes ==
* Processed templates are not marked as prepared.
= Release 1.9.7 =
== New features ==
* New command OPENTBS_GET_FILES
== Bug fixes ==
* Parameter "ope=delcol": if parameter "colnum" is empty then first colmun is deleted while it should be no column.
* Command OPENTBS_CHART: error message « Name of the series not found. » when the series contains special characters, like accents.
= Release 1.9.6 =
== Bug fixes ==
* Some commands used to find a worksheet by its internal id instead of its number in the worksheet list.
Now they all search by number in the worksheet list.
Please not that you may have to change your code if you are using those command with the number if the sheet rather of the name of the sheet.
Concerned commands are:
- OPENTBS_SELECT_SHEET
- OPENTBS_DELETE_SHEET
- OPENTBS_DISPLAY_SHEETS
* Merging text with line-breaks in a DOCX was not displayed correctly in LibreOffice.
== Enhancements ==
* DOCX: Some special merging of enhanced graphical objects (like merging fill color in a shape) may corrupt the document
because they are stored in several ways by Ms Word.
* The XML synopsis in now available in HTML.
= Release 1.9.5 =
== New features ==
* New command OPENTBS_EDIT_ENTITY
* New command OPENTBS_CHART_INFO
* LoadTemplate(false) does close the current template so the template file is no longer locked.
* New OpenTBS add-in for Microsoft Word: it helps to clean TBS tags.
== Enhancements ==
* new property $TBS->OtbsDeleteObsoleteChartData = false; (Ms Office only)
* OpenTBS do not redo optimisation on the loaded template if it has already been done by OpenTBS previously.
* Chart in Ms Office : Ensure the caption of a category is displayed even if is has missing data.
* Some code cleanup.
== Bug fixes ==
* PHP error with ODT templates when changing the name of a Chart series that hadn't any name before.
* PHP error when using command OPENTBS_SEARCH_IN_SLIDES.
* OpenTBS error « unable to found the chart corresponding to 'xxx' » in DOCX when the chart is not formated as "inline with text".
---------------------------------------------------------------------
= Release 1.9.4 =
== Bug fixes ==
* Document corruption with OpenTBS 1.9.3 when merging pictures in a block and using parameter "adjust".
---------------------------------------------------------------------
= Release 1.9.3 =
== Bug fixes ==
* XLSX corruption when merging a float value to a cell when the decimal separator is not a dot because of the locale setting.
* Possible DOCX corruption when using text box or tables in header and footer.
* Produce a corrupted Ms Office document when delete the last series of a chart using command OPENTBS_CHART. May happens with other series.
== Enhancements ==
* OpenTBS clear error message when using Show() without template loaded. Instead of an ugly PHP error.
---------------------------------------------------------------------
= Release 1.9.2 =
Released: 2014-09-25
== Enhancements ==
* 6 times faster when saving XLSX merged sheets with numerous rows.
== New features ==
* New command OPENTBS_RELATIVE_CELLS : optimizes XLSX merged sheets with numerous rows.
---------------------------------------------------------------------
= Release 1.9.1 =
Released: 2014-09-20
== Bug fixes ==
* Adjusting size of image in docx.
* When turn a sheet to hidden in an XLSX, then the file may be corrupted.
* Command OPENTBS_COUNT_SLIDES did not work for ODP.
* A PPTX can be corrupted when opening a template which is a previous result of a merge. This is because an <a:r> must contain at least one <a:t>.
* Merging several XLSX with the same OpenTBS instance can produce erroneous merged cells.
== New features ==
* New parameter "unique" for picture
* ODS files are now recognized. It is equivalent to ODS.
* New command OPENTBS_COUNT_SHEETS
* New command OPENTBS_ADD_CREDIT
* New command OPENTBS_SYSTEM_CREDIT
== Enhancements ==
* OPENTBS_CHANGE_PICTURE now use an array of parameters.
---------------------------------------------------------------------
= Release 1.9.0 =
Released: 2014-04-10
== Bug fixes ==
* Corrupted MS Office files when inserting images named with space or accent.
* XLSX warning for corrupted subfile "/xl/calcChain.xml-Part".
* Some ODS templates compatible with Ms Excel can become erroneous for Ms
Excel after the merge with OpenTBS. Message "The workbook cannot be opened
or repaired by Microsoft Excel because it is corrupt".
* Some XLSX templates built with LibreOffice can be very long to be opened
with OpenTBS. That is because LibreOffice add some extra useless rows
definition at the bottom limit of the sheets.
* A big number merged in a XLSX with parameter "ope=tbs:num" can display
another value. Example : 7580563123 displays -1009371469 in 32bits.
* Inappropriate error message "ExtType is not defined" when execute a
command but no template is loaded.
* OPTBS_SELECT_SHEET with an ODS template do nothing. Now it selects the
main file (contains all sheets).
* OPTBS_SELECT_SLIDE with an ODP template do nothing. Now it selects the
main file (contains all slides).
== New features ==
* new command OPENTBS_SELECT_FILE
* new command OPENTBS_SELECT_HEADER
* new command OPENTBS_SELECT_FOOTER
* new command OPENTBS_GET_HEADERS_FOOTERS
* new command OPENTBS_SEARCH_IN_SLIDES
* new parameter $Master for command OPENTBS_SELECT_SLIDE
and OPENTBS_COUNT_SLIDES
== Enhancements ==
* Debug mode available even if no template is loaded.
* Debug mode display the Zlib availability.
* Based on TbsZip 2.16
---------------------------------------------------------------------
= Release 1.8.3 =
---------------------------------------------------------------------
= Release 1.8.2 =
- Based on TbsZip 2.15
- Supports new parameter "parallel" given with TBS 3.9.0
- Manage RSID problem with ODT (with LibreOffice>=4).
- Bug when merging numerical cells in ODS files built with LibreOffice>=4
it's about new attribute "calcext:value-type" in ODS cells in LibreOffice 4
http://www.tinybutstrong.com/forum.php?thr=3246
- Nouvelle option interne : $TBS->OtbsClearWriter
\ No newline at end of file
{
"name": "tinybutstrong/opentbs",
"description": "With OpenTBS you can merge OpenOffice - LibreOffice and Ms Office documents with PHP using the TinyButStrong template engine. Simple use OpenOffice - LibreOffice or Ms Office to edit your templates : DOCX, XLSX, PPTX, ODT, OSD, ODP and other formats.",
"type": "library",
"keywords": ["templating","docx","xlsx","pptx","odt","ods","odp"],
"homepage": "http://www.tinybutstrong.com/opentbs.php",
"license": "LGPL-3.0-only",
"authors": [
{
"name": "Skrol29",
"email": "skrol29dev@gmail.com"
}
],
"require": {
"php": ">=5.0",
"tinybutstrong/tinybutstrong": ">=3.10.1"
},
"autoload": {
"classmap": ["tbs_plugin_opentbs.php"]
}
}
<?php
/* Build all example files
*/
$template_lst = array(
'demo_ms_excel.xlsx',
'demo_ms_powerpoint.pptx',
'demo_ms_word.docx',
'demo_oo_formula.odf',
'demo_oo_graph.odg',
'demo_oo_presentation.odp',
'demo_oo_spreadsheet.ods',
'demo_oo_text.odt',
);
$output_canevas = file_get_contents('_build_canevas.php');
foreach ($template_lst as $template) {
$info = pathinfo($template);
$insert_type = $info['extension'];
$insert_file = '_build_'.$insert_type.'.php';
if (file_exists($insert_file)) {
$default = false;
} else {
$default = true;
$insert_file = '_build_default.php';
}
$output_file = $info['filename'].'.php';
$output_code = str_replace('%template%', $template, $output_canevas);
$insert_code = file_get_contents($insert_file);
$insert_code = str_replace('<?php', '', $insert_code);
$insert_code = trim($insert_code);
$output_code = str_replace('// %code%', $insert_code, $output_code);
file_put_contents($output_file, $output_code);
echo "\n<br>&bull; Template merged: $template";
if ($default) echo " (default canevas)";
}
\ No newline at end of file
<?php
// Include classes
include_once('tbs_class.php'); // Load the TinyButStrong template engine
include_once('../tbs_plugin_opentbs.php'); // Load the OpenTBS plugin
// prevent from a PHP configuration problem when using mktime() and date()
if (version_compare(PHP_VERSION,'5.1.0')>=0) {
if (ini_get('date.timezone')=='') {
date_default_timezone_set('UTC');
}
}
// Initialize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin
// ------------------------------
// Prepare some data for the demo
// ------------------------------
// Retrieve the user name to display
$yourname = (isset($_POST['yourname'])) ? $_POST['yourname'] : '';
$yourname = trim(''.$yourname);
if ($yourname=='') $yourname = "(no name)";
// A recordset for merging tables
$data = array();
$data[] = array('rank'=> 'A', 'firstname'=>'Sandra' , 'name'=>'Hill' , 'number'=>'1523d', 'score'=>200, 'email_1'=>'sh@tbs.com', 'email_2'=>'sandra@tbs.com', 'email_3'=>'s.hill@tbs.com');
$data[] = array('rank'=> 'A', 'firstname'=>'Roger' , 'name'=>'Smith' , 'number'=>'1234f', 'score'=>800, 'email_1'=>'rs@tbs.com', 'email_2'=>'robert@tbs.com', 'email_3'=>'r.smith@tbs.com' );
$data[] = array('rank'=> 'B', 'firstname'=>'William', 'name'=>'Mac Dowell', 'number'=>'5491y', 'score'=>130, 'email_1'=>'wmc@tbs.com', 'email_2'=>'william@tbs.com', 'email_3'=>'w.m.dowell@tbs.com' );
// Other single data items
$x_num = 3152.456;
$x_pc = 0.2567;
$x_dt = mktime(13,0,0,2,15,2010);
$x_bt = true;
$x_bf = false;
$x_delete = 1;
// -----------------
// Load the template
// -----------------
$template = '%template%';
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8); // Also merge some [onload] automatic fields (depends of the type of document).
// ----------------------
// Debug mode of the demo
// ----------------------
if (isset($_POST['debug']) && ($_POST['debug']=='current')) $TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT, true); // Display the intented XML of the current sub-file, and exit.
if (isset($_POST['debug']) && ($_POST['debug']=='info')) $TBS->Plugin(OPENTBS_DEBUG_INFO, true); // Display information about the document, and exit.
if (isset($_POST['debug']) && ($_POST['debug']=='show')) $TBS->Plugin(OPENTBS_DEBUG_XML_SHOW); // Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// %code%
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = (isset($_POST['save_as']) && (trim($_POST['save_as'])!=='') && ($_SERVER['SERVER_NAME']=='localhost')) ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_'.date('Y-m-d').$save_as.'.', $template);
if ($save_as==='') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
// Be sure that no more output is done, otherwise the download file is corrupted with extra data.
exit();
} else {
// Output the result as a file on the server.
$TBS->Show(OPENTBS_FILE, $output_file_name); // Also merges all [onshow] automatic fields.
// The script can continue.
exit("File [$output_file_name] has been created.");
}
<?php
// Merge data
$TBS->MergeBlock('a,b', $data);
\ No newline at end of file
<?php
// Merge data in the body of the document
$TBS->MergeBlock('a,b', $data);
// Merge data in colmuns
$data = array(
array('date' => '2013-10-13', 'thin' => 156, 'heavy' => 128, 'total' => 284),
array('date' => '2013-10-14', 'thin' => 233, 'heavy' => 25, 'total' => 284),
array('date' => '2013-10-15', 'thin' => 110, 'heavy' => 412, 'total' => 130),
array('date' => '2013-10-16', 'thin' => 258, 'heavy' => 522, 'total' => 258),
);
$TBS->MergeBlock('c', $data);
// Change chart series
$ChartNameOrNum = 'a nice chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 'Series 2';
$NewValues = array( array('Category A','Category B','Category C','Category D'), array(3, 1.1, 4.0, 3.3) );
$NewLegend = "Updated series 2";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);
// Delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);
<?php
// Merge data in a table (there is no need to select the slide with an ODP)
$TBS->MergeBlock('b', $data);
// Hide a slide
$TBS->PlugIn(OPENTBS_DISPLAY_SLIDES, 'slide to hide', false);
// Delete a slide
$TBS->PlugIn(OPENTBS_DELETE_SLIDES, 'slide to delete');
<?php
// Merge data in the Workbook (all sheets)
$TBS->MergeBlock('a,b', $data);
// Merge data in Sheet 2
// No need to change the current sheet, they are all stored in the same XML subfile.
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet (make it visible)
$TBS->PlugIn(OPENTBS_DISPLAY_SHEETS, 'Display me');
\ No newline at end of file
<?php
// Merge data in the body of the document
$TBS->MergeBlock('a,b', $data);
// Change chart series
$ChartNameOrNum = 'a nice chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 'Series 2';
$NewValues = array( array('Category A','Category B','Category C','Category D'), array(3, 1.1, 4.0, 3.3) );
$NewLegend = "Updated series 2";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);
// Delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);
\ No newline at end of file
<?php
// Select slide #2
$TBS->Plugin(OPENTBS_SELECT_SLIDE, 2);
// Change a picture using the command (it can also be done at the template side using parameter "ope=changepic")
$TBS->Plugin(OPENTBS_CHANGE_PICTURE, '#merge_me#', 'pic_1234f.png', array('unique' => 1));
// Merge a chart
$ChartRef = 'my_chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 1;
$NewValues = array( array('Cat. A','Cat. B','Cat. C','Cat. D'), array(0.7, 1.0, 3.2, 4.8) );
$NewLegend = "Merged";
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
<?php
// Merge data in the first sheet
$TBS->MergeBlock('a,b', $data);
// Merge cells (extending columns)
$TBS->MergeBlock('cell1,cell2', $data);
// Change the current sheet
$TBS->PlugIn(OPENTBS_SELECT_SHEET, 2);
// Merge data in Sheet 2
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Merge pictures of the current sheet
$x_picture = 'pic_1523d.gif';
$TBS->PlugIn(OPENTBS_MERGE_SPECIAL_ITEMS);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet (make it visible)
$TBS->PlugIn(OPENTBS_DISPLAY_SHEETS, 'Display me');
\ No newline at end of file
<!DOCTYPE HTML><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Fix ODF files of the OpenTBS package</title>
</head><body>
<?php
/* Fix ODF files of the OpenTBS package.
2011-03-26: un internaute me fait ermarque que le fichier modèle ODT n'est pas valide selon les outils ODF validators
http://tools.services.openoffice.org/odfvalidator/
Cela vient du fait que certaines version d'OpenOffice ne respecte les standard strcits d'ODf et aussi est buggé par d'autre moments.
Ce script corrige les problèmes connus afin que els fichiers passent positivement le test du validateur.
*/
if (file_exists('tbszip.php')) {
include_once('tbszip.php');
} else {
include_once('../tbs_plugin_opentbs.php');
}
$file_lst = array(
'demo_oo_text.odt'
, 'demo_oo_formula.odf'
, 'demo_oo_graph.odg'
//, 'demo_oo_master.odm'
, 'demo_oo_presentation.odp'
, 'demo_oo_spreadsheet.ods'
);
$version = '1.2'; // valeur par défaut à mettre dans le manifest
$manifest = 'META-INF/manifest.xml';
$styles = 'styles.xml';
$odf = new clsTbsZip();
foreach ($file_lst as $file) {
$odf->Open($file);
echo "<h4>Étude du fichier '$file'.</h4>\r\n";
$extension = strtolower(substr($file, -4));
if (!$odf->FileExists($manifest)) {
echo "Le fichier manifest n'a pas été trouvé.<br>\r\n";
continue;
}
/* debug
if (file_exists('manifest.xml')) {
$odf->FileReplace($manifest, 'manifest.xml', TBSZIP_FILE);
$temp = $file.'.tmp.odt';
$odf->Flush(TBSZIP_FILE, $temp);
echo "Fichier fanifest remplacé par le fichier 'manifest.xml' trouvé dans le répertoire.<br>\r\n";
exit;
}
*/
$txt = $odf->FileRead($manifest);
// des fois la version figure dans un élément <manifest:file-entry>, lé cas échéant, on va chercher la bonne version du manifeste.
$att = ' manifest:version="';
$p = strpos($txt, $att);
if ($p!==false) {
$p = $p + strlen($att);
$p2 = strpos($txt, '"', $p);
$version = substr($txt, $p, $p2 - $p);
echo "La version du manifest a été trouvée : ".$version."<br>\r\n";
} else {
echo "La version du manifest est absente.<br>\r\n";
}
$replace_manifest = 0;
if (($extension=='.zzz')){
echo "Pas de retouche de la version du manifest car c'est un fichier ODG.<br>\r\n"; // osbolète
} else {
// recherche de la version dans l'élément <manifest:manifest>
$p = strpos($txt, '<manifest:manifest ');
if ($p!==false) {
$p2 = strpos($txt, '>', $p);
if ($p2!==false) {
$elem = substr($txt, $p, $p2 - $p + 1);
if (strpos($elem, $att)===false) {
// on ajoute la version du manifest
$txt = substr_replace($txt, $att.$version.'"', $p2, 0);
$replace_manifest++;
echo "Le version du manifest a été ajouté à l'élément <b>manifest:manifest</b> avec la valeur ".$version."<br>\r\n";
} else {
echo "Le version du manifest est déjà présente dans l'élément <i>manifest:manifest</i><br>\r\n";
}
}
}
}
// recherche ds déclaration de répertoire : il faut les retirer
$elem = '<manifest:file-entry manifest:media-type="" manifest:full-path="';
$p = 0;
while (($p=strpos($txt, $elem, $p))!==false) {
$pe = $p + strlen($elem);
$pc = strpos($txt, '"', $pe);
if (substr($txt, $pc-1, 1)==='/') {
// c'est un répertoire vide, il faut le supprimer
$pe = strpos($txt, '>', $pc);
if (substr($txt, $p-1,1)===' ') $p--;
if (substr($txt, $p-1,1)==="\n") $p--;
// $x = substr($txt, $p, $pe - $p +1);
$txt = substr_replace($txt, '', $p, $pe - $p +1);
$replace_manifest++;
} else {
// item suivant
$p = $pc;
}
}
if ($replace_manifest>0) {
$odf->FileReplace($manifest, $txt, TBSZIP_STRING); // si on ne compresse pas ça fait un bug !! à vérifier pourquoi
echo "<span style='color:red;'>$replace_manifest modifications ont été apportées au fichier manifest</span><br>\r\n";
}
// recherche du bug dans le fichier style
$replace_style = 0;
if ($odf->FileExists($styles)) {
$txt = $odf->FileRead($styles);
$item = ' fo:font-size="0pt"';
if (strpos($txt, $item)!==false) {
$item2 = str_replace('"0pt"', '"14pt"', $item);
$txt = str_replace($item, $item2, $txt);
$odf->FileReplace($styles, $txt, TBSZIP_STRING); // si on ne compresse pas ça fait un bug !! à vérifier pourquoi
echo "<span style='color:red;'>une modification a été apportée au fichier styles</span><br>\r\n";
$replace_style++;
}
}
if (($replace_manifest+$replace_style)>0) {
$temp = $file.'.tmp';
$odf->Flush(TBSZIP_FILE, $temp);
$odf->OutputClose(); // à ajouter car bug si TbsZip <= 2.3
$odf->Close();
unlink($file);
rename($temp, $file);
} else {
echo "<span style='color:green;'>L'archive n'a pas été modifiée.</span><br>\r\n";
}
}
//echo $txt;
vendor/tinybutstrong/opentbs/demo/_pic_door.png

15.5 KiB

vendor/tinybutstrong/opentbs/demo/_pic_king.png

12.8 KiB

vendor/tinybutstrong/opentbs/demo/_pic_man.png

9.5 KiB

vendor/tinybutstrong/opentbs/demo/_pic_woman.png

11.1 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OpenTBS Demo</title>
<script language="javascript">
// redirection if open without the menu at the TBS site
if ( (document.location.href.indexOf('www.tinybutstrong.com') > 0)
&& (document.location.href.indexOf('demo.html') > 0)
) {
document.location.href = "/opentbs.php?demo";
}
</script>
<script type="text/javascript">
function download_template() {
var file = document.forms['form1'].elements['tpl'].value;
var rep = document.forms['form1'].action;
var p = rep.lastIndexOf('/');
if (p>=0) {
file = rep.substr(0, p+1) + file
}
window.location.href = file;
}
</script>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
}
.title1 {
font-size: 16px;
font-weight: bold;
}
-->
</style></head>
<body>
<!-- main-body is used for insertion in the TBS menu -->
<div id="main-body">
<p align="center"><span class="title1">OpenTBS</span> <span class="title1">demo</span><br />
OpenTBS is a PHP tool that produces any OpenOffice and Ms Office documents with the technic of template<br />
<br />
</p>
<h2>Presentation</h2>
<p>OpenTBS can merge any OpenDocument and Open XML files. It autommatically reconize extensions: <strong>odt</strong>, <strong>ods</strong>, <strong>odg</strong>, <strong>odf</strong>, <strong>odm</strong>, <strong>odp</strong>, <strong>ott</strong>, <strong>ots</strong>, <strong>otg</strong>, <strong>otp</strong>, <strong>docx</strong>, <strong>xlsx, xlsm</strong>, <strong>pptx</strong>.</p>
<p> In fact it can merge any XML or Text file saved in a zip container (which is the case for both OpenDocuments and OpenXML documents).</p>
<p><span id="result_box" lang="en" xml:lang="en">In addition to the usual merging operations, m</span>any other oprerations can be done on documents, such as: feed a table, delete or display paragraphs, change pictures, delete sheets, change data in graphs, ... and much more.</p>
<h2>Characteristics</h2>
<ul>
<li> No temporary files needed.</li>
<li> Creates a new document directly as a download, a physical file, or a binary PHP string.</li>
<li> Works with both PHP 4 and PHP 5.</li>
<li> No PHP extension required (but easier to use if <a href="http://www.php.net/manual/en/book.zlib.php">ZLib</a> is enabled)</li>
</ul>
<h2>Demo</h2>
<form id="form1" method="post" action="./demo_merge.php">
<table border="0" cellspacing="4" cellpadding="0">
<tr>
<td scope="col">Enter a name :</td>
<td scope="col"><input name="yourname" type="text" size="10" /> <i>(will be displayed in the merged result)</i></td>
</tr>
<tr>
<td>Choose a template :</td>
<td><select name="tpl">
<option value="demo_oo_text.odt">OpenOffice Writer Document (.odt)</option>
<option value="demo_oo_spreadsheet.ods">OpenOffice Calc Spreadsheet (.ods)</option>
<option value="demo_oo_presentation.odp">OpenOffice Impress Presentation (.odp)</option>
<option value="demo_oo_graph.odg">OpenOffice Draw Graphic (.odg)</option>
<option value="demo_oo_formula.odf">OpenOffice Math Formula (.odf)</option>
<option value="demo_ms_word.docx">Ms Word Document (.docx)</option>
<option value="demo_ms_excel.xlsx">Ms Excel SpreadSheet (.xlsx)</option>
<option value="demo_ms_powerpoint.pptx">Ms PowerPoint Presentation (.pptx)</option>
</select></td>
</tr>
<tr>
<td>Debug :</td>
<td><select name="debug">
<option value="" selected="selected">No</option>
<option value="info">General Information</option>
<option value="current">During merge</option>
<option value="show">After merge</option>
</select></td>
</tr>
<tr id="save_as_file" style="display:none;">
<td>Save locally with suffix :</td>
<td><input name="save_as" type="text" size="10" /> <i>(leave empty for direct download)</i></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" name="btn_result" value="Merge" />
<input type="submit" name="btn_template" value="See template" />
<input type="submit" name="btn_script" value="See PHP script" />
</td>
</tr>
</table>
</form>
<h2>More</h2>
<ul>
<li> OpenTBS help file : <a href="http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html">tbs_plugin_opentbs.html</a></li>
<li> Discover the <a href="http://www.tinybutstrong.com">TinyButStrong</a> template engine for PHP</li>
<li> Go to <a href="http://www.tinybutstrong.com/plugins.php">OpenTBS download</a> page </li>
</ul>
</body>
<script type="text/javascript">
// enable the option for savegin as a file, the PHP script will test if it is running on localhost anyway.
if (window.location.hostname=='localhost') document.getElementById('save_as_file').style.display='table-row';
</script>
</div>
</html>
<?php
// Display the asked source file.
function f_source($file) {
echo '<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>OpenTBS plug-in for TinyButStrong - demo source</title></head><body>'.highlight_file($file,true).'</body></html>';
}
// Retrieve the template to open
$template = (isset($_POST['tpl'])) ? $_POST['tpl'] : '';
$template = basename($template); // for security
$info= pathinfo($template);
$script = $info['filename'].'.php';
// Checks
if (substr($template,0,5)!=='demo_') exit("Wrong file.");
if (!file_exists($template)) exit("The asked template does not exist.");
if (isset($_POST['btn_template'])) {
header('Location: '.$template);
exit;
}
if (isset($_POST['btn_script'])) {
f_source($script);
exit;
}
// Start the demo
if (isset($_POST['btn_result'])) {
include($script);
exit;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment