54 lines
1.7 KiB
Plaintext
54 lines
1.7 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 = [t("personal_honor.member_profile")]
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_honor.award_name") + " - " + t(locale.to_s)
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_honor.country") + " - " + t(locale.to_s)
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_honor.ranking") + " - " + t(locale.to_s)
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_honor.awarding_body") + " - " + t(locale.to_s)
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_honor.awarding_unit") + " - " + t(locale.to_s)
|
|
end
|
|
row << t("personal_honor.year")
|
|
row << t("personal_honor.award_date")
|
|
row << t("personal_honor.honor_type.title")
|
|
sheet.add_row row, :style => heading
|
|
|
|
data.each do |honor|
|
|
row = [(honor.member_profile.name rescue "")]
|
|
@site_in_use_locales.each do |locale|
|
|
row << honor.award_name_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << honor.country_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << honor.ranking_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << honor.awarding_body_translations[locale.to_s]
|
|
end
|
|
@site_in_use_locales.each do |locale|
|
|
row << honor.awarding_unit_translations[locale.to_s]
|
|
end
|
|
row << honor.display_field("year",true)
|
|
row << honor.display_field("award_date",true)
|
|
row << (honor.honor_type.title rescue "")
|
|
sheet.add_row row
|
|
end
|
|
end
|
|
end |