未定义的方法`merge_cells'RubyXL

时间:2019-06-21 15:23:11

标签: ruby

我正在使用rubyXL,当我尝试在工作表上调用merge_cells时

undefined method `merge_cells' for #<RubyXL::Worksheet:0x007fda50159bb8>

@workbook = RubyXL::Workbook.new
worksheet = @workbook[0]
worksheet.merge_cells(0, 0, 0, 1)

1 个答案:

答案 0 :(得分:1)

https://localhost/d/MKrV5BPmk/dashboardd1?orgId=1&var-ssl_Client=cLient-1&var-ssl_Client=Client-2&var-ssl_Client=Client&var-Client=All&var-Category=All&var-Environment=All&var-Env=All of require 'rubyXL/convenience_methods/worksheet' ,您需要:

require 'rubyXL/convenience_methods/worksheet'

@workbook = RubyXL::Workbook.new
worksheet = @workbook[0]
worksheet.merge_cells(0, 0, 0, 1)
# => [#<RubyXL::MergedCell:0x00007fe5b6ac5320 @local_namespaces=nil, @ref=#<RubyXL::Reference @row_range=0..0 @col_range=0..1>>]

您还可以在As of version 3.4.0中看到此内容,该方法以后称为the tests

这按预期工作:

getCurrentTime()