【问题标题】:I create the defined names but i need to know how to use it (caxlsx gem)我创建了定义的名称,但我需要知道如何使用它(caxlsx gem)
【发布时间】:2021-06-09 14:27:38
【问题描述】:

使用https://github.com/caxlsx/caxlsx gem,我尝试使用each_with_index 数组方法访问在迭代中动态创建的已定义名称,并为每个名称赋予“piece-0”、“piece-1”、“piece-”等名称3"...等。在文件上,名称已正确创建,但我需要公式来计算许多人按名称调用它们的总和。

she.add_row ["Total","",""] + ["--the sum of cells by name must be here--"]

我创建了名称,但我需要知道如何使用它们。

【问题讨论】:

    标签: ruby-on-rails ruby formula xlsx caxlsx


    【解决方案1】:

    解决了!

    解决方案是构建一个连接和引用单元格的字符串。

    类似的东西。

    build_string = ""
    cellposition = "10"
    cells.each do |cell|
      build_string = @alphabet_with_letters[position_that_i_want] + cellposition + ":"
      cellposition = cellposition.to_i
      cellposition += 1
      cellposition == cellposition.to_s
    end
    
    #then use this where you need to call it
    "=SUM(#{build_string.chop})"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-16
      • 2012-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-13
      • 1970-01-01
      相关资源
      最近更新 更多