personal-activity/app/views/admin/activities/download_excel_format.xlsx....

65 lines
1.5 KiB
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "Activities") do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
example = sheet.styles.add_style(:i => true)
row = ["user_id"]
row1 = [""]
row2 = [""]
row << "name"
row1 << ""
row2 << ""
row << t("personal_activity.activity_name") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_activity.activity_name") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_activity.activity_organizer") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_activity.activity_organizer") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_activity.activity_area") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_activity.activity_area") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_activity.year")
row1 << "number"
row2 << "Example : 2015 or 2014 or 1987"
row << t("personal_activity.activity_start_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_activity.activity_end_date")
row1 << "date"
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
row << t("personal_activity.note")
row1 << "textarea"
row2 << ""
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
User.where(:user_name.ne => "rulingcom").each do |user|
r = [user.user_name]
r << user.name
sheet.add_row r
end
end