diff --git a/README.textile b/README.textile index 2525662..9dd4451 100644 --- a/README.textile +++ b/README.textile @@ -2,9 +2,17 @@ h1. ODF-REPORT Gem for generating .odt files by making strings, images, tables and sections replacements in a previously created .odt file. +h3. NEW + +* as per popular request, now uses rubyzip ~> 1.1.0 +* uses @Zip::OutputStream.write_buffer@ to generate the file. This should avoid corruption issues. +* the @.generate@ method now returns the actual report binary, so you can send_data it directly +* you can also use @.generate('file.odt')@, which saves the report to the specified file + h2. INSTALL -(sudo) gem install odf-report +In your Gemfile +
gem 'odf-report'h2. USAGE @@ -185,20 +193,19 @@ def print end - report_file_name = report.generate - - send_file(report_file_name) + send_data report.generate, type: 'application/vnd.oasis.opendocument.text', + disposition: 'attachment', + filename: 'report.odt' end -The @generate@ method will, er... generate the document in a temp dir and returns the full path of the generated file, so you can send it back to the user. _That's all I have to say about that._ h4. Generating a document in a standalone script -It's just the same as in a Rails app, but you can inform the path where the file will be generated instead of using a temp dir. +It's just the same as in a Rails app, but you can inform the path where the file will be saved.
report = ODFReport::Report.new("ticket.odt") do |r| @@ -207,21 +214,12 @@ report = ODFReport::Report.new("ticket.odt") do |r| end -report.generate("./documents/") +report.generate("./documents/new_ticket.odt")