diff --git a/lib/docx_templater/docx_creator.rb b/lib/docx_templater/docx_creator.rb index cc15615..266cb9f 100644 --- a/lib/docx_templater/docx_creator.rb +++ b/lib/docx_templater/docx_creator.rb @@ -12,7 +12,7 @@ def initialize(template_path, data, escape_html = true) end def generate_docx_file(file_name = "output_#{Time.now.strftime('%Y-%m-%d_%H%M')}.docx") - File.open(file_name, 'w') do |f| + File.open(file_name, 'wb') do |f| f.write(generate_docx_bytes.string) end end