Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markocupic/phpoffice-bundle
Contao
https://github.com/markocupic/phpoffice-bundle
helper phpoffice phpword processor template
Last synced: 21 days ago
JSON representation
Contao
- Host: GitHub
- URL: https://github.com/markocupic/phpoffice-bundle
- Owner: markocupic
- License: mit
- Created: 2019-06-09T14:19:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-20T21:14:25.000Z (12 months ago)
- Last Synced: 2024-12-12T18:51:50.695Z (27 days ago)
- Topics: helper, phpoffice, phpword, processor, template
- Language: PHP
- Homepage:
- Size: 1.62 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPOffice Bundle
## MsWordTemplateProcessor
#### Generate easily Microsoft Word documents:Watch the [demo template](https://github.com/markocupic/phpfoffice-bundle/blob/master/docs/example/templates/ms_word_template.docx)
and the [result](https://github.com/markocupic/phpfoffice-bundle/blob/master/docs/example/results/msword_result.docx)```php
false,
// 'limit' => -1
//);// Simple replacement
$objPhpWord->replace('category', 'Elite men');// Another multiline replacement
$options = array('multiline' => true);
$objPhpWord->replace('sometext', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt', $options);// Bold text
$objPhpWord->replace('sometext', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt', $options);// Image replacement
$objPhpWord->replaceWithImage('my-best-image', 'vendor/markocupic/phpoffice-bundle/src/example/assets/my-best-image.jpg', array('width' => '160mm'));// Clone rows
// Push first datarecord to cloned row
$objPhpWord->createClone('rank');
$objPhpWord->addToClone('rank', 'rank', '1', array('multiline' => false));
$objPhpWord->addToClone('rank', 'number', '501', array('multiline' => false));
$objPhpWord->addToClone('rank', 'firstname', 'James', array('multiline' => false));
$objPhpWord->addToClone('rank', 'lastname', 'First', array('multiline' => false));
$objPhpWord->addToClone('rank', 'time', '01:23:55', array('multiline' => false));
// Add an image with a predefined height
$objPhpWord->addToClone('rank', 'avatar', 'vendor/markocupic/phpoffice-bundle/src/example/assets/avatar_1.png', array('type' => 'image', 'height' => '30mm'));// Push second datarecord to cloned row
$objPhpWord->createClone('rank');
$objPhpWord->addToClone('rank', 'rank', '2', array('multiline' => false));
$objPhpWord->addToClone('rank', 'number', '503', array('multiline' => false));
$objPhpWord->addToClone('rank', 'firstname', 'James', array('multiline' => false));
$objPhpWord->addToClone('rank', 'lastname', 'Last', array('multiline' => false));
$objPhpWord->addToClone('rank', 'time', '01:25:55', array('multiline' => false));
// Add an image with a predefined width
$objPhpWord->addToClone('rank', 'avatar', 'vendor/markocupic/phpoffice-bundle/src/example/assets/avatar_2.png', array('type' => 'image', 'width' => '28.3mm'));// Push third datarecord, etc...
//$objPhpWord->createClone('rank');
// .... etc.// Create
$objPhpWord->generate();```