lib/rtf/node.rb
def to_rtf
         text = StringIO.new
         size = 0

         self.each do |row|
            if size > 0
               text << "\n"
            else
               size = 1
            end
            text << row.to_rtf
         end

         text.string.sub(/\\row(?!.*\\row)/m, "\\lastrow\n\\row")
      end
def to_rtf
         text = StringIO.new
         size = 0

         self.each do |row|
            if size > 0
               text << "\n"
            else
               size = 1
            end
            text << row.to_rtf
         end

         text.string.sub(/\\row(?!.*\\row)/m, "\\lastrow\n\\row")
      end
This method generates the RTF document text for a TableCellNode object.