dev_course
SylorHuang 5 years ago
parent 85eb3c79a5
commit 39eba6a7bb

@ -2,14 +2,14 @@
wb = xlsx_package.workbook wb = xlsx_package.workbook
# wb.use_autowidth = false # wb.use_autowidth = false
wb.styles do |s| wb.styles do |s|
sz_all = s.add_style :height => 20, :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :center} sz_all = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :center}
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :center} blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :center}
wb.add_worksheet(:name => "学生成绩") do |sheet| wb.add_worksheet(:name => "学生成绩") do |sheet|
sheet.sheet_view.show_grid_lines = false sheet.sheet_view.show_grid_lines = false
sheet.add_row table_columns, :style => blue_cell sheet.add_row table_columns, :style => blue_cell
if task_users.count > 0 if task_users.count > 0
task_users.each do |user| task_users.each do |user|
sheet.add_row user, :style => sz_all sheet.add_row user, :height => 20,:style => sz_all
end #each_widh_index end #each_widh_index
end end
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)

Loading…
Cancel
Save