Roo gem:细胞背景颜色

时间:2015-04-30 01:01:33

标签: ruby roo-gem

我使用Roo ruby​​ gem来解析xlsx文件。

有没有办法获得细胞的背景颜色?我已经查看了代码,但无法找到如何操作。

使用roo打开电子表格非常简单:

spreadsheet = Roo::Excelx.new(file_path)
# Get me a sheet
sheet = spreadsheet.sheet("278")
# I happily thought excelx_format would return something that has
# to do with color, but it (sensibly) returns the cell format.
# In this case is GENERAL (no particular format)
puts sheet.excelx_format(6, 6)

1 个答案:

答案 0 :(得分:1)

我环顾四周,Roo似乎没有为自定义检查提供任何高级功能。

所以我改变了宝石。我现在正在使用spreadsheet

spreadsheet = Spreadsheet.open(file_path)
sheet = spreadsheet.worksheet("278")
row = sheet.row(5)
background_color = row.format(5).pattern_bg_color