gallery/app/views/admin/galleries/excel_format.xlsx.axlsx

28 lines
726 B
Plaintext
Raw Normal View History

2016-12-20 11:43:54 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: @album.name[0..100]) do |sheet|
sheet.merge_cells "A1:C1"
heading = sheet.styles.add_style(:b => true, :locked => true, :alignment=>{:horizontal => :center})
example = sheet.styles.add_style(:i => true)
row = []
row1 = []
row2 = []
row << "Import for album #{@album.name}"
row1 << t("gallery.img_link")
row2 << "http://www.example.com/example.jpg"
row1 << t("gallery.img_description") + "(" + t(:zh_tw) + ")"
row2 << "This is an image"
row1 << t("gallery.img_description") + "(" + t(:en) + ")"
row2 << "This is an image"
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
end