From 4d16bfc43780e5d3f7368625700b583e3e98217a Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 27 Nov 2011 18:11:42 +0900 Subject: adding in row_style and col_style methods to worksheet and active record 'acts_as_axlsx' to provide to_xlsx. --- doc/Axlsx/Row.html | 228 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 161 insertions(+), 67 deletions(-) (limited to 'doc/Axlsx/Row.html') diff --git a/doc/Axlsx/Row.html b/doc/Axlsx/Row.html index 84687f5e..ecd9a49a 100644 --- a/doc/Axlsx/Row.html +++ b/doc/Axlsx/Row.html @@ -97,13 +97,15 @@
Note: -
-

The recommended way to manage rows and cells is to use Worksheet#add_row

+

+The recommended way to manage rows and cells is to use Worksheet#add_row +

- -

A Row is a single row in a worksheet.

+

+A Row is a single row in a worksheet. +

@@ -142,8 +144,9 @@ -
-

The cells this row holds.

+

+The cells this row holds. +

@@ -168,8 +171,9 @@ -
-

The worksheet this row belongs to.

+

+The worksheet this row belongs to. +

@@ -204,9 +208,10 @@ -
-

Adds a singel sell to the row based on the data provided and updates the -worksheet's autofit data.

+

+Adds a singel sell to the row based on the data provided and updates the +worksheet’s autofit data. +

@@ -228,8 +233,9 @@ worksheet's autofit data.

-
-

The index of this row in the worksheet.

+

+The index of this row in the worksheet. +

@@ -253,8 +259,33 @@ worksheet's autofit data.

-
-

Creates a new row.

+

+Creates a new row. +

+
+ + + + +
  • + + + - (Object) style=(style) + + + + + + + + + + + + +

    +sets the style for every cell in this row. +

  • @@ -276,8 +307,9 @@ worksheet's autofit data.

    -
    -

    Serializes the row.

    +

    +Serializes the row. +

    @@ -298,17 +330,19 @@ worksheet's autofit data.

    - -

    Creates a new row. New Cell objects are created based on the values, types +

    +Creates a new row. New Cell objects are created based on the values, types and style options. A new cell is created for each item in the values array. -style and types options are applied as follows:

    - -
    If the types option is defined and is a symbol it is applied to all the cells created.
    -If the types option is an array, cell types are applied by index for each cell
    -If the types option is not set, the cell will automatically determine its type.
    -If the style option is defined and is an Integer, it is applied to all cells created.
    -If the style option is an array, style is applied by index for each cell.
    -If the style option is not defined, the default style (0) is applied to each cell.
    +style and types options are applied as follows: +

    +
    +  If the types option is defined and is a symbol it is applied to all the cells created.
    +  If the types option is an array, cell types are applied by index for each cell
    +  If the types option is not set, the cell will automatically determine its type.
    +  If the style option is defined and is an Integer, it is applied to all cells created.
    +  If the style option is an array, style is applied by index for each cell.
    +  If the style option is not defined, the default style (0) is applied to each cell.
    +
    @@ -340,8 +374,9 @@ If the style option is not defined, the default style (0) is applied to each cel — -
    -

    a customizable set of options

    +

    +a customizable set of options +

    @@ -414,12 +449,13 @@ If the style option is not defined, the default style (0) is applied to each cel
    # File 'lib/axlsx/workbook/worksheet/row.rb', line 29
     
    -def initialize(worksheet, values=[], options={})
    -  self.worksheet = worksheet
    -  @cells = SimpleTypedList.new Cell
    -  @worksheet.rows << self
    -  array_to_cells(values, options)
    -end
    +def initialize(worksheet, values=[], options={}) + self.worksheet = worksheet + @cells = SimpleTypedList.new Cell + @worksheet.rows << self + array_to_cells(values, options) +end + @@ -442,8 +478,9 @@ If the style option is not defined, the default style (0) is applied to each cel

    - -

    The cells this row holds

    +

    +The cells this row holds +

    @@ -477,9 +514,10 @@ If the style option is not defined, the default style (0) is applied to each cel
    # File 'lib/axlsx/workbook/worksheet/row.rb', line 13
     
    -def cells
    -  @cells
    -end
    +def cells + @cells +end + @@ -497,8 +535,9 @@ If the style option is not defined, the default style (0) is applied to each cel

    - -

    The worksheet this row belongs to

    +

    +The worksheet this row belongs to +

    @@ -532,9 +571,10 @@ If the style option is not defined, the default style (0) is applied to each cel
    # File 'lib/axlsx/workbook/worksheet/row.rb', line 9
     
    -def worksheet
    -  @worksheet
    -end
    +def worksheet + @worksheet +end + @@ -556,9 +596,10 @@ If the style option is not defined, the default style (0) is applied to each cel

    - -

    Adds a singel sell to the row based on the data provided and updates the -worksheet's autofit data.

    +

    +Adds a singel sell to the row based on the data provided and updates the +worksheet’s autofit data. +

    @@ -594,11 +635,12 @@ worksheet's autofit data.

    # File 'lib/axlsx/workbook/worksheet/row.rb', line 51
     
    -def add_cell(value="", options={})
    -  c = Cell.new(self, value, options)
    -  update_auto_fit_data
    -  c
    -end
    +def add_cell(value="", options={}) + c = Cell.new(self, value, options) + update_auto_fit_data + c +end + @@ -613,8 +655,9 @@ worksheet's autofit data.

    - -

    The index of this row in the worksheet

    +

    +The index of this row in the worksheet +

    @@ -648,9 +691,57 @@ worksheet's autofit data.

    # File 'lib/axlsx/workbook/worksheet/row.rb', line 38
     
    -def index 
    -  worksheet.rows.index(self)
    -end
    +def index + worksheet.rows.index(self) +end + + + + +
    + +
    +

    + + - (Object) style=(style) + + + +

    +
    +

    +sets the style for every cell in this row +

    + + +
    +
    +
    + + +
    + + +
    +
    +
    +
    +58
    +59
    +60
    +61
    +62
    +63
    +
    +
    # File 'lib/axlsx/workbook/worksheet/row.rb', line 58
    +
    +def style=(style)
    +  cells.each_with_index do | cell, index |
    +    s = style.is_a?(Array) ? style[index] : style
    +    cell.style = s
    +  end
    +end
    +
    @@ -665,8 +756,9 @@ worksheet's autofit data.

    - -

    Serializes the row

    +

    +Serializes the row +

    @@ -685,8 +777,9 @@ worksheet's autofit data.

    — -
    -

    The document builder instance this objects xml will be added to.

    +

    +The document builder instance this objects xml will be added to. +

    @@ -720,9 +813,10 @@ worksheet's autofit data.

    # File 'lib/axlsx/workbook/worksheet/row.rb', line 45
     
    -def to_xml(xml)
    -  xml.row(:r => index+1) { @cells.each { |cell| cell.to_xml(xml) } }
    -end
    +def to_xml(xml) + xml.row(:r => index+1) { @cells.each { |cell| cell.to_xml(xml) } } +end + @@ -733,9 +827,9 @@ worksheet's autofit data.

    -- cgit v1.2.3