lib/write_xlsx/worksheet.rb in write_xlsx-0.85.7 vs lib/write_xlsx/worksheet.rb in write_xlsx-0.85.8

- old
+ new

@@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- +# frozen_string_literal: true require 'write_xlsx/package/xml_writer_simple' require 'write_xlsx/package/button' require 'write_xlsx/colors' require 'write_xlsx/format' require 'write_xlsx/drawing' @@ -2186,11 +2187,11 @@ # to Excel should fix this. # def write_number(*args) # Check for a cell reference in A1 notation and substitute row and column row, col, num, xf = row_col_notation(args) - raise WriteXLSXInsufficientArgumentError if [row, col, num].include?(nil) + raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || num.nil? # 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) @@ -2228,17 +2229,17 @@ # def write_string(*args) # Check for a cell reference in A1 notation and substitute row and column row, col, str, xf = row_col_notation(args) str &&= str.to_s - raise WriteXLSXInsufficientArgumentError if [row, col, str].include?(nil) + raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || str.nil? # 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) - index = shared_string_index(str[0, STR_MAX]) + index = shared_string_index(str.length > STR_MAX ? str[0, STR_MAX] : str) store_data_to_table(StringCellData.new(self, row, col, index, xf)) end # @@ -7508,11 +7509,11 @@ # # Add a string to the shared string table, if it isn't already there, and # return the string index. # - def shared_string_index(str, params = {}) #:nodoc: - @workbook.shared_string_index(str, params) + def shared_string_index(str) #:nodoc: + @workbook.shared_string_index(str) end # # convert_name_area(first_row, first_col, last_row, last_col) #