-
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
Variable number of lists in TemplateProcessor #1393
Comments
Hi @rkorebrits, Did you get solution for this problem? since I have same issue. Best, |
I know this is an old issue but I just spent SO MUCH time figure out a solution for this. I'm pretty sure my hair turned a little grey. I did find a solution. It's not perfect, but it seems to work. I'm using the template processor as well and I had a specific requirement that lists should be styled with a specific setup: First level should be dash, second open bullet. What I did was I added a block in the DOCX template and set up the desired styles for the levels. It looks like this: This will ensure that the proper What you then can do is simply remove this block before saving the new file: $templateProcessor->cloneBlock('list_block', 0, true, true); The template processor's Now, all the lists added from |
Hello I am using TemplateProcessor + HTMLtoOpenXML\Parser; Expected behavior
Obtained behavior
Thank you |
We are using the
TemplateProcessor
for writing content to documents and use https://github.com/rkorebrits/HTMLtoOpenXML to transform HTML to OOXML, which all works fine overall.The issue that we are having currently though is with lists. As the content we are populating comes from a CMS, there can be a number of lists in the content and there is an option to use
<ul>
or<ol>
.Over the last few weeks, I've done quite extensive research on how the numbering works in Word documents and from what I gather, it is not possible to set the type of list from the
document.xml
.numbering.xml
has all of that information in it:document.xml
has its own node, referring to a list type (e.g.<w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num>
).I've got the feeling that it is not really possible in the PHPWord TemplateProcessor, to be able to dictate what type of list is added, by adding XML to the
document.xml
only, but I'm hoping there might be some trick that I know of?Also, is it possible at all to write to
numbering.xml
from the TemplateProcessor? What I otherwise could do is prepare the numbering.xml file, to have 2 styles in it (unordered and ordered) but without a list of actual implementations, and when parsing the HTML, for each list, write a node to numbering.xml to say if its unordered/bullet or ordered/number.Context
cloneBlockString
and insertImage), up-to-date with dev-masterThe text was updated successfully, but these errors were encountered: