# 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("personal_honor.award_name") + " - " + 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.language") row << t("personal_honor.honor_category") row << t("personal_honor.url") row << t("personal_honor.keywords") row << t("personal_honor.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.honor_type.title rescue "" row << hon.url row << hon.keywords row << hon.note sheet.add_row row end end end