personal_other_paper/app/views/admin/other_papers/download_excel.xlsx.axlsx

50 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_other_paper.member_profile")]
@site_in_use_locales.each do |locale|
row << t("personal_other_paper.title") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_other_paper.newsletter") + " - " + t(locale.to_s)
end
@site_in_use_locales.each do |locale|
row << t("personal_other_paper.authors") + " - " + t(locale.to_s)
end
row << t("personal_other_paper.issue_date")
row << t("personal_other_paper.vol_no")
row << t("personal_other_paper.isbn")
row << t("personal_other_paper.url")
row << t("personal_other_paper.keywords")
row << t("personal_other_paper.note")
row << t("personal_other_paper.other_paper_status.status")
sheet.add_row row, :style => heading
data.each do |other_paper|
row = [(other_paper.member_profile.name rescue "")]
@site_in_use_locales.each do |locale|
row << other_paper.title_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << other_paper.newsletter_translations[locale.to_s]
end
@site_in_use_locales.each do |locale|
row << other_paper.authors_translations[locale.to_s]
end
row << other_paper.display_field("issue_date",true)
row << other_paper.display_field("vol_no",true)
row << other_paper.display_field("isbn",true)
row << other_paper.display_field("url",true)
row << other_paper.display_field("keywords",true)
row << other_paper.display_field("note",true)
row << (other_paper.other_paper_status.status rescue "")
sheet.add_row row
end
end
end