<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -120,15 +120,11 @@ module PDF
       attr_reader :cells, :wrapper
       attr_accessor :width, :show_headers
 
-      #
       def initialize(opts = {})
 
         # default table options
         @table_options  = opts
-        @col_options    = Hash.new({})
-        @row_options    = Hash.new({})
         @manual_col_widths = {}
-        @header_options = {}
         @show_headers  = :page
 
         yield self if block_given?
@@ -158,6 +154,8 @@ module PDF
             end
           end
         end
+        each_cell { |cell| cell.options.merge!(@table_options)}
+        @cells
       end
 
       # Retrieve or set the table's optional column headers.
@@ -193,7 +191,9 @@ module PDF
             Wrapper::TextCell.new(data.to_s)
           end
         end
-        @header_options = opts
+        @headers.each { |cell| cell.options.merge!(@table_options)}
+        @headers.each { |cell| cell.options.merge!(opts)}
+        @headers
       end
 
       def draw(wrapper, tablex, tabley)
@@ -239,6 +239,7 @@ module PDF
       end
 
       # access a particular cell at location x, y
+      #
       def cell(col_idx, row_idx)
         @cells[row_idx][col_idx]
       end
@@ -262,7 +263,9 @@ module PDF
              (spec.class == Array &amp;&amp; spec.include?(col_idx)) ||
              (spec.respond_to?(:to_i) &amp;&amp; spec.to_i == col_idx)
 
-            @col_options[col_idx] = @col_options[col_idx].merge(opts)
+            cells_in_col(col_idx).each do |cell|
+              cell.options.merge!(opts)
+            end
           end
         end
         self
@@ -298,34 +301,14 @@ module PDF
              (spec.class == Array &amp;&amp; spec.include?(row_idx)) ||
              (spec.respond_to?(:to_i) &amp;&amp; spec.to_i == row_idx)
 
-            @row_options[row_idx] = @col_options[row_idx].merge(opts)
+            cells_in_row(row_idx).each do |cell|
+              cell.options.merge!(opts)
+            end
           end
         end
         self
       end
 
-      # calculate the combined options for a particular cell
-      #
-      # To get the options for a regular cell, use numbers to reference the exact cell:
-      #
-      #    options_for(3, 3)
-      #
-      # To get options for a header cell, use :headers for the row:
-      #
-      #    options_for(3, :headers)
-      #
-      def options_for(col_idx, row_idx = nil)
-        opts = @table_options.dup
-        opts.merge! @col_options[col_idx]
-        if row_idx == :headers
-          opts.merge! @header_options
-        else
-          opts.merge! @row_options[row_idx]
-          opts.merge! @cells[row_idx][col_idx].options
-        end
-        opts
-      end
-
       # Returns the number of columns in the table
       def col_count
         @cells.first.size.to_f
@@ -372,7 +355,6 @@ module PDF
         calculate_row_heights
       end
 
-
       def calculate_cell_width_range
         # TODO: when calculating the min cell width, we basically want the width of the widest character. At the
         #       moment I'm stripping all pango markup tags from the string, which means if any character is made
@@ -381,7 +363,6 @@ module PDF
         # calculate the min and max width of every cell in the table
         cells.each_with_index do |row, row_idx|
           row.each_with_index do |cell, col_idx|
-            cell.options = self.options_for(col_idx, row_idx)
             cell.calculate_width_range(wrapper)
           end
         end
@@ -389,7 +370,6 @@ module PDF
         # calculate the min and max width of every cell in the headers row
         if self.headers
           self.headers.each_with_index do |cell, col_idx|
-            cell.options = self.options_for(col_idx, :headers)
             cell.calculate_width_range(wrapper)
           end
         end</diff>
      <filename>lib/pdf/wrapper/table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -194,9 +194,20 @@ context PDF::Wrapper, &quot;data= method&quot; do
     (cells[0] === manual_cell_one).should be_true
     (cells[1] === manual_cell_two).should be_true
   end
+
+  specify &quot;should set the default table options on all cells&quot; do
+    data = [%w{head1 head2},%w{data1 data2}]
+    table = PDF::Wrapper::Table.new(:markup =&gt; :pango)
+
+    table.data = data
+
+    table.each_cell do |cell|
+      cell.options.should eql(:markup =&gt; :pango)
+    end
+  end
 end
 
-context PDF::Wrapper, &quot;data= method&quot; do
+context PDF::Wrapper, &quot;headers method&quot; do
 
   specify &quot;should raise an exception if given cell count does not match existing data&quot; do
     data = [%w{data1 data2},%w{data1 data2}]
@@ -245,6 +256,30 @@ context PDF::Wrapper, &quot;data= method&quot; do
     (set_headers[0] === manual_cell_one).should be_true
     (set_headers[1] === manual_cell_two).should be_true
   end
+
+  specify &quot;should set options on all cells&quot; do
+    headers = [&quot;head1&quot;,&quot;head2&quot;]
+
+    table = PDF::Wrapper::Table.new
+    table.headers(headers, :markup =&gt; :pango)
+
+    set_headers = table.instance_variable_get(&quot;@headers&quot;)
+    set_headers.each do |cell|
+      cell.options.should eql(:markup =&gt; :pango)
+    end
+  end
+
+  specify &quot;should set default table options on all cells&quot; do
+    headers = [&quot;head1&quot;,&quot;head2&quot;]
+
+    table = PDF::Wrapper::Table.new(:markup =&gt; :pango)
+    table.headers(headers)
+
+    set_headers = table.instance_variable_get(&quot;@headers&quot;)
+    set_headers.each do |cell|
+      cell.options.should eql(:markup =&gt; :pango)
+    end
+  end
 end
 
 context PDF::Wrapper, &quot;cell method&quot; do
@@ -263,3 +298,48 @@ context PDF::Wrapper, &quot;cell method&quot; do
     table.cell(1,1).data.should eql(&quot;data4&quot;)
   end
 end
+
+context PDF::Wrapper, &quot;cell_options method&quot; do
+
+  specify &quot;should set options on the appropriate cell&quot; do
+    data = [%w{data1 data2},%w{data3 data4}]
+
+    table = PDF::Wrapper::Table.new
+    table.data = data
+    table.cell_options(0,0, :markup =&gt; :pango)
+
+    table.cell(0,0).options.should eql(:markup =&gt; :pango)
+  end
+end
+
+context PDF::Wrapper, &quot;col_options method&quot; do
+
+  specify &quot;should set options on all cells in the appropriate column&quot; do
+    data = [%w{data1 data2},%w{data3 data4}]
+
+    table = PDF::Wrapper::Table.new
+    table.data = data
+    table.col_options(0, :markup =&gt; :pango)
+
+    table.cell(0,0).options.should eql(:markup =&gt; :pango)
+    table.cell(0,1).options.should eql(:markup =&gt; :pango)
+    table.cell(1,0).options.should eql({})
+    table.cell(1,1).options.should eql({})
+  end
+end
+
+context PDF::Wrapper, &quot;row_options method&quot; do
+
+  specify &quot;should set options on all cells in the appropriate row&quot; do
+    data = [%w{data1 data2},%w{data3 data4}]
+
+    table = PDF::Wrapper::Table.new
+    table.data = data
+    table.row_options(0, :markup =&gt; :pango)
+
+    table.cell(0,0).options.should eql(:markup =&gt; :pango)
+    table.cell(1,0).options.should eql(:markup =&gt; :pango)
+    table.cell(0,1).options.should eql({})
+    table.cell(1,1).options.should eql({})
+  end
+end</diff>
      <filename>specs/tables_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ec7bfbb9c19efd4350a79d5aabf83018e2ec8183</id>
    </parent>
  </parents>
  <author>
    <name>James Healy</name>
    <email>jimmy@deefa.com</email>
  </author>
  <url>http://github.com/yob/pdf-wrapper/commit/04a2114bc7626e6e68a6a2f00ae632e48cbd06d5</url>
  <id>04a2114bc7626e6e68a6a2f00ae632e48cbd06d5</id>
  <committed-date>2009-10-14T21:15:16-07:00</committed-date>
  <authored-date>2009-10-14T21:15:16-07:00</authored-date>
  <message>spec and fix option handling on table</message>
  <tree>cb25c2862c4c46ff3d0732fd3c593b52f2ae8eaf</tree>
  <committer>
    <name>James Healy</name>
    <email>jimmy@deefa.com</email>
  </committer>
</commit>
