ruby spreadsheet row background color

前端 未结 3 881
粉色の甜心
粉色の甜心 2021-01-18 09:53

I am trying to parse an excel spreadsheet using \"spreadsheet\". How could I get the background color of each row?

3条回答
  •  深忆病人
    2021-01-18 10:13

    I've just been trying to figure out the same, and seems like in the current version (0.6.5.9) of Spreadsheet gem the attribute of cell's background color is not supported in reader (you can only define background color in cells for writing).

    Here's how to check all currently available cell attributes:

    a = Spreadsheet.open('/folder/spreadsheet.xls')
    puts a.worksheets[0].row().format().inspect
    

    After some experimentation however I figured out that not all of them are properly extracted. The good news is that the developers promise to implement better support for cell formats in future versions, so we just need to be patient :)

提交回复
热议问题