academic_advising/app/views/admin/academic_advisings/download_excel.xlsx.axlsx

49 lines
1.3 KiB
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
@data.each_with_index do |role,idx|
data = role["data"]
wb.add_worksheet(name: role["name"] + "-" + idx.to_s) do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
row = ["Name"]
@site_in_use_locales.each do |locale|
row << t("academic_advising.award_name") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("academic_advising.awarding_unit") + " - " + t(locale.to_s)
end
row << t("academic_advising.year")
row << t("academic_advising.language")
row << t("academic_advising.academic_advising_category")
row << t("academic_advising.url")
row << t("academic_advising.keywords")
row << t("academic_advising.note")
sheet.add_row row, :style => heading
data.each do |hon|
row = [hon.member_profile.name]
@site_in_use_locales.each do |locale|
row << hon.award_name_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << hon.awarding_unit_translations[locale.to_s]
end
row << hon.year
row << hon.language
row << hon.academic_advising_type.title rescue ""
row << hon.url
row << hon.keywords
row << hon.note
sheet.add_row row
end
end
end