2017 © Pedro Peláez
 

symfony-bundle opentbs-bundle

OpenTBS Bundle for Symfony - create OpenOffice and Ms Office documents with Symfony

image

mbence/opentbs-bundle

OpenTBS Bundle for Symfony - create OpenOffice and Ms Office documents with Symfony

  • Tuesday, September 27, 2016
  • by mbence
  • Repository
  • 3 Watchers
  • 21 Stars
  • 44,523 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 3 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

OpenTBSBundle for Symfony

This bundle is just a convenient way to use OpenTBS, all the credits go to Skrol29 and the TinyButStrong team. http://www.tinybutstrong.com/, (*1)

OpenTBS - create OpenOffice and Ms Office documents with PHP (and Symfony), (*2)

Introduction

(Taken from http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html), (*3)

OpenTBS is a PHP tool to produce any OpenOffice and Ms Office documents with templates., (*4)

OpenTBS can merge any OpenDocument and Open XML files. It autommatically reconize extensions: odt, ods, odg, odf, odm, odp, ott, ots, otg, otp, docx, xlsx, pptx. 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)., (*5)

What is special to OpenTBS: * Design your templates directly with OpenOffice or MS Office. * No exe file needed to merge documents. * No temporary files needed to merge documents. * Output directly as an http download, a new file on the disk, or as a string (for file attachment for example). * Works with both PHP 4 and PHP 5., (*6)

Versions included

TinyButStrong - 3.10.1, (*7)

OpenTBS - 1.9.7, (*8)

Requirements

  • Symfony2
  • PHP needs to be a minimum version of PHP 5.3.2 (for Symfony2)
  • It is better to have the Zlib extension enabled on your PHP installation. If it's not, here is what to do.

Installation

Setp 0: Install Composer

Step 1: Download the bundle using composer

``` bash, (*9)

composer require mbence/opentbs-bundle, (*10)


Composer will install the bundle to your project's `vendor/mbence/opentbs-bundle` directory. ### Step 2: Enable the bundle in your AppKernel ```php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new MBence\OpenTBSBundle\OpenTBSBundle(), ); }

Now you can use the 'opentbs' service.

Using OpenTBSBundle

First you need to define the variables in your docx template (you can use any other supported document format)., (*11)

... some text in a word file with a `[client.name]` variable ...

In TBS you always need a variable base client and a variable name name., (*12)

Then in your controller you need to get the OpenTBS service, load your template and merge the fields (eg. replace the teplate variables)., (*13)

    // get the service
    $TBS = $this->get('opentbs');
    // load your template
    $TBS->LoadTemplate('template.docx');
    // replace variables
    $TBS->MergeField('client', array('name' => 'Ford Prefect'));
    // send the file
    $TBS->Show(OPENTBS_DOWNLOAD, 'file_name.docx');

A note for onshow automatic variables: You could define your variables within the onshow base, (like onshow.name), but I would not recommend this practice for it will only work if you use GLOBAL variables., (*14)

For more information ...

read the TBS manual at http://www.tinybutstrong.com/manual.php, (*15)

and the OpenTBS plugin documentation at http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html, (*16)

The Versions

27/09 2016

dev-master

9999999-dev https://github.com/mbence/OpenTBSBundle

OpenTBS Bundle for Symfony - create OpenOffice and Ms Office documents with Symfony

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

symfony xlsx opentbs openoffice odt document docx pptx tbs ms office

13/09 2016

v1.9.7

1.9.7.0 https://github.com/mbence/OpenTBSBundle

OpenTBS Bundle for Symfony - create OpenOffice and Ms Office documents with Symfony

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

symfony xlsx opentbs openoffice odt document docx pptx tbs ms office