sablon icon indicating copy to clipboard operation
sablon copied to clipboard

Injecting text-align: justify into docx file

Open apfrozis opened this issue 1 year ago • 0 comments

I'm trying to inject the following html paragraph to a docx file I'm getting an error when opening it:

test

What I've figure out is that sablon, apparently, is not supporting text-align: justify style injection into the file. Because if I change it to "left", "center" or "right" it works perfectly.

This is what I'm doing to inject info to the template:

html_content = Sablon.content(:html, <p style="text-align: justify">test</p>) template = Sablon.template(<template_path>) output_docx = Tempfile.new([<project_name>, '.docx']) context = {test_label: html_content} template.render_to_file output_docx.path, context output_docx.close

This is the template file: image

When I try to open the generated file I get the following error: image

apfrozis avatar Jan 04 '24 15:01 apfrozis