personal_writing/app/views/admin/writings/excel_format.xlsx.axlsx

55 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-03-19 09:13:01 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "Writing") 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 << ""
2020-03-19 15:39:28 +00:00
row << t("personal_writing.writing_title") + " - " + t("en")
2020-03-19 09:13:01 +00:00
row1 << "textfield"
row2 << ""
2020-03-19 15:39:28 +00:00
row << t("personal_writing.writing_title") + " - " + t("zh_tw")
2020-03-19 09:13:01 +00:00
row1 << "textfield"
row2 << ""
2020-03-19 15:39:28 +00:00
row << t("personal_writing.other") + " - " + t("en")
2020-03-19 09:13:01 +00:00
row1 << "textfield"
row2 << ""
2020-03-19 15:39:28 +00:00
row << t("personal_writing.other") + " - " + t("zh_tw")
2020-03-19 09:13:01 +00:00
row1 << "textfield"
row2 << ""
row << t("personal_writing.year")
row1 << "number"
row2 << "Example : 2015 or 2014 or 1987"
2020-03-19 15:39:28 +00:00
row << t("personal_writing.month")
row1 << "number"
row2 << "Example : 1 or 2 or 12"
2020-03-19 09:13:01 +00:00
row << t("personal_writing.url")
row1 << "textfield"
row2 << "http://domain.com/path"
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