-
Notifications
You must be signed in to change notification settings - Fork 1
Image Usage
Muhammet Dilmaç edited this page Jul 11, 2017
·
3 revisions
You can internal or external image add word document. Your img tag must have height, weight and full path src attribute.
Example;
require 'Html2Docx'
options = {}
options[:output] = '/home/muhammet/Output.docx'
options[:html] = <<-HTML
<!DOCTYPE html>
<html>
<body><h2>Index</h2><p><a href="#html2_docx_links">Html2Docx Links</a> | <a href="#whatisloremipsum">What is Lorem Ipsum?</a> | <a href="#imageexample">Image Support</a> | <a href="#rubylogo">Ruby Logo</a></p><h2 id="html2_docx_links">Html2Docx Links</h2><p><a href="https://rubygems.org/gems/Html2Docx">RubyGems</a> | <a href="https://github.com/MuhammetDilmac/Html2Docx">Source Code</a> | <a href="https://github.com/MuhammetDilmac/Html2Docx/wiki">Wiki</a> | <a href="https://github.com/MuhammetDilmac/Html2Docx/issues">Bug Tracker</a></p><h2 id="whatisloremipsum">What is Lorem Ipsum?</h2><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p><h2 id="imageexample">Image</h2><p><img src="/home/muhammet/Masaüstü/2.jpg" height="360" width="640" alt="Resim 1" /><i>Example image destription</i></p><h2 id="rubylogo">Ruby Logo</h2><p><img src="https://www.ruby-lang.org/images/header-ruby-logo.png" alt="Ruby Logo" height="62" width="62"></p>
</body>
</html>
HTML
Html2Docx.render(options)
Output;