Application_Form/app/views/admin/seminars/export.xlsx.axlsx

55 lines
1.1 KiB
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: @seminar.title) do |sheet|
row = [t('seminar_signup.signup_time')]
row << t('seminar_signup.name')
row << t('seminar_signup.unit')
row << t('seminar_signup.tel')
row << t('seminar_signup.phone')
row << t('seminar_signup.fax')
row << t('seminar_signup.address')
row << t(:email)
row << t('seminar_signup.note')
@seminar.seminar_signup_fields.asc(:_id).each do |rf|
row << rf.title
end
sheet.add_row row
@seminar.seminar_signups.each do |signup|
row2 = []
row2 << "#{signup.created_at} "
row2 << "#{signup[:name]} "
row2 << "#{signup.unit} "
row2 << "#{signup[:tel]} "
row2 << "#{signup[:phone]} "
row2 << "#{signup[:fax]} "
row2 << "#{signup.address} "
row2 << "#{signup[:email]} "
row2 << "#{signup.note} "
@seminar.seminar_signup_fields.asc(:_id).each do |rf|
row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' '
end
sheet.add_row row2
end
end