Add support for images
This commit is contained in:
@@ -16,6 +16,12 @@ module Ezdoc
|
||||
zipfile.get_output_stream("word/document.xml") { |f| f.write(document_xml) }
|
||||
|
||||
zipfile.get_output_stream("word/numbering.xml") { |f| f.write(numbering_xml) } if lists?
|
||||
|
||||
images.each do |image|
|
||||
zipfile.get_output_stream("word/media/#{image.filename}") do |f|
|
||||
f.write(File.binread(image.path))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,8 +31,12 @@ module Ezdoc
|
||||
@document.lists.any?
|
||||
end
|
||||
|
||||
def images
|
||||
@document.images
|
||||
end
|
||||
|
||||
def content_types_xml
|
||||
Xml::ContentTypes.new(has_numbering: lists?).to_xml
|
||||
Xml::ContentTypes.new(has_numbering: lists?, images: images).to_xml
|
||||
end
|
||||
|
||||
def relationships_xml
|
||||
@@ -34,7 +44,7 @@ module Ezdoc
|
||||
end
|
||||
|
||||
def document_relationships_xml
|
||||
Xml::DocumentRelationships.new(has_numbering: lists?).to_xml
|
||||
Xml::DocumentRelationships.new(has_numbering: lists?, images: images).to_xml
|
||||
end
|
||||
|
||||
def document_xml
|
||||
|
||||
Reference in New Issue
Block a user