rdoc/RubyXL/WorksheetConvenienceMethods.html in rubyXL-3.4.16 vs rdoc/RubyXL/WorksheetConvenienceMethods.html in rubyXL-3.4.17

- old
+ new

@@ -2,11 +2,11 @@ <html> <head> <meta charset="UTF-8"> -<title>module RubyXL::WorksheetConvenienceMethods - rubyXL 3.4.16</title> +<title>module RubyXL::WorksheetConvenienceMethods - rubyXL 3.4.17</title> <script type="text/javascript"> var rdoc_rel_prefix = "../"; var index_rel_prefix = "../"; </script> @@ -19,12 +19,10 @@ <link href="../css/fonts.css" rel="stylesheet"> <link href="../css/rdoc.css" rel="stylesheet"> - - <body id="top" role="document" class="module"> <nav role="navigation"> <div id="project-navigation"> <div id="home-section" role="region" title="Quick navigation" class="nav-section"> <h2> @@ -60,154 +58,85 @@ <div id="class-metadata"> - <!-- Method Quickref --> + +<!-- Method Quickref --> <div id="method-list-section" class="nav-section"> <h3>Methods</h3> <ul class="link-list" role="directory"> - <li ><a href="#method-i-add_validation_list">#add_validation_list</a> - <li ><a href="#method-i-change_column_alignment">#change_column_alignment</a> - <li ><a href="#method-i-change_column_bold">#change_column_bold</a> - <li ><a href="#method-i-change_column_border">#change_column_border</a> - <li ><a href="#method-i-change_column_border_color">#change_column_border_color</a> - <li ><a href="#method-i-change_column_fill">#change_column_fill</a> - <li ><a href="#method-i-change_column_font">#change_column_font</a> - <li ><a href="#method-i-change_column_font_color">#change_column_font_color</a> - <li ><a href="#method-i-change_column_font_name">#change_column_font_name</a> - <li ><a href="#method-i-change_column_font_size">#change_column_font_size</a> - <li ><a href="#method-i-change_column_horizontal_alignment">#change_column_horizontal_alignment</a> - <li ><a href="#method-i-change_column_italics">#change_column_italics</a> - <li ><a href="#method-i-change_column_strikethrough">#change_column_strikethrough</a> - <li ><a href="#method-i-change_column_underline">#change_column_underline</a> - <li ><a href="#method-i-change_column_vertical_alignment">#change_column_vertical_alignment</a> - <li ><a href="#method-i-change_column_width">#change_column_width</a> - <li ><a href="#method-i-change_column_width_raw">#change_column_width_raw</a> - <li ><a href="#method-i-change_row_alignment">#change_row_alignment</a> - <li ><a href="#method-i-change_row_bold">#change_row_bold</a> - <li ><a href="#method-i-change_row_border">#change_row_border</a> - <li ><a href="#method-i-change_row_border_color">#change_row_border_color</a> - <li ><a href="#method-i-change_row_fill">#change_row_fill</a> - <li ><a href="#method-i-change_row_font">#change_row_font</a> - <li ><a href="#method-i-change_row_font_color">#change_row_font_color</a> - <li ><a href="#method-i-change_row_font_name">#change_row_font_name</a> - <li ><a href="#method-i-change_row_font_size">#change_row_font_size</a> - <li ><a href="#method-i-change_row_height">#change_row_height</a> - <li ><a href="#method-i-change_row_horizontal_alignment">#change_row_horizontal_alignment</a> - <li ><a href="#method-i-change_row_italics">#change_row_italics</a> - <li ><a href="#method-i-change_row_strikethrough">#change_row_strikethrough</a> - <li ><a href="#method-i-change_row_underline">#change_row_underline</a> - <li ><a href="#method-i-change_row_vertical_alignment">#change_row_vertical_alignment</a> - <li ><a href="#method-i-column_font">#column_font</a> - <li ><a href="#method-i-delete_cell">#delete_cell</a> - <li ><a href="#method-i-delete_column">#delete_column</a> - <li ><a href="#method-i-delete_row">#delete_row</a> - <li ><a href="#method-i-get_col_style">#get_col_style</a> - <li ><a href="#method-i-get_cols_style_index">#get_cols_style_index</a> - <li ><a href="#method-i-get_column_alignment">#get_column_alignment</a> - <li ><a href="#method-i-get_column_border">#get_column_border</a> - <li ><a href="#method-i-get_column_border_color">#get_column_border_color</a> - <li ><a href="#method-i-get_column_fill">#get_column_fill</a> - <li ><a href="#method-i-get_column_font_color">#get_column_font_color</a> - <li ><a href="#method-i-get_column_font_name">#get_column_font_name</a> - <li ><a href="#method-i-get_column_font_size">#get_column_font_size</a> - <li ><a href="#method-i-get_column_width">#get_column_width</a> - <li ><a href="#method-i-get_column_width_raw">#get_column_width_raw</a> - <li ><a href="#method-i-get_row_alignment">#get_row_alignment</a> - <li ><a href="#method-i-get_row_border">#get_row_border</a> - <li ><a href="#method-i-get_row_border_color">#get_row_border_color</a> - <li ><a href="#method-i-get_row_fill">#get_row_fill</a> - <li ><a href="#method-i-get_row_font_color">#get_row_font_color</a> - <li ><a href="#method-i-get_row_font_name">#get_row_font_name</a> - <li ><a href="#method-i-get_row_font_size">#get_row_font_size</a> - <li ><a href="#method-i-get_row_height">#get_row_height</a> - <li ><a href="#method-i-get_row_style">#get_row_style</a> - <li ><a href="#method-i-insert_cell">#insert_cell</a> - <li ><a href="#method-i-insert_column">#insert_column</a> - <li ><a href="#method-i-insert_row">#insert_row</a> - <li ><a href="#method-i-is_column_bolded">#is_column_bolded</a> - <li ><a href="#method-i-is_column_italicized">#is_column_italicized</a> - <li ><a href="#method-i-is_column_struckthrough">#is_column_struckthrough</a> - <li ><a href="#method-i-is_column_underlined">#is_column_underlined</a> - <li ><a href="#method-i-is_row_bolded">#is_row_bolded</a> - <li ><a href="#method-i-is_row_italicized">#is_row_italicized</a> - <li ><a href="#method-i-is_row_struckthrough">#is_row_struckthrough</a> - <li ><a href="#method-i-is_row_underlined">#is_row_underlined</a> - <li ><a href="#method-i-merge_cells">#merge_cells</a> - <li ><a href="#method-i-row_font">#row_font</a> - </ul> </div> </div> </nav> @@ -219,91 +148,54 @@ <section class="description"> </section> - <section id="5Buntitled-5D" class="documentation-section"> - - - <section class="constants-list"> <header> <h3>Constants</h3> </header> <dl> - <dt id="BOLD">BOLD - <dd> - - <dt id="COLOR">COLOR - <dd> - - <dt id="ITALICS">ITALICS - <dd> - - <dt id="NAME">NAME - <dd> - - <dt id="SIZE">SIZE - <dd> - - <dt id="STRIKETHROUGH">STRIKETHROUGH - <dd> - - <dt id="UNDERLINE">UNDERLINE - <dd> - - </dl> </section> - - - + <section id="public-instance-5Buntitled-5D-method-details" class="method-section"> <header> <h3>Public Instance Methods</h3> </header> - <div id="method-i-add_validation_list" class="method-detail "> - <div class="method-heading"> <span class="method-name">add_validation_list</span><span class="method-args">(ref, list_arr)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="add_validation_list-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 636</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 696</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_validation_list</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">list_arr</span>) <span class="ruby-comment"># &quot;Any double quote characters in the value should be escaped with another double quote.</span> <span class="ruby-comment"># If the value does not contain a comma, newline or double quote, then the String value should be returned unchanged.</span> <span class="ruby-comment"># If the value contains a comma, newline or double quote, then the String value should be returned enclosed in double quotes.&quot;</span> <span class="ruby-identifier">expr</span> = <span class="ruby-string">&#39;&quot;&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">list_arr</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">str</span><span class="ruby-operator">|</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&quot;&quot;&#39;</span>)}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;,&#39;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&#39;&quot;&#39;</span> @@ -312,39 +204,27 @@ <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">DataValidation</span>.<span class="ruby-identifier">new</span>({<span class="ruby-value">:sqref</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ref</span>), <span class="ruby-value">:formula1</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Formula</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:expression</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">expr</span>), <span class="ruby-value">:type</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;list&#39;</span>}) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_alignment</span><span class="method-args">(column_index, &amp;block)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 611</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 671</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_alignment</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">get_range</span>(<span class="ruby-identifier">column_index</span>).<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_alignment</span>(<span class="ruby-identifier">get_col_style</span>(<span class="ruby-identifier">column_index</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) @@ -357,75 +237,51 @@ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_alignment</span>(<span class="ruby-identifier">c</span>.<span class="ruby-identifier">style_index</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_bold" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_bold</span><span class="method-args">(column_index, bolded = false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_bold-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 542</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 602</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_bold</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">bolded</span> = <span class="ruby-keyword">false</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_bold</span>(<span class="ruby-identifier">bolded</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">BOLD</span>, <span class="ruby-identifier">bolded</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_border" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_border</span><span class="method-args">(column_index, direction, weight)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_border-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 571</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 631</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_border</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">get_range</span>(<span class="ruby-identifier">column_index</span>).<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_border</span>(<span class="ruby-identifier">get_col_style</span>(<span class="ruby-identifier">column_index</span>), <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) @@ -436,39 +292,27 @@ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_border</span>(<span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_border_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_border_color</span><span class="method-args">(column_index, direction, color)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_border_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 585</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 645</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_border_color</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">color</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">color</span>) @@ -478,39 +322,27 @@ <span class="ruby-identifier">c</span> = <span class="ruby-identifier">row</span>.<span class="ruby-identifier">cells</span>[<span class="ruby-identifier">column_index</span>] <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_border_color</span>(<span class="ruby-identifier">direction</span>, <span class="ruby-identifier">color</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_fill" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_fill</span><span class="method-args">(column_index, color_code = &#39;ffffff&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_fill-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 337</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 397</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_fill</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">color_code</span> = <span class="ruby-string">&#39;ffffff&#39;</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">color_code</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) @@ -522,39 +354,27 @@ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_fill</span>(<span class="ruby-identifier">color_code</span>) } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_font" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_font</span><span class="method-args">(column_index, change_type, arg, font, xf)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Helper method to update the fonts and cell styles array main method to change font, called from each separate font mutator method</p> - - - <div class="method-source-code" id="change_column_font-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 499</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 559</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">change_type</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">register_new_font</span>(<span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) @@ -564,393 +384,261 @@ <span class="ruby-identifier">c</span> = <span class="ruby-identifier">row</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>[<span class="ruby-identifier">column_index</span>] <span class="ruby-identifier">c</span>.<span class="ruby-identifier">font_switch</span>(<span class="ruby-identifier">change_type</span>, <span class="ruby-identifier">arg</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_font_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_font_color</span><span class="method-args">(column_index, font_color=&#39;000000&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_font_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 526</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 586</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_font_color</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">font_color</span>=<span class="ruby-string">&#39;000000&#39;</span>) <span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">font_color</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_rgb_color</span>(<span class="ruby-identifier">font_color</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">COLOR</span>, <span class="ruby-identifier">font_color</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_font_name" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_font_name</span><span class="method-args">(column_index = 0, font_name = &#39;Verdana&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_font_name-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 512</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 572</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_font_name</span>(<span class="ruby-identifier">column_index</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">font_name</span> = <span class="ruby-string">&#39;Verdana&#39;</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_name</span>(<span class="ruby-identifier">font_name</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">NAME</span>, <span class="ruby-identifier">font_name</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_font_size" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_font_size</span><span class="method-args">(column_index, font_size=10)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_font_size-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 519</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 579</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_font_size</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">font_size</span>=<span class="ruby-value">10</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_size</span>(<span class="ruby-identifier">font_size</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">SIZE</span>, <span class="ruby-identifier">font_size</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_horizontal_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_horizontal_alignment</span><span class="method-args">(column_index, alignment = &#39;center&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_horizontal_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 563</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 623</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_horizontal_alignment</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">alignment</span> = <span class="ruby-string">&#39;center&#39;</span>) <span class="ruby-identifier">change_column_alignment</span>(<span class="ruby-identifier">column_index</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">horizontal</span> = <span class="ruby-identifier">alignment</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_italics" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_italics</span><span class="method-args">(column_index, italicized = false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_italics-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 535</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 595</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_italics</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">italicized</span> = <span class="ruby-keyword">false</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_italic</span>(<span class="ruby-identifier">italicized</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">ITALICS</span>, <span class="ruby-identifier">italicized</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_strikethrough" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_strikethrough</span><span class="method-args">(column_index, struckthrough=false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_strikethrough-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 556</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 616</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_strikethrough</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">struckthrough</span>=<span class="ruby-keyword">false</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_strikethrough</span>(<span class="ruby-identifier">struckthrough</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">STRIKETHROUGH</span>, <span class="ruby-identifier">struckthrough</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_underline" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_underline</span><span class="method-args">(column_index, underlined = false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_underline-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 549</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 609</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_underline</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">underlined</span> = <span class="ruby-keyword">false</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">font</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">font_id</span>].<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_underline</span>(<span class="ruby-identifier">underlined</span>) <span class="ruby-identifier">change_column_font</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">UNDERLINE</span>, <span class="ruby-identifier">underlined</span>, <span class="ruby-identifier">font</span>, <span class="ruby-identifier">xf</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_vertical_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_vertical_alignment</span><span class="method-args">(column_index, alignment = &#39;center&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_column_vertical_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 567</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 627</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_vertical_alignment</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">alignment</span> = <span class="ruby-string">&#39;center&#39;</span>) <span class="ruby-identifier">change_column_alignment</span>(<span class="ruby-identifier">column_index</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">vertical</span> = <span class="ruby-identifier">alignment</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_width" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_width</span><span class="method-args">(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Get column width measured in number of digits, as per <a href="http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column%28v=office.14%29.aspx">msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column%28v=office.14%29.aspx</a></p> - - - <div class="method-source-code" id="change_column_width-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 320</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 380</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_width</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">width_in_chars</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">ColumnRange</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_WIDTH</span>) <span class="ruby-identifier">change_column_width_raw</span>(<span class="ruby-identifier">column_index</span>, ((<span class="ruby-identifier">width_in_chars</span> <span class="ruby-operator">+</span> (<span class="ruby-value">5.0</span> <span class="ruby-operator">/</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Font</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_DIGIT_WIDTH</span>)) <span class="ruby-operator">*</span> <span class="ruby-value">256</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-value">256.0</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_column_width_raw" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_column_width_raw</span><span class="method-args">(column_index, width)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Set raw column width value</p> - - - <div class="method-source-code" id="change_column_width_raw-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 310</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 370</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_column_width_raw</span>(<span class="ruby-identifier">column_index</span>, <span class="ruby-identifier">width</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">get_range</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span>.<span class="ruby-identifier">width</span> = <span class="ruby-identifier">width</span> <span class="ruby-identifier">range</span>.<span class="ruby-identifier">custom_width</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_alignment</span><span class="method-args">(row, &amp;block)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 598</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 658</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_alignment</span>(<span class="ruby-identifier">row</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) @@ -960,75 +648,51 @@ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_alignment</span>(<span class="ruby-identifier">c</span>.<span class="ruby-identifier">style_index</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_bold" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_bold</span><span class="method-args">(row = 0, bolded = false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_bold-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 467</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 527</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_bold</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">bolded</span> = <span class="ruby-keyword">false</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_bold</span>(<span class="ruby-identifier">bolded</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">BOLD</span>, <span class="ruby-identifier">bolded</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_border" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_border</span><span class="method-args">(row, direction, weight)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_border-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 393</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 453</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_border</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row</span>].<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_border</span>(<span class="ruby-identifier">get_row_style</span>(<span class="ruby-identifier">row</span>), <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) @@ -1036,39 +700,27 @@ <span class="ruby-identifier">sheet_data</span>[<span class="ruby-identifier">row</span>].<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_border</span>(<span class="ruby-identifier">direction</span>, <span class="ruby-identifier">weight</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_border_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_border_color</span><span class="method-args">(row, direction, color = &#39;000000&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_border_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 404</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 464</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_border_color</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">direction</span>, <span class="ruby-identifier">color</span> = <span class="ruby-string">&#39;000000&#39;</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">color</span>) @@ -1077,474 +729,318 @@ <span class="ruby-identifier">sheet_data</span>[<span class="ruby-identifier">row</span>].<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_border_color</span>(<span class="ruby-identifier">direction</span>, <span class="ruby-identifier">color</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_fill" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_fill</span><span class="method-args">(row_index = 0, rgb = &#39;ffffff&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_fill-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 416</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 476</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_fill</span>(<span class="ruby-identifier">row_index</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">rgb</span> = <span class="ruby-string">&#39;ffffff&#39;</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row_index</span>) <span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">rgb</span>) <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_index</span>].<span class="ruby-identifier">style_index</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">modify_fill</span>(<span class="ruby-identifier">get_row_style</span>(<span class="ruby-identifier">row_index</span>), <span class="ruby-identifier">rgb</span>) <span class="ruby-identifier">sheet_data</span>[<span class="ruby-identifier">row_index</span>].<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">change_fill</span>(<span class="ruby-identifier">rgb</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_font" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_font</span><span class="method-args">(row_index, change_type, arg, font)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Helper method to update the row styles array change_type - <a href="WorksheetConvenienceMethods.html#NAME"><code>NAME</code></a> or <a href="WorksheetConvenienceMethods.html#SIZE"><code>SIZE</code></a> or <a href="WorksheetConvenienceMethods.html#COLOR"><code>COLOR</code></a> etc main method to change font, called from each separate font mutator method</p> - - - <div class="method-source-code" id="change_row_font-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 428</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 488</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_font</span>(<span class="ruby-identifier">row_index</span>, <span class="ruby-identifier">change_type</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">font</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row_index</span>) <span class="ruby-identifier">xf</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">register_new_font</span>(<span class="ruby-identifier">font</span>, <span class="ruby-identifier">get_row_xf</span>(<span class="ruby-identifier">row_index</span>)) <span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>[<span class="ruby-identifier">row_index</span>] <span class="ruby-identifier">row</span>.<span class="ruby-identifier">style_index</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">register_new_xf</span>(<span class="ruby-identifier">xf</span>) <span class="ruby-identifier">row</span>.<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">font_switch</span>(<span class="ruby-identifier">change_type</span>, <span class="ruby-identifier">arg</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_font_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_font_color</span><span class="method-args">(row = 0, font_color = &#39;000000&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_font_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 452</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 512</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_font_color</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">font_color</span> = <span class="ruby-string">&#39;000000&#39;</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-constant">Color</span>.<span class="ruby-identifier">validate_color</span>(<span class="ruby-identifier">font_color</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_rgb_color</span>(<span class="ruby-identifier">font_color</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">COLOR</span>, <span class="ruby-identifier">font_color</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_font_name" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_font_name</span><span class="method-args">(row = 0, font_name = &#39;Verdana&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_font_name-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 438</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 498</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_font_name</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">font_name</span> = <span class="ruby-string">&#39;Verdana&#39;</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_name</span>(<span class="ruby-identifier">font_name</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">NAME</span>, <span class="ruby-identifier">font_name</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_font_size" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_font_size</span><span class="method-args">(row = 0, font_size=10)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_font_size-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 445</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 505</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_font_size</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">font_size</span>=<span class="ruby-value">10</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_size</span>(<span class="ruby-identifier">font_size</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">SIZE</span>, <span class="ruby-identifier">font_size</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_height" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_height</span><span class="method-args">(row = 0, height = 10)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_height-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 488</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 548</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_height</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">height</span> = <span class="ruby-value">10</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">c</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row</span>] <span class="ruby-identifier">c</span>.<span class="ruby-identifier">ht</span> = <span class="ruby-identifier">height</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">custom_height</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_horizontal_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_horizontal_alignment</span><span class="method-args">(row = 0, alignment = &#39;center&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_horizontal_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 381</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 441</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_horizontal_alignment</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">alignment</span> = <span class="ruby-string">&#39;center&#39;</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">change_row_alignment</span>(<span class="ruby-identifier">row</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">horizontal</span> = <span class="ruby-identifier">alignment</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_italics" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_italics</span><span class="method-args">(row = 0, italicized = false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_italics-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 460</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 520</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_italics</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">italicized</span> = <span class="ruby-keyword">false</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_italic</span>(<span class="ruby-identifier">italicized</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">ITALICS</span>, <span class="ruby-identifier">italicized</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_strikethrough" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_strikethrough</span><span class="method-args">(row = 0, struckthrough=false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_strikethrough-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 481</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 541</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_strikethrough</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">struckthrough</span>=<span class="ruby-keyword">false</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_strikethrough</span>(<span class="ruby-identifier">struckthrough</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">STRIKETHROUGH</span>, <span class="ruby-identifier">struckthrough</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_underline" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_underline</span><span class="method-args">(row = 0, underlined=false)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_underline-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 474</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 534</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_underline</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">underlined</span>=<span class="ruby-keyword">false</span>) <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">dup</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">set_underline</span>(<span class="ruby-identifier">underlined</span>) <span class="ruby-identifier">change_row_font</span>(<span class="ruby-identifier">row</span>, <span class="ruby-constant">Worksheet</span><span class="ruby-operator">::</span><span class="ruby-constant">UNDERLINE</span>, <span class="ruby-identifier">underlined</span>, <span class="ruby-identifier">font</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-change_row_vertical_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">change_row_vertical_alignment</span><span class="method-args">(row = 0, alignment = &#39;center&#39;)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="change_row_vertical_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 387</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 447</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_row_vertical_alignment</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">alignment</span> = <span class="ruby-string">&#39;center&#39;</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">change_row_alignment</span>(<span class="ruby-identifier">row</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">vertical</span> = <span class="ruby-identifier">alignment</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-column_font" class="method-detail "> - <div class="method-heading"> <span class="method-name">column_font</span><span class="method-args">(col)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="column_font-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 368</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 428</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">fonts</span>[<span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">cell_xfs</span>[<span class="ruby-identifier">get_cols_style_index</span>(<span class="ruby-identifier">col</span>)].<span class="ruby-identifier">font_id</span>] <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-delete_cell" class="method-detail "> - <div class="method-heading"> <span class="method-name">delete_cell</span><span class="method-args">(row_index = 0, column_index=0, shift=nil)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>by default, only sets cell to nil if :left is specified, method will shift row contents to the right of the deleted cell to the left if :up is specified, method will shift column contents below the deleted cell upward</p> - - - <div class="method-source-code" id="delete_cell-source"> <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 41</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_cell</span>(<span class="ruby-identifier">row_index</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">shift</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row_index</span>) @@ -1574,39 +1070,27 @@ <span class="ruby-keyword">end</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">old_cell</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-delete_column" class="method-detail "> - <div class="method-heading"> <span class="method-name">delete_column</span><span class="method-args">(column_index = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="delete_column-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 158</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 202</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_column</span>(<span class="ruby-identifier">column_index</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-comment"># Delete column</span> @@ -1619,41 +1103,45 @@ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">column</span> = <span class="ruby-identifier">ci</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Cell</span>) } } <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">range</span><span class="ruby-operator">|</span> <span class="ruby-identifier">range</span>.<span class="ruby-identifier">delete_column</span>(<span class="ruby-identifier">column_index</span>) } + + <span class="ruby-comment"># Update row number of merged cells</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCells</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">column_index</span><span class="ruby-operator">..</span><span class="ruby-identifier">column_index</span>) } + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> + <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">column_index</span> + + <span class="ruby-identifier">in_merged_cell</span> = <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">column_index</span> + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>( + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">in_merged_cell</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>), + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, + ) + } + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">single_cell?</span> } <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-delete_row" class="method-detail "> - <div class="method-heading"> <span class="method-name">delete_row</span><span class="method-args">(row_index=0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="delete_row-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 112</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 126</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_row</span>(<span class="ruby-identifier">row_index</span>=<span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row_index</span>) <span class="ruby-identifier">deleted</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">row_index</span>) @@ -1662,431 +1150,303 @@ <span class="ruby-identifier">row_index</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span> <span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>[<span class="ruby-identifier">index</span>] <span class="ruby-identifier">row</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">row</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">nil?</span> } } + <span class="ruby-comment"># Update row number of merged cells</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCells</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">row_index</span><span class="ruby-operator">..</span><span class="ruby-identifier">row_index</span>) } + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> + <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">row_index</span> + + <span class="ruby-identifier">in_merged_cell</span> = <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">row_index</span> + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>( + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">in_merged_cell</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>), + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">first</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span>, + ) + } + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">single_cell?</span> } + <span class="ruby-keyword">return</span> <span class="ruby-identifier">deleted</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_col_style" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_col_style</span><span class="method-args">(column_index)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Helper method to get the style index for a column</p> - - - <div class="method-source-code" id="get_col_style-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 325</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 385</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_col_style</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">locate_range</span>(<span class="ruby-identifier">column_index</span>) (<span class="ruby-identifier">range</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">range</span>.<span class="ruby-identifier">style_index</span>) <span class="ruby-operator">||</span> <span class="ruby-value">0</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_cols_style_index" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_cols_style_index</span><span class="method-args">(column_index)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_cols_style_index-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 251</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 311</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_cols_style_index</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">locate_range</span>(<span class="ruby-identifier">column_index</span>) (<span class="ruby-identifier">range</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">range</span>.<span class="ruby-identifier">style_index</span>) <span class="ruby-operator">||</span> <span class="ruby-value">0</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_alignment</span><span class="method-args">(col, type)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 374</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 434</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_alignment</span>(<span class="ruby-identifier">col</span>, <span class="ruby-identifier">type</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">xf</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">cell_xfs</span>[<span class="ruby-identifier">get_cols_style_index</span>(<span class="ruby-identifier">col</span>)] <span class="ruby-identifier">xf</span>.<span class="ruby-identifier">alignment</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">xf</span>.<span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">type</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_border" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_border</span><span class="method-args">(col, border_direction)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_border-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 352</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 412</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_border</span>(<span class="ruby-identifier">col</span>, <span class="ruby-identifier">border_direction</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">xf</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">cell_xfs</span>[<span class="ruby-identifier">get_cols_style_index</span>(<span class="ruby-identifier">col</span>)] <span class="ruby-identifier">border</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">borders</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">border_id</span>] <span class="ruby-identifier">border</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">border</span>.<span class="ruby-identifier">get_edge_style</span>(<span class="ruby-identifier">border_direction</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_border_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_border_color</span><span class="method-args">(col, border_direction)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_border_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 360</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 420</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_border_color</span>(<span class="ruby-identifier">col</span>, <span class="ruby-identifier">border_direction</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">xf</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">cell_xfs</span>[<span class="ruby-identifier">get_cols_style_index</span>(<span class="ruby-identifier">col</span>)] <span class="ruby-identifier">border</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">borders</span>[<span class="ruby-identifier">xf</span>.<span class="ruby-identifier">border_id</span>] <span class="ruby-identifier">border</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">border</span>.<span class="ruby-identifier">get_edge_color</span>(<span class="ruby-identifier">border_direction</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_fill" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_fill</span><span class="method-args">(col=0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_fill-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 330</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 390</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_fill</span>(<span class="ruby-identifier">col</span>=<span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">col</span>) <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">get_fill_color</span>(<span class="ruby-identifier">get_col_xf</span>(<span class="ruby-identifier">col</span>)) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_font_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_font_color</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_font_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 267</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 327</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_font_color</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">font</span>.<span class="ruby-identifier">get_rgb_color</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;000000&#39;</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_font_name" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_font_name</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_font_name-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 257</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 317</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_font_name</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">get_name</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_font_size" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_font_size</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_column_font_size-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 262</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 322</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_font_size</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">get_size</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_width" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_width</span><span class="method-args">(column_index = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Get column width measured in number of digits, as per <a href="http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column%28v=office.14%29.aspx">msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column%28v=office.14%29.aspx</a></p> - - - <div class="method-source-code" id="get_column_width-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 303</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 363</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_width</span>(<span class="ruby-identifier">column_index</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">width</span> = <span class="ruby-identifier">get_column_width_raw</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-keyword">return</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">ColumnRange</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_WIDTH</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">width</span>.<span class="ruby-identifier">nil?</span> (<span class="ruby-identifier">width</span> <span class="ruby-operator">-</span> (<span class="ruby-value">5.0</span> <span class="ruby-operator">/</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Font</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_DIGIT_WIDTH</span>)).<span class="ruby-identifier">round</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_column_width_raw" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_column_width_raw</span><span class="method-args">(column_index = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Get raw column width value as stored in the file</p> - - - <div class="method-source-code" id="get_column_width_raw-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 293</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 353</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_column_width_raw</span>(<span class="ruby-identifier">column_index</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">locate_range</span>(<span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">range</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">range</span>.<span class="ruby-identifier">width</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_alignment" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_alignment</span><span class="method-args">(row, is_horizontal)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_alignment-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 240</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 300</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_alignment</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">is_horizontal</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">xf_obj</span> = <span class="ruby-identifier">get_row_xf</span>(<span class="ruby-identifier">row</span>) <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">xf_obj</span>.<span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">nil?</span> @@ -2094,313 +1454,205 @@ <span class="ruby-keyword">if</span> <span class="ruby-identifier">is_horizontal</span> <span class="ruby-keyword">then</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">xf_obj</span>.<span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">horizontal</span> <span class="ruby-keyword">else</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">xf_obj</span>.<span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">vertical</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_border" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_border</span><span class="method-args">(row, border_direction)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_border-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 222</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 282</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_border</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">border_direction</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">border</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">borders</span>[<span class="ruby-identifier">get_row_xf</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">border_id</span>] <span class="ruby-identifier">border</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">border</span>.<span class="ruby-identifier">get_edge_style</span>(<span class="ruby-identifier">border_direction</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_border_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_border_color</span><span class="method-args">(row, border_direction)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_border_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 229</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 289</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_border_color</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">border_direction</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">border</span> = <span class="ruby-ivar">@workbook</span>.<span class="ruby-identifier">borders</span>[<span class="ruby-identifier">get_row_xf</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">border_id</span>] <span class="ruby-identifier">border</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">border</span>.<span class="ruby-identifier">get_edge_color</span>(<span class="ruby-identifier">border_direction</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_fill" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_fill</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_fill-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 181</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 241</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_fill</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">get_fill_color</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_font_color" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_font_color</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_font_color-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 193</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 253</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_font_color</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">color</span> = <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">color</span> <span class="ruby-identifier">color</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">rgb</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;000000&#39;</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_font_name" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_font_name</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_font_name-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 185</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 245</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_font_name</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">get_name</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_font_size" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_font_size</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_font_size-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 189</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 249</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_font_size</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">get_size</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_height" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_height</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_height-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 215</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 275</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_height</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">validate_nonnegative</span>(<span class="ruby-identifier">row</span>) <span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row</span>] <span class="ruby-identifier">row</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">ht</span> <span class="ruby-operator">||</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Row</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_HEIGHT</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-get_row_style" class="method-detail "> - <div class="method-heading"> <span class="method-name">get_row_style</span><span class="method-args">(row_index)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="get_row_style-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 176</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 236</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_row_style</span>(<span class="ruby-identifier">row_index</span>) <span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_index</span>] (<span class="ruby-identifier">row</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">style_index</span>) <span class="ruby-operator">||</span> <span class="ruby-value">0</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-insert_cell" class="method-detail "> - <div class="method-heading"> <span class="method-name">insert_cell</span><span class="method-args">(row = 0, col = 0, data = nil, formula = nil, shift = nil)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="insert_cell-source"> <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 12</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_cell</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">formula</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">shift</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">col</span>) @@ -2425,39 +1677,27 @@ <span class="ruby-keyword">end</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">add_cell</span>(<span class="ruby-identifier">row</span>, <span class="ruby-identifier">col</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">formula</span>) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-insert_column" class="method-detail "> - <div class="method-heading"> <span class="method-name">insert_column</span><span class="method-args">(column_index = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Inserts column at <code>column_index</code>, pushes everything right, takes styles from column to left NOTE: use of this method will break formulas which reference cells which are being “pushed right”</p> - - - <div class="method-source-code" id="insert_column-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 129</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 159</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_column</span>(<span class="ruby-identifier">column_index</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">column_index</span>) <span class="ruby-identifier">old_range</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">get_range</span>(<span class="ruby-identifier">column_index</span>) @@ -2480,40 +1720,42 @@ <span class="ruby-identifier">row</span>.<span class="ruby-identifier">insert_cell_shift_right</span>(<span class="ruby-identifier">c</span>, <span class="ruby-identifier">column_index</span>) } <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">insert_column</span>(<span class="ruby-identifier">column_index</span>) + <span class="ruby-comment"># Update merged cells for all rows below</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCells</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> + <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">column_index</span> + + <span class="ruby-identifier">in_merged_cell</span> = <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">column_index</span> + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>( + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">in_merged_cell</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>), + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, + ) + } + <span class="ruby-comment"># TODO: update column numbers</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-insert_row" class="method-detail "> - <div class="method-heading"> <span class="method-name">insert_row</span><span class="method-args">(row_index = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Inserts row at row_index, pushes down, copies style from the row above (that&#39;s what Excel 2013 does!) NOTE: use of this method will break formulas which reference cells which are being “pushed down”</p> - - - <div class="method-source-code" id="insert_row-source"> <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 74</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_row</span>(<span class="ruby-identifier">row_index</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-identifier">ensure_cell_exists</span>(<span class="ruby-identifier">row_index</span>) @@ -2547,368 +1789,257 @@ <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">cell</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">cell</span>.<span class="ruby-identifier">r</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">r</span>, <span class="ruby-identifier">c</span>) } } + <span class="ruby-comment"># Update merged cells for all rows below</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCells</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">merged_cells</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mc</span><span class="ruby-operator">|</span> + <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">row_index</span> + + <span class="ruby-identifier">in_merged_cell</span> = <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">row_index</span> + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>( + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">in_merged_cell</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>), + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">row_range</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">first</span>, + <span class="ruby-identifier">mc</span>.<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">col_range</span>.<span class="ruby-identifier">last</span>, + ) + } + <span class="ruby-keyword">return</span> <span class="ruby-identifier">new_row</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_column_bolded" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_column_bolded</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_column_bolded-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 277</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 337</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_column_bolded</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_bold</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_column_italicized" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_column_italicized</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_column_italicized-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 272</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 332</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_column_italicized</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_italic</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_column_struckthrough" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_column_struckthrough</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_column_struckthrough-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 287</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 347</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_column_struckthrough</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_strikethrough</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_column_underlined" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_column_underlined</span><span class="method-args">(col = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_column_underlined-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 282</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 342</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_column_underlined</span>(<span class="ruby-identifier">col</span> = <span class="ruby-value">0</span>) <span class="ruby-identifier">font</span> = <span class="ruby-identifier">column_font</span>(<span class="ruby-identifier">col</span>) <span class="ruby-identifier">font</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_underlined</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_row_bolded" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_row_bolded</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_row_bolded-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 203</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 263</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_row_bolded</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_bold</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_row_italicized" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_row_italicized</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_row_italicized-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 199</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 259</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_row_italicized</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_italic</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_row_struckthrough" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_row_struckthrough</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_row_struckthrough-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 211</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 271</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_row_struckthrough</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_strikethrough</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-is_row_underlined" class="method-detail "> - <div class="method-heading"> <span class="method-name">is_row_underlined</span><span class="method-args">(row = 0)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="is_row_underlined-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 207</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 267</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_row_underlined</span>(<span class="ruby-identifier">row</span> = <span class="ruby-value">0</span>) (<span class="ruby-identifier">font</span> = <span class="ruby-identifier">row_font</span>(<span class="ruby-identifier">row</span>)) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">font</span>.<span class="ruby-identifier">is_underlined</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-merge_cells" class="method-detail "> - <div class="method-heading"> <span class="method-name">merge_cells</span><span class="method-args">(start_row, start_col, end_row, end_col)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - <p>Merges cells within a rectangular area</p> - - - <div class="method-source-code" id="merge_cells-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 628</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 688</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">merge_cells</span>(<span class="ruby-identifier">start_row</span>, <span class="ruby-identifier">start_col</span>, <span class="ruby-identifier">end_row</span>, <span class="ruby-identifier">end_col</span>) <span class="ruby-identifier">validate_workbook</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCells</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># TODO: add validation to make sure ranges are not intersecting with existing ones</span> <span class="ruby-identifier">merged_cells</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">MergedCell</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:ref</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">start_row</span>, <span class="ruby-identifier">end_row</span>, <span class="ruby-identifier">start_col</span>, <span class="ruby-identifier">end_col</span>)) <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - <div id="method-i-row_font" class="method-detail "> - <div class="method-heading"> <span class="method-name">row_font</span><span class="method-args">(row)</span> - <span class="method-click-advice">click to toggle source</span> - </div> - <div class="method-description"> - - - - <div class="method-source-code" id="row_font-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 236</span> + <pre><span class="ruby-comment"># File lib/rubyXL/convenience_methods/worksheet.rb, line 296</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">row_font</span>(<span class="ruby-identifier">row</span>) (<span class="ruby-identifier">row</span> = <span class="ruby-identifier">sheet_data</span>.<span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">get_font</span> <span class="ruby-keyword">end</span></pre> </div> - </div> - - </div> - </section> - - </section> + </section> </main> <footer id="validator-badges" role="contentinfo"> <p><a href="https://validator.w3.org/check/referer">Validate</a> - <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1. + <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.0. <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. </footer>