personal-diploma/app/views/admin/diplomas/excel_format.xlsx.axlsx

83 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-12-14 10:25:43 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "Journal Paper") 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_diploma.school_name") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.school_name") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.country") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.country") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.department") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.department") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.degree") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.degree") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("personal_diploma.start_date")
row1 << "date"
row2 << "Format: YYYY/MM, Example: 2013/12"
row << t("personal_diploma.end_date")
row1 << "date"
row2 << "Format: YYYY/MM, Example: 2015/12"
row << t("personal_diploma.language")
row1 << "select"
row2 << "en -> English, zh_tw -> Chinese"
row << t("personal_diploma.url")
row1 << "textfield"
row2 << "http://domain.com/path"
row << t("personal_diploma.keywords")
row1 << "textfield"
row2 << "Example: keyword1,keyword2"
row << t("personal_diploma.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