olympiamanagement/app/views/admin/olympiamanagements/_student_export.xlsx.axlsx

15 lines
730 B
Plaintext
Raw Normal View History

2020-02-05 07:37:10 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "school_class") do |sheet|
row = []
title = sheet.styles.add_style(:bg_color => "FFFF00",:border=>{ :style => :thin, :color => "666666" },:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true})
column = sheet.styles.add_style(:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true},:border=>{ :style => :thin, :color => "666666" })
@fields.each do |field|
row << t('olympiamanagement.'+field)
end
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round}
@student_data_list.each do |infos_row|
sheet.add_row infos_row , :style=> column , :types => :string
2020-02-05 07:37:10 +00:00
end
end