Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duncan3dc/phpexcel
A simple wrapper around the phpexcel library
https://github.com/duncan3dc/phpexcel
Last synced: 4 days ago
JSON representation
A simple wrapper around the phpexcel library
- Host: GitHub
- URL: https://github.com/duncan3dc/phpexcel
- Owner: duncan3dc
- License: apache-2.0
- Created: 2014-06-03T19:52:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-17T09:23:36.000Z (about 7 years ago)
- Last Synced: 2024-11-01T12:04:29.170Z (12 days ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
phpexcel
========A simple wrapper around the PHPExcel library
[![Latest Stable Version](https://poser.pugx.org/duncan3dc/phpexcel/version.svg)](https://packagist.org/packages/duncan3dc/phpexcel)
[![Build Status](https://travis-ci.org/duncan3dc/phpexcel.svg?branch=master)](https://travis-ci.org/duncan3dc/phpexcel)
[![Coverage Status](https://coveralls.io/repos/github/duncan3dc/phpexcel/badge.svg)](https://coveralls.io/github/duncan3dc/phpexcel)Static Methods
--------------
* read(string $filename[, mixed $key]): array - Reads a spreadsheet and converts it's contents to an array (using the PHPExcel toString() method).
By default this will return an enumerated array with each element representing one sheet.
A specific sheet can be requested by passing the $key argument, either as an integer representing the (zero based) sheet number, or as a string of the sheet name.
* getCellName(int $col, int $row): string - Convert a numeric column number (zero based) and row number into a cell name (eg B3)Public Methods
--------------
* save(string $filename): null - Calls the save() method on the PHPExcel_Writer_Excel2007 class.
* output(string $filename): null - Outputs the spreadsheet to the browser to prompt a download.
* addImage(string $cell, string $path): null - Add an image to the specified cell.
* setCell(string $cell, mixed $value[, int $style]): null - Set a cell to a value.
The $style parameter can be used to set several styles on the cell, using the following class constants:
BOLD
ITALIC
LEFT
RIGHT
CENTERExamples
--------The Excel class uses a namespace of duncan3dc
```php
use duncan3dc\Excel;
```-------------------
```php
$excel = new Excel();$excel->setCell("A1","Title", Excel::BOLD | EXCEL::CENTER);
for($i = 1; $i < 10; $i++) {
$cell = $excel->getCellName($i,1);
$excel->setCell($cell,"Test " . $i);
}for($i = 1; $i < 10; $i++) {
$cell = Excel::getCellName($i,2);
$excel->setCell($cell,"Value " . $i);
}$excel->save("/tmp/text.xls");
```