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

         text << "\\trowd\\tgraph#{parent.cell_margin}"
         self.each do |entry|
            widths = entry.border_widths
            colour = entry.shading_colour

            text << "\n"
            text << "\\clbrdrt\\brdrw#{widths[0]}\\brdrs" if widths[0] != 0
            text << "\\clbrdrl\\brdrw#{widths[3]}\\brdrs" if widths[3] != 0
            text << "\\clbrdrb\\brdrw#{widths[2]}\\brdrs" if widths[2] != 0
            text << "\\clbrdrr\\brdrw#{widths[1]}\\brdrs" if widths[1] != 0
            text << "\\clcbpat#{root.colours.index(colour)}" if colour != nil
            text << "\\cellx#{entry.width + offset}"
            temp << "\n#{entry.to_rtf}"
            offset += entry.width
         end
         text << "#{temp.string}\n\\row"

         text.string
      end
def to_rtf
         text   = StringIO.new
         temp   = StringIO.new
         offset = 0

         text << "\\trowd\\tgraph#{parent.cell_margin}"
         self.each do |entry|
            widths = entry.border_widths
            colour = entry.shading_colour

            text << "\n"
            text << "\\clbrdrt\\brdrw#{widths[0]}\\brdrs" if widths[0] != 0
            text << "\\clbrdrl\\brdrw#{widths[3]}\\brdrs" if widths[3] != 0
            text << "\\clbrdrb\\brdrw#{widths[2]}\\brdrs" if widths[2] != 0
            text << "\\clbrdrr\\brdrw#{widths[1]}\\brdrs" if widths[1] != 0
            text << "\\clcbpat#{root.colours.index(colour)}" if colour != nil
            text << "\\cellx#{entry.width + offset}"
            temp << "\n#{entry.to_rtf}"
            offset += entry.width
         end
         text << "#{temp.string}\n\\row"

         text.string
      end
def to_rtf text = StringIO . new temp = StringIO . new offset = 0 text << "\\trowd\\tgraph#{parent.cell_margin}" self . each do | entry | widths = entry . border_widths colour = entry . shading_colour text << "\n" text << "\\clbrdrt\\brdrw#{widths[0]}\\brdrs" if widths [ 0 ] != 0 text << "\\clbrdrl\\brdrw#{widths[3]}\\brdrs" if widths [ 3 ] != 0 text << "\\clbrdrb\\brdrw#{widths[2]}\\brdrs" if widths [ 2 ] != 0 text << "\\clbrdrr\\brdrw#{widths[1]}\\brdrs" if widths [ 1 ] != 0 text << "\\clcbpat#{root.colours.index(colour)}" if colour != nil text << "\\cellx#{entry.width + offset}" temp << "\n#{entry.to_rtf}" offset += entry . width end text << "#{temp.string}\n\\row" text . string end
This method overloads the store method inherited from the ContainerNode
 class to forbid addition of further nodes.

 ==== Parameters
 node::  A reference to the node to be added.
def store(node)
   RTFError.fire("Table row nodes cannot have nodes added to.")
end
 This method generates the RTF document text for a TableCellNode object.
This method overloads the store method inherited from the ContainerNode class to forbid addition of further nodes .