定制 wakeasp-inc/opentbs-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wakeasp-inc/opentbs-bundle

最新稳定版本:v3.13.1

Composer 安装命令:

composer require wakeasp-inc/opentbs-bundle

包简介

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

README 文档

README

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

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

Introduction

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

OpenTBS is a PHP tool to produce any OpenOffice and Ms Office documents with templates.

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).

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.

Versions included

TinyButStrong - 3.12.2

OpenTBS - 1.10.2

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

> composer require mbence/opentbs-bundle

Composer will install the bundle to your project's vendor/mbence/opentbs-bundle directory.

Step 2: Enable the bundle in your AppKernel

<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Wakeasp\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).

... 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.

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

 // 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.

For more information ...

read the TBS manual at http://www.tinybutstrong.com/manual.php

and the OpenTBS plugin documentation at http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html

统计信息

  • 总下载量: 7.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固