# 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 << "" row << t("personal_writing.lab_title") + " - " + t("en") row1 << "textfield" row2 << "" row << t("personal_writing.lab_title") + " - " + t("zh_tw") row1 << "textfield" row2 << "" row << t("personal_writing.location") + " - " + t("en") row1 << "textfield" row2 << "" row << t("personal_writing.location") + " - " + t("zh_tw") row1 << "textfield" row2 << "" row << t("personal_writing.participating_professor") + " - " + t("en") row1 << "textfield" row2 << "" row << t("personal_writing.participating_professor") + " - " + t("zh_tw") row1 << "textfield" row2 << "" row << t("personal_writing.participating_student") + " - " + t("en") row1 << "textfield" row2 << "" row << t("personal_writing.participating_student") + " - " + t("zh_tw") row1 << "textfield" row2 << "" row << t("personal_writing.year") row1 << "number" row2 << "Example : 2015 or 2014 or 1987" row << t("personal_writing.extension_no") row1 << "textfield" row2 << "" row << t("personal_writing.research_direction") row1 << "textfield" row2 << "" row << t("personal_writing.facility") row1 << "textfield" row2 << "" row << t("personal_writing.url") row1 << "textfield" row2 << "http://domain.com/path" row << t("personal_writing.keywords") row1 << "textfield" row2 << "Example: keyword1,keyword2" row << t("personal_writing.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