module Html2Docx

Constants

ROOT_PATH
VERSION

Public Class Methods

clear_temp(tmp) click to toggle source
# File lib/Html2Docx.rb, line 23
def self.clear_temp(tmp)
  FileUtils.rm_r tmp
end
create_docx(output, input) click to toggle source
# File lib/Html2Docx.rb, line 27
def self.create_docx(output, input)
  zf = ZipFileGenerator.new(input, output)
  zf.write

  self.clear_temp(input)
end
render(options = {}) click to toggle source
# File lib/Html2Docx.rb, line 34
def self.render(options = {})
  initialization = Initialization.new(options)
  options[:temp] = initialization.get_temp_directory
  options[:initialization] = initialization

  content_types  = ContentTypes.new(options)
  options[:content_types] = content_types

  options[:main_relation] = true
  main_relation  = Relation.new(options)
  options[:main_relation] = main_relation

  document       = Document.new(options)
  options[:document] = document

  # Render
  document.render
  content_types.render
  main_relation.render

  # Create Docx File
  self.create_docx(options.fetch(:output), options.fetch(:temp))
end