| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Add following lines to composer.json
{
"type": "git",
"url": "git@github.com:Tactics/ExcelBundle"
}
"tactics/excel-bundle": "1.0.*"
Getting the excelbuilder service is as easy as:
$builder = $this->get('tactics.excel_writer');
Write an array of values to an excel file
//Make array with some kind of values
$collection = array("First value to write", "Second value to write", ...);
//Offers the excel with values as a file download with filename = awesomeness.xlsx
$builder->getDownloadFromCollection($collection, array(
'filename' => 'awesomeness'
));
Write a collection of objects to an excel file
//get a collection of objects
$collection = $this->getDoctrine()->getManager()->getRepository('SomeBundle:SomeEntity')->findAll();
//Offers the excel with values as a file download with filename = awesomeness.xlsx
$builder->getDownloadFromCollection($collection, array(
'filename' => 'awesomeness',
));
In stead of writing to an empty excel file you can create a template excel file and write to this file.
//$builder = valid ReportExcelWriter.
$excel = $builder->getExcelFromFile('my_templates_file_name', kernel_service);
$builder->writeToSheet($excel->getActiveSheet();
You can extend the default ReportBuilder to add/overwrite (extra) functionality.
class myFunkyBuilderClass extends Tactics\Bundle\ExcelBundle\Writer\ReportExcelWriter { ...
Existing functionality
p.e. class myWriteHelper extends Tactics\Bundle\ExcelBundle\Helpers\WriteHelper {
/**
* {@inheritdoc}
*/
public function write(\PHPExcel_Worksheet $sheet, $value) {
...
}
}
//getting the reportwriter with myHelperWriter see todo why this isn't documented yet
AvailableHelpers
| Back | FazBrowse Home | New Git URL |