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/ecs/ec_training_objectives/show.xlsx.axlsx

32 lines
1.3 KiB

training_objective = @training_objective
ec_year = training_objective.ec_year
major = ec_year.ec_major_school.ec_major
wb = xlsx_package.workbook
wb.styles do |style|
title_style = style.add_style(sz: 16, height: 20, b: true)
ec_year_style = style.add_style(sz: 10, height: 14)
label_style = style.add_style(sz: 11, b: true, bg_color: '90EE90', alignment: { horizontal: :center })
content_style = style.add_style(sz: 11, height: 16, border: { style: :thin, color: '000000' })
wb.add_worksheet(:name => '培养目标及目标分解') do |sheet|
sheet.add_row '培养目标及目标分解', style: title_style
sheet.add_row []
sheet.add_row []
sheet.add_row ['专业代码', major.code], style: ec_year_style
sheet.add_row ['专业名称', major.name], style: ec_year_style
sheet.add_row ['学年', "#{ec_year.year}学年"], style: ec_year_style
sheet.add_row []
sheet.add_row ['培养目标', training_objective.content], style: [label_style, content_style]
training_objective.ec_training_subitems.each do |item|
sheet.add_row ['目标分解', item.content], style: [label_style, content_style]
end
items_size = training_objective.ec_training_subitems.size
sheet.merge_cells("A9:A#{9 + items_size}")
end
end