-
Notifications
You must be signed in to change notification settings - Fork 145
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
Please add a nested table rows generation support #82
Comments
+1 for this request. I've tried to fill nested table also. |
+1 please add nested table support |
👍 |
+1 to add this. Thanks |
+1 bump |
+1 , i want this feature, thanks |
In case it helps anyone, I got nested table working. There is a catch though, You need to have some space at the bottom of the nested table. Here is the template I used: Below is the result: As you can see, the first 2 tables rendered just fine, but the last one did not render at all. I am not sure if this is a limitation with |
I modified the code and got it working. Not sure if this change would affect other scenarios, but now all 3 of the tables are being rendered fine. I added the code outlined in red (in the file Below is the code I added, if anyone needs it for copy/paste: // If the last generated output node is a table row, and it is set to be deleted,
// don't delete if it has exactly one nested row (i.e. within nested table)
if (tag === 'w:tr' && fRemoveNode) {
fRemoveNode = (nodeIn._children.filter(child => child._tag === 'w:tr').length !== 1);
} Below is the output: |
@pkozul thanks for looking into this! Can you make a PR with this change? I'd like to look into it further. If you can also add that template so I can make it into a test case, that would also be great. |
@jjhbw Bummer. Although my code change worked in this example I included above, it doesn't work in the more complex scenario I have at work. I'm not familiar enough with how the entire code works, so maybe you'll have some ideas on what else we can try? I think it really comes down to the code I have outlined in the red box, and determining the exact condition required to NOT remove the |
I'm out of ideas honestly. The docx spec is just too complex and too dependent on MS Word's secret sauce (MS trustbusters should have paid attention to this long ago). At work we have had great success in achieving roughly what you want by inserting complex tables like the one below as HTML (using docx-templates). MS Word supports a good ~80% of the HTML spec surrounding I'm sorry to dissappoint. Happy to entertain ideas on how to solve this, though, but I'm all out myself. |
+1 , to add, thanks |
In this examle we will see no table at all in the result docx even if we have objects in the "table" array.
Please add support for nested tables,
The text was updated successfully, but these errors were encountered: