-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setComplexBlock or setComplexValue remove placeholder other than the searched one #2300
Comments
Hi, did you find a solution to that problem? I'm trying to make several tables that way as well |
Unfortunately no. For the time being, I decide to just use HTML instead |
First, setComplexBlock replace 1 block at a time, taking everything that is inside the paragraph that is surrounding the block macro. And as you set '${place'.$i.'}' using setValue, you try to put them all in a text run, that is to say they are all in the same paragraph.... |
I succeed adding HTML content using TemplateProcessor, like this $section = (new PhpWord())->addSection(); And add a trick in complex Block, replacing $elementName = substr(get_class($complexType), strrpos(get_class($complexType), '\') + 1);
By a function that allow to use the section as a container only (Section exist for PHPWord Element, but not for word2007 writer). |
Describe the Bug
Using setComplexBlock or setComplexValue remove all other placeholder than the one being searched
Steps to Reproduce
This code is used to add html string from WYSIWYG editor to template. First html is added to section and then making placeholder with the same number as elements in the section and saving it to a file. Afterwards, the file is loaded using second template processor and setComplexBlock is used to add the elements.
Expected Behavior
All elements of section replace all placeholder
Current Behavior
Only first element is replacing the placeholder. All other placeholders are somehow removed afterwards.
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: