lib/axlsx/workbook/worksheet/row.rb in axlsx-1.0.9 vs lib/axlsx/workbook/worksheet/row.rb in axlsx-1.0.10a
- old
+ new
@@ -52,20 +52,35 @@
c = Cell.new(self, value, options)
update_auto_fit_data
c
end
+ # sets the style for every cell in this row
+ def style=(style)
+ cells.each_with_index do | cell, index |
+ s = style.is_a?(Array) ? style[index] : style
+ cell.style = s
+ end
+ end
+ # returns the cells in this row as an array
+ # This lets us transpose the rows into columns
+ # @return [Array]
+ def to_ary
+ @cells.to_ary
+ end
+
private
# assigns the owning worksheet for this row
def worksheet=(v) DataTypeValidator.validate "Row.worksheet", Worksheet, v; @worksheet=v; end
# Tell the worksheet to update autofit data for the columns based on this row's cells.
# @return [SimpleTypedList]
def update_auto_fit_data
worksheet.send(:update_auto_fit_data, self.cells)
end
+
# Converts values, types, and style options into cells and associates them with this row.
# A new cell is created for each item in the values array.
# If value option is defined and is a symbol it is applied to all the cells created.
# If the value option is an array, cell types are applied by index for each cell