Giter Club home page Giter Club logo

excelant's Introduction

       |     |
        \   /
         \_/
    __   /^\   __
   '  `. \_/ ,'  `
        \/ \/
   _,--./| |\.--._
_,'   _.-\_/-._   `._
     |   / \   |
     |  /   \  |
    /   |   |   \
  -'    \___/    `-

#ExcelAnt

Build Status

ExcelAnt is an Excel manipulation library for PHP 5.4. It currently works on top of PHPExcel. If you want to add / use another library, feel free to fork and contribute !

#Version

1.0.0

#Installation

  1. Install composer : curl -s http://getcomposer.org/installer | php (more info at getcomposer.org)
  2. Create a composer.json file in your project root : (or add only the excelant line in your existing composer file)
  {
    "require": {
      "wisembly/excelant": "*",
    }
  }
  1. Install via composer : php composer.phar install

#Use ExcelAnt

Create a simple Table :

use ExcelAnt\Adapter\PhpExcel\Workbook\Workbook,
    ExcelAnt\Adapter\PhpExcel\Sheet\Sheet,
    ExcelAnt\Adapter\PhpExcel\Writer\Writer,
    ExcelAnt\Table\Table,
    ExcelAnt\Coordinate\Coordinate;

Class Export
{
    public function createExport(array $users)
    {
        $workbook = new Workbook();
        $sheet = new Sheet($workbook);
        $table = new Table();

        foreach ($users as $user) {
            $table->setRow([
                $user->getName(),
                $user->getEmail(),
            ]);
        }

        $sheet->addTable($table, new Coordinate(1, 1));
        $workbook->addSheet($sheet);
    }
}

Now, to export your Workbook, you need to create a Writer :

use ExcelAnt\Adapter\PhpExcel\Writer\WriterFactory,
    ExcelAnt\Adapter\PhpExcel\Writer\PhpExcelWriter\Excel5;

$writer = (new WriterFactory())->createWriter(new Excel5('/path/to/myExport.xls'));

Convert your Worbook to create a PHPExcel object and export it :

$phpExcel = $writer->convert($workbook);
$writer->write($phpExcel);

Simple table

#Documentation

Coming soon...

#Contributing

ExcelAnt is an open source project. If you would like to contribute, fork the repository and submit a pull request.

#Running ExcelAnt Tests

excelant's People

Contributors

garak avatar guillaumepotier avatar luebbert42 avatar mmross avatar rgazelot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

excelant's Issues

How to deserialize a Table Object?

I am trying to deserialize a Table object and I do not get how to do it.
Is this right?
$exceltable=$serializer->deserialize( $table , 'ExcelAnt\Table\Table' ,'json');
I get the following error:

You must define a type for ExcelAnt\Table\Table::$table

How can I define this type?

Tags? Releases?

This bundle looks very promising and I'll definitely give it a try, but what worries me is that there are no tags or roadmap where I could find info on when a stable release will be ready? Or is dev-master already stable?

Any way to set autoSize with ExcelAnt?

In PHPExcel, I can use:

      $sheet->getColumnDimension($cell->getColumn())->setAutoSize(true);

Is it possible to set autoSize with ExcelAnt instead of doing it with PHPExcel after the conversion?

Any working example ?

Hello everyone,

Does anyone has a working example with this bundle ? I'm trying to save an Excel file but file is empty. I'm following basic example given but it seems that something is missing in the end to save the data generated into the Excel file. I'm not trying something crazy, just repeat the exemple.

    $path = __DIR__.'/../../../../web/uploads/temp';
    $file = 'myfile.xls'
    $workbook = new Workbook();
    $sheet = new Sheet($workbook);
    $table = new Table();

    $table->setRow(['eee', 'aaa']);

    $sheet->addTable($table, new Coordinate(1, 1));
    $workbook->addSheet($sheet);

    $writer = (new WriterFactory())->createWriter(new Excel5($path.$title));

    $phpExcel = $writer->convert($workbook);

    $writer->write($phpExcel);

Could anyone help ?

Reader

Is there a plan to write a Reader for this bundle?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.