2017 © Pedro Peláez
 

library htmlphpexcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

image

ticketpark/htmlphpexcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  • Friday, November 24, 2017
  • by ticketpark
  • Repository
  • 4 Watchers
  • 43 Stars
  • 27,391 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 4 Open issues
  • 10 Versions
  • 10 % Grown

The README.md

HtmlPhpExcel

Build Status, (*1)

This is a php library based on FastExcelWriter, simplifying converting html tables to excel files. It allows styling right within the html template with specific attributes., (*2)

Installation

Add HtmlPhpExcel to your composer.json:, (*3)

composer require ticketpark/htmlphpexcel

Simple example

<?php

require_once('vendor/autoload.php');

$html = '

Column A Column B
Value A Value B
'; $htmlPhpExcel = new \Ticketpark\HtmlPhpExcel\HtmlPhpExcel($html); $htmlPhpExcel->process()->save('myFile.xlsx');

For a more complex example see example directory., (*4)

Styling

Styles are set with an html attribute _excel-styles. The attribute expects the content to be in json format., (*5)

Example:, (*6)

<table>
    <tr _excel-styles='{"height": 50}'>
        <td _excel-styles='{"font-size": 16, "font-color": "#FF0000", "width": 200}'>
            Cell value
        </td>
    </tr>
</table>

You can use any style supported by fast-excel-writer, of which the most common are:, (*7)

  • border-color
  • border-style
  • fill-color
  • fill-pattern
  • font-color
  • font-size
  • format
  • format-text-wrap
  • height
  • hyperlink
  • text-align
  • text-color
  • text-rotation
  • text-wrap
  • vertical-align
  • width

More information (though unfortunately limited) is available in the docs of FastExcelWriter., (*8)

Links are treated like styles and added with the hyperlink key:, (*9)

Example:, (*10)

<table>
    <tr>
        <td _excel-styles='{"hyperlink": "http://www.google.com"}'>
            Cell value
        </td>
    </tr>
</table>

Adding comments to cells

To add comments, use the _excel-comment attribute., (*11)

Example:, (*12)

<table>
    <tr >
        <td _excel-comment="This is a comment.">
            Cell value
        </td>
    </tr>
</table>

History

  • v2.x of this library is based on FastExcelWriter
  • v1.x of this library was based on PhpSpreadsheet
  • v0.x of this library was based on PhpExcel

The Versions

24/11 2017

dev-master

9999999-dev https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

09/03 2017

0.4.1

0.4.1.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

23/06 2016

0.4

0.4.0.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

25/06 2015

0.3.2

0.3.2.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

04/04 2014

0.3.1

0.3.1.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

31/03 2014

0.3

0.3.0.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

28/03 2014

0.2.2

0.2.2.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

28/03 2014

0.2.1

0.2.1.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

28/03 2014

0.2

0.2.0.0 https://github.com/Ticketpark/HtmlPhpExcel

A php library based on PHPExcel to convert html tables to Excel files, including styling.

  Sources   Download

MIT

The Requires

 

excel html phpexcel tables

26/03 2014

0.1

0.1.0.0

xxx

  Sources   Download

MIT

The Requires

 

excel html phpexcel