Module: Workbook::Writers::HtmlWriter
- Included in:
- Book
- Defined in:
- lib/workbook/writers/html_writer.rb
Instance Method Summary collapse
-
#to_html(options = {}) ⇒ String
Generates an HTML table ().
-
#write_to_html(filename = "#{title}.html", options = {}) ⇒ String
Write the current workbook to HTML format.
Instance Method Details
#to_html(options = {}) ⇒ String
Generates an HTML table ()
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/workbook/writers/html_writer.rb', line 15 def to_html ={} builder = Nokogiri::XML::Builder.new do |doc| doc.html { doc.body { self.each{|sheet| doc.h1 { doc.text sheet.name } sheet.each{|table| doc.h2 { doc.text table.name } doc << table.to_html() } } } } end return builder.doc.to_xhtml end |
#write_to_html(filename = "#{title}.html", options = {}) ⇒ String
Write the current workbook to HTML format
42 43 44 45 |
# File 'lib/workbook/writers/html_writer.rb', line 42 def write_to_html filename="#{title}.html", ={} File.open(filename, 'w') {|f| f.write(to_html()) } return filename end |