You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/graduation_tasks/tasks_list.xlsx.axlsx

16 lines
725 B

6 years ago
wb = xlsx_package.workbook
wb.styles do |s|
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}
wb.add_worksheet(:name =>"学生成绩") do |sheet|
5 years ago
sheet.add_row table_columns,:height =>20, :style => blue_cell
6 years ago
sheet.column_info.first.width = 12
task_users.each do |user|
sheet.add_row user, :style => sz_all
end #each_widh_index
5 years ago
sheet.column_widths *([25]*sheet.column_info.count)
sheet.column_info.first.width = 12
6 years ago
end #add_worksheet
end