personal-technology-transfer/app/views/admin/technology_transfers/download_excel.xlsx.axlsx

43 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("personal_technology_transfer.title") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_technology_transfer.patent_title") + " - " + t(locale.to_s)
end
row << t("personal_technology_transfer.technology_transfer_category")
row << t("personal_technology_transfer.year")
row << t("personal_technology_transfer.patent_granted")
row << t("personal_technology_transfer.patent_number")
sheet.add_row row, :style => heading
data.each do |tt|
row = [tt.member_profile.name]
@site_in_use_locales.each do |locale|
row << tt.patent_title_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << tt.title_translations[locale.to_s]
end
row << tt.technology_transfer_category.title rescue ""
row << tt.year
row << tt.patent_granted ? t("personal_technology_transfer.y_es") : t("personal_technology_transfer.n_o")
row << tt.patent_number
sheet.add_row row
end
end
end