# 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 end end