Sha256: 8dd75f368880f6d8510bea219a0270438e36f8fa7da0f2871bf2873a41efffba
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module OoxmlParser # Class for storing image data class FileReference < OOXMLDocumentObject # @return [String] id of resource attr_accessor :resource_id # @return [String] path to file attr_accessor :path # @return [String] content of file attr_accessor :content def parse(node) node.attributes.each do |key, value| case key when 'embed', 'id', 'link' @resource_id = value.value end end return self if @resource_id.nil? @path = OOXMLDocumentObject.get_link_from_rels(@resource_id) if @path.empty? warn "Cant find path to media file by id: #{@resource_id}" return self end return self if @path == 'NULL' full_path_to_file = OOXMLDocumentObject.path_to_folder + OOXMLDocumentObject.root_subfolder + @path.gsub('..', '') if File.exist?(full_path_to_file) @content = IO.binread(full_path_to_file) else warn "Couldn't find #{full_path_to_file} file on filesystem. Possible problem in original document" end self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.2.0 | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb |