fix the school_code is auto changed to number and cause significant number zero is auto deleted and cause import error.
Add auto change cell's datatype to string.
This commit is contained in:
parent
9ec22c3487
commit
c73e76a2e7
|
@ -14,14 +14,14 @@ wb.add_worksheet(name: "school_class") do |sheet|
|
||||||
@OlympiaSchoolDataFields.each do |school_data_field|
|
@OlympiaSchoolDataFields.each do |school_data_field|
|
||||||
temp_row = []
|
temp_row = []
|
||||||
@fields.each do |field_key|
|
@fields.each do |field_key|
|
||||||
temp_row << (school_data_field[field_key] rescue '')
|
temp_row << (school_data_field[field_key].to_s rescue '')
|
||||||
end
|
end
|
||||||
export_data_rows << temp_row
|
export_data_rows << temp_row
|
||||||
end
|
end
|
||||||
|
|
||||||
#export data end
|
#export data end
|
||||||
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round}
|
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round} , :types => :string
|
||||||
export_data_rows.each do |infos_row|
|
export_data_rows.each do |infos_row|
|
||||||
sheet.add_row infos_row , :style=> column
|
sheet.add_row infos_row , :style=> column , :types => :string
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -14,14 +14,14 @@ wb.add_worksheet(name: "school_class") do |sheet|
|
||||||
@OlympiaSchoolDataFields.each do |school_data_field|
|
@OlympiaSchoolDataFields.each do |school_data_field|
|
||||||
temp_row = []
|
temp_row = []
|
||||||
@fields.each do |field_key|
|
@fields.each do |field_key|
|
||||||
temp_row << (school_data_field[field_key] rescue '')
|
temp_row << (school_data_field[field_key].to_s rescue '')
|
||||||
end
|
end
|
||||||
export_data_rows << temp_row
|
export_data_rows << temp_row
|
||||||
end
|
end
|
||||||
|
|
||||||
#export data end
|
#export data end
|
||||||
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round}
|
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round} , :types => :string
|
||||||
export_data_rows.each do |infos_row|
|
export_data_rows.each do |infos_row|
|
||||||
sheet.add_row infos_row , :style=> column
|
sheet.add_row infos_row , :style=> column , :types => :string
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue