39 lines
965 B
Plaintext
39 lines
965 B
Plaintext
|
# encoding: utf-8
|
||
|
|
||
|
wb = xlsx_package.workbook
|
||
|
|
||
|
wb.add_worksheet(name: "Subscribe") do |sheet|
|
||
|
|
||
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
||
|
body = sheet.styles.add_style(:font_name => '微軟正黑體')
|
||
|
row = []
|
||
|
row << t('email')
|
||
|
row << t('language')
|
||
|
|
||
|
sheet.add_row row, :style => heading
|
||
|
|
||
|
@subscribers.each do |subscriber|
|
||
|
row = []
|
||
|
row << subscriber.email
|
||
|
row << subscriber.language
|
||
|
sheet.add_row row, :style => body, :types => [:string,:string]
|
||
|
end
|
||
|
end
|
||
|
|
||
|
wb.add_worksheet(name: "Unsubscribe") do |sheet|
|
||
|
|
||
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
||
|
body = sheet.styles.add_style(:font_name => '微軟正黑體')
|
||
|
row = []
|
||
|
row << t('email')
|
||
|
row << t('language')
|
||
|
|
||
|
sheet.add_row row, :style => heading
|
||
|
|
||
|
@unsubscribers.each do |subscriber|
|
||
|
row = []
|
||
|
row << subscriber.email
|
||
|
row << subscriber.language
|
||
|
sheet.add_row row, :style => body, :types => [:string,:string]
|
||
|
end
|
||
|
end
|