forked from PHPOffice/PHPWord
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A quick hack solution I came up with today. This isn't pretty in the slightest and is my first pull request so apologise if I've done it wrong. I normally work on BitBucket. Example Usage ------------------ $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('C:\Users\Robert\Desktop\sample.docx'); $templateProcessor->cloneRow('rowValue', 10); $templateProcessor->setValue('test#1', htmlspecialchars('Text goes here')); $templateProcessor->setImageValue('testPhoto#1', 'image3.png', 'my-other-image.jpg'); $templateProcessor->setValue('test#2', htmlspecialchars('Text2 goes here')); $templateProcessor->setImageValue('testPhoto#2', 'image4.png', my-image.jpg');
- Loading branch information
Showing
2 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ca52b09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't work. I get corrupt docx and cannot open.
ca52b09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OAFCROB Can you please add the code you used in the template.docx
ca52b09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues I've had with a corrupt document have been related to word spell checking the words. If you rename the file to a .zip then look at the components see if your tags are still intact, this is a massive problem with PHP Word that I've found.