lib/write_xlsx/worksheet.rb in write_xlsx-0.88.0 vs lib/write_xlsx/worksheet.rb in write_xlsx-0.89.0

- old
+ new

@@ -2528,23 +2528,43 @@ end end end # + # write_boolean(row, col, val, format) + # + # Write a boolean value to the specified row and column (zero indexed). + # + def write_boolean(*args) + row, col, val, xf = row_col_notation(args) + raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? + + val = val ? 1 : 0 # Boolean value. + # xf : cell format. + type = 'l' # The data type + + # Check that row and col are valid and store max and min values + check_dimensions(row, col) + store_row_col_max_min_values(row, col) + + store_data_to_table(BooleanCellData.new(self, row, col, val, xf)) + end + + # # :call-seq: # update_format_with_params(row, col, format_params) # # Update formatting of the cell to the specified row and column (zero indexed). # # worksheet.update_format_with_params(0, 0, color: 'red') # - # This method is used to update formatting of the cell keeping cell contents + # This method is used to update formatting of the cell keeping cell contents # and formatting. # - # If the cell doesn't have CellData object, this method create a CellData + # If the cell doesn't have CellData object, this method create a CellData # using write_blank method. - # If the cell has CellData, this method fetch contents and format of cell from + # If the cell has CellData, this method fetch contents and format of cell from # the CellData object and recreate CellData using write method. # def update_format_with_params(*args) row, col, params = row_col_notation(args) raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || params.nil? @@ -2588,11 +2608,11 @@ # # Update formatting of cells in range to the specified row and column (zero indexed). # # worksheet.update_range_format_with_params(0, 0, 3, 3, color: 'red') # - # This method is used to update formatting of multiple cells keeping cells' contents + # This method is used to update formatting of multiple cells keeping cells' contents # and formatting. # # def update_range_format_with_params(*args) row_first, col_first, row_last, col_last, params = row_col_notation(args) @@ -5811,14 +5831,14 @@ # Adjust start row for negative offsets. while y1 < 0 && row_start > 0 y1 += size_row(row_start - 1) row_start -= 1 end - + # Ensure that the image isn't shifted off the page at top left. x1 = 0 if x1 < 0 y1 = 0 if y1 < 0 - + # Calculate the absolute x offset of the top-left vertex. if @col_size_changed x_abs = (0 .. col_start-1).inject(0) {|sum, col| sum += size_col(col)} else # Optimisation for when the column widths haven't changed.