2017 © Pedro Peláez
 

libary super-simple-excel

Package for creating a simple Excel file from arrays

image

dmoen/super-simple-excel

Package for creating a simple Excel file from arrays

  • Tuesday, October 3, 2017
  • by dmoen
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Super simple excel

Simple package for creating an Excel file from arrays, traversable objects or Eloquent Collections when you dont need advanced configuration on cell level., (*1)

Installation

This package can be installed via Composer:, (*2)

``` bash composer require dmoen/super-simple-excel, (*3)


## Usage Basic example ```php $writer = ExcelWriter::create() ->setHeadings(["Lorem", "Ipsum", "Sit", "Amet"]); $writer->addContent(["Row1", "Row1", "Row1", "Row1"]); $writer->addContent(["Row2", "Row2", "Row2", "Row2"]) ->save("filepath");

Also work with Eloquent Collections, (*4)

$writer = ExcelWriter::create()
    ->setHeadings(["Lorem", "Ipsum", "Sit", "Amet"]);
    ->addContent(App\User::all())
    ->save("filepath");    

If you want to output the file to the browser:, (*5)

$writer = ExcelWriter::create()
    ->setHeadings(["Lorem", "Ipsum", "Sit", "Amet"]);

$writer->addContent(["Row1", "Row1", "Row1", "Row1"]); 

$writer->addContent(["Row2", "Row2", "Row2", "Row2"])
    ->output("filename");    

Multi dimensional array, (*6)

ExcelWriter::create()
    ->setHeadings(["Lorem", "Ipsum", "Sit", "Amet"]);
    ->addContent([
        ["Row1", "Row1", "Row1", "Row1"],
        ["Row2", "Row2", "Row2", "Row2"]
    ])
    ->save("filepath");

Default styles can be set for font weight, font size, font type and alignment, (*7)

ExcelWriter::create(["bold" => true, "font" => "Arial", "size" => 20, "align" => "center"]);    

Styles can also be set for headings or specific row(s), (*8)

$writer = ExcelWriter::create();

$writer->setHeadings(
    ["Lorem", "Ipsum", "Sit", "Amet"],
    [
        "align" => "right",
        "bold"  => false,
        "size" => 15,
        "font" => "Arial"
    ]);

$writer->addContent(
    [
        ["Dolore", "Ipsum", "Amet", "Sit"],
        ["Dolore", "Ipsum", "Amet", "Sit"]
    ],
    [
        "align" => "right",
        "bold"  => false,
        "size" => 15,
        "font" => "Arial"
    ]
);

Sometimes you want some row spaces between the headings and the content rows:, (*9)

$writer = ExcelWriter::create();

$writer->setHeadings(
    ["Lorem", "Ipsum", "Sit", "Amet"], [], 1);

The Versions

03/10 2017

dev-dev

dev-dev

Package for creating a simple Excel file from arrays

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Moen

03/10 2017

dev-master

9999999-dev

Package for creating a simple Excel file from arrays

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Moen

03/10 2017

v1.0.2

1.0.2.0

Package for creating a simple Excel file from arrays

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Moen

02/10 2017

v1.0.1

1.0.1.0

Package for creating a simple Excel file from arrays

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Moen

02/10 2017

v1.0.0

1.0.0.0

Package for creating a simple Excel file from arrays

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Moen