lib/htmltoword/document.rb in htmltoword-0.4.2 vs lib/htmltoword/document.rb in htmltoword-0.4.4
- old
+ new
@@ -8,9 +8,15 @@
document = new(template_file(template_name))
document.replace_file(content, Document.doc_xml_file, extras)
document.generate
end
+ def create_and_save(content, file_path, template_name = nil, extras = false)
+ File.open(file_path, "wb") do |out|
+ out << create(content, template_name, extras)
+ end
+ end
+
def create_with_content(template, content, set=nil, extras = false)
template += extension unless template.end_with?(extension)
content = replace_values(content, set) if set
document = new(template_file(template))
document.replace_file(content, Document.doc_xml_file, extras)