lib/rtf/node.rb
def to_rtf
        text  = StringIO.new
        count = 0
  
        #text << '{\pard{\*\shppict{\pict'
        text << '{\*\shppict{\pict'
        text << "\\picscalex#{@x_scaling}" if @x_scaling != nil
        text << "\\picscaley#{@y_scaling}" if @y_scaling != nil
        text << "\\piccropl#{@left_crop}" if @left_crop != nil
        text << "\\piccropr#{@right_crop}" if @right_crop != nil
        text << "\\piccropt#{@top_crop}" if @top_crop != nil
        text << "\\piccropb#{@bottom_crop}" if @bottom_crop != nil
        text << "\\picwgoal#{@displayed_width}" if @displayed_width != nil
        text << "\\pichgoal#{@displayed_height}" if @displayed_height != nil        
        text << "\\picw#{@width}\\pich#{@height}\\bliptag#{@id}"
        text << "\\#{@type.id2name}\n"
  
        open_file do |file|
          file.each_byte do |byte|
            hex_str = byte.to_s(16)
            hex_str.insert(0,'0') if hex_str.length == 1
            text << hex_str    
            count += 1
            if count == 40
              text << "\n"
              count = 0
            end
          end
        end
        #text << "\n}}\\par}"
        text << "\n}}"

        text.string
      end
def to_rtf
        text  = StringIO.new
        count = 0
  
        #text << '{\pard{\*\shppict{\pict'
        text << '{\*\shppict{\pict'
        text << "\\picscalex#{@x_scaling}" if @x_scaling != nil
        text << "\\picscaley#{@y_scaling}" if @y_scaling != nil
        text << "\\piccropl#{@left_crop}" if @left_crop != nil
        text << "\\piccropr#{@right_crop}" if @right_crop != nil
        text << "\\piccropt#{@top_crop}" if @top_crop != nil
        text << "\\piccropb#{@bottom_crop}" if @bottom_crop != nil
        text << "\\picwgoal#{@displayed_width}" if @displayed_width != nil
        text << "\\pichgoal#{@displayed_height}" if @displayed_height != nil        
        text << "\\picw#{@width}\\pich#{@height}\\bliptag#{@id}"
        text << "\\#{@type.id2name}\n"
  
        open_file do |file|
          file.each_byte do |byte|
            hex_str = byte.to_s(16)
            hex_str.insert(0,'0') if hex_str.length == 1
            text << hex_str    
            count += 1
            if count == 40
              text << "\n"
              count = 0
            end
          end
        end
        #text << "\n}}\\par}"
        text << "\n}}"

        text.string
      end
def to_rtf text = StringIO . new count = 0 #text << '{\pard{\*\shppict{\pict' text << '{\*\shppict{\pict' text << "\\picscalex#{@x_scaling}" if @x_scaling != nil text << "\\picscaley#{@y_scaling}" if @y_scaling != nil text << "\\piccropl#{@left_crop}" if @left_crop != nil text << "\\piccropr#{@right_crop}" if @right_crop != nil text << "\\piccropt#{@top_crop}" if @top_crop != nil text << "\\piccropb#{@bottom_crop}" if @bottom_crop != nil text << "\\picwgoal#{@displayed_width}" if @displayed_width != nil text << "\\pichgoal#{@displayed_height}" if @displayed_height != nil text << "\\picw#{@width}\\pich#{@height}\\bliptag#{@id}" text << "\\#{@type.id2name}\n" open_file do | file | file . each_byte do | byte | hex_str = byte . to_s ( 16 ) hex_str . insert ( 0 , '0' ) if hex_str . length == 1 text << hex_str count += 1 if count == 40 text << "\n" count = 0 end end end #text << "\n}}\\par}" text << "\n}}" text . string end
This method generates the RTF for an ImageNode object.
This method generates the RTF for an ImageNode object .