2

我想使用电子表格 gem 来设置我的 Excel 表格的样式。

我想让我的桌子在我的视图中看起来像这样:

这是我的格式化代码:

    header_format = Spreadsheet::Format.new :color => :black,
                               :weight => :bold,
                               :size => 10

文档: http ://spreadsheet.rubyforge.org/files/GUIDE_txt.html

我可以使用电子表格 gem还是只需要使用标准颜色?

4

1 回答 1

2

找到这篇文章 - http://andisxp.blogspot.com/2011/12/export-to-excel-with-spreadsheet-gem.html

  Instead of modifying the gem though, I would suggest using the following two 
  lines at   startup, they modify constants which isn't very nice but maybe 
  preferable to modifying the gem just to get some color working.

  Spreadsheet::Excel::Internals::SEDOC_ROLOC.update(:blue_gray => 0x001f)
  Spreadsheet::Column.singleton_class::COLORS << :blue_gray
于 2012-10-17T12:39:24.753 回答