README.md in htmltoword-0.1.3 vs README.md in htmltoword-0.1.4
- old
+ new
@@ -19,11 +19,12 @@
### Standalone
```ruby
require 'htmltoword'
-file = Htmltoword::Document.create params[:assembly_content_html], file_name
+my_html = '<html><head></head><body><p>Hello</p></body></html>'
+file = Htmltoword::Document.create my_html, file_name
```
### With Rails
```ruby
@@ -37,9 +38,18 @@
file = Htmltoword::Document.create params[:docx_html_source], "file_name.docx"
send_file file.path, :disposition => "attachment"
end
end
end
+```
+
+```javascript
+ // OPTIONAL: Use a jquery click handler to store the markup in a hidden form field before the form is submitted.
+ // Using this strategy makes it easy to allow users to dynamically edit the document that will be turned
+ // into a docx file, for example by toggling sections of a document.
+ $('#download-as-docx').on('click', function () {
+ $('input[name="docx_html_source"]').val('<!DOCTYPE html>\n' + $('.delivery').html());
+ });
```
## Features
All standard html elements are supported and will create the closest equivalent in wordml. For example spans will create inline elements and divs will create block like elements.