export/excel-bundle

使用PHPExcel库在Symfony 2中实现轻松导出Excel的服务

dev-master 2013-06-26 12:14 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:35:28 UTC


README

此库已弃用。我建议您使用这个新的库来轻松构建表格和处理PHPExcel: https://github.com/Wisembly/ExcelAnt

ExcelBundle

使用PHPExcel库轻松实现Excel导出的服务

安装

步骤1. (对于Symfony v. < 2.1 - 依赖项)

在您的deps文件中添加以下行

[ExcelBundle]
    git=http://github.com/rgazelot/ExcelBundle.git
    target=/bundles/Export/ExcelBundle

现在通过运行以下命令下载此包

./bin/vendors update

Symfony将您的包安装到vendors/bundles/Exports

autoload.php中声明

# app/autoload.php

$loader->registerNamespaces(array(
    ...
    'Export' => __DIR__.'/../vendor/bundles',
));

步骤1. (对于Symfony v. >= 2.1 - 使用Composer)

即将推出...

步骤2. 启用您的包

在kernel中启用包

# app/AppKernel.php

$bundles = array(
    ...
    new Export\ExcelBundle\ExportExcelBundle(),
);

步骤3. 注册PHPExcel并设置前缀

由于PHPExcel库不使用命名空间,请在autoload.php中创建前缀。

# app/autoload.php

$loader->registerPrefixes(array(
    ...
    'PHPExcel' => __DIR__.'/../vendor/bundles/Export/ExcelBundle/Library/phpExcel/Classes',
));

步骤4. 配置您的包

在您的配置文件中

# app/config/config.yml

export_excel: ~

完成!

恭喜!您已成功安装ExportBundle。请阅读使用文档了解如何使用此服务。