silverslice / excel-template
Replace variables in xlsx document
Installs: 3 331
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
- ext-zip: *
Requires (Dev)
- phpunit/phpunit: ~4.4
This package is auto-updated.
Last update: 2024-11-15 18:53:40 UTC
README
Why
If you try to create a simple template in PHPExcel, insert some data and save it as a new file, you will see that conditional formatting is missing. PHPExcel is not a library for editing workbook files: you're not using PHPExcel to change only one string in a file and save it in the same state.
Install
composer require silverslice/excel-template
Usage
Place variables in your xlsx-document as {foo}. Then replace them with replace
method.
use Silverslice\ExcelTemplate\Template; require __DIR__ . '/vendor/autoload.php'; $template = new Template(); // open file $template->open('test.xlsx') // replace one variable to another ->replace('one', 'two') // replace once more ->replace('foo', 'bar') // save document ->save('test.xlsx');