Commit 690b3080 by liyijie

TalltyImportExport import set headers when on initialize

parent 60cff25d
...@@ -64,9 +64,9 @@ module TalltyImportExport ...@@ -64,9 +64,9 @@ module TalltyImportExport
# excel导出样式 # excel导出样式
alignment = { vertical: :center, horizontal: :center } alignment = { vertical: :center, horizontal: :center }
border = { color: '969696', style: :thin } border = { color: '969696', style: :thin }
title1 = workbook.styles.add_style(alignment: alignment, border: border, sz: 16, b: true) title1 = workbook.styles.add_style(alignment: alignment, border: border, sz: 12, b: true)
title2 = workbook.styles.add_style(alignment: alignment, border: border, bg_color: "2a5caa", sz: 16, fg_color: "fffffb") title2 = workbook.styles.add_style(alignment: alignment, border: border, bg_color: "2a5caa", sz: 12, fg_color: "fffffb")
title3 = workbook.styles.add_style(alignment: alignment.merge(wrap_text: true), border: border, sz: 14) title3 = workbook.styles.add_style(alignment: alignment.merge(wrap_text: true), border: border, sz: 10)
headers = export_headers headers = export_headers
_sheet_name = respond_to?(:sheet_name) ? self.sheet_name : nil _sheet_name = respond_to?(:sheet_name) ? self.sheet_name : nil
...@@ -94,7 +94,7 @@ module TalltyImportExport ...@@ -94,7 +94,7 @@ module TalltyImportExport
options = options.with_indifferent_access options = options.with_indifferent_access
@row_height ||= options.delete(:row_height) || 35 @row_height ||= options.delete(:row_height) || 35
@width ||= options.delete(:width) || 30 @width ||= options.delete(:width) || 20
@filename ||= options.delete(:filename) @filename ||= options.delete(:filename)
@group_by ||= options.delete(:group_by) @group_by ||= options.delete(:group_by)
@group_where = "#{@group_by}_eq" if @group_by.present? @group_where = "#{@group_by}_eq" if @group_by.present?
......
...@@ -5,6 +5,7 @@ module TalltyImportExport ...@@ -5,6 +5,7 @@ module TalltyImportExport
def initialize klass def initialize klass
@klass = klass @klass = klass
@headers = import_headers.map { |header| header.with_indifferent_access }
@context = Context.new({}) @context = Context.new({})
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment