guigrpa / docx-templates

Template-based docx report creation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inserting HTML part ?

olivierSOW opened this issue · comments

Hi,

I would like to insert HTML parts. I see the HTML keyword allows inserting HTML
the example shows how to use it but when i try with my template, i get this error:

docx-templates.js:17 
 Uncaught (in promise) Error: Error executing command '`<meta charset="UTF-8"> <body>   <h1>$': SyntaxError: Unexpected end of input
    at runUserJsAndGetRaw (docx-templates.js:17:7454)
    at H (docx-templates.js:18:502)
    at U (docx-templates.js:17:13993)
    at walkTemplate (docx-templates.js:17:12985)
    at async ue (docx-templates.js:18:8491)
    at async HTMLButtonElement.OnExportClick (export.js:465:19)

If I remove all inserting tags within the HTML, the creating process is OK.
Could you help me please ?

My final goal is converting multiple html formatted texts (built with XDSoft Jodit) into one docx file. Can i do it with docx-templates via the HTLM inserting tag and submiting Html text into the javascript data ? Must I insert html head/body tag for each HTML parts or can i insert directly the html part ?

i join my template
export-by-pool.docx

Ok, i found the solution by myself: i changed command delimiters to use { and }
and these characteres are used in HTML, so i change command delimiters to {# #}
i can insert HTML parts by adding html head/foot (`

` and `` )

thanks for you great lib !

Thanks for posting your solution!