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:
BOHUNG 2020-02-18 21:37:10 +08:00
parent 9ec22c3487
commit c73e76a2e7
2 changed files with 6 additions and 6 deletions

View File

@ -14,14 +14,14 @@ wb.add_worksheet(name: "school_class") do |sheet|
@OlympiaSchoolDataFields.each do |school_data_field|
temp_row = []
@fields.each do |field_key|
temp_row << (school_data_field[field_key] rescue '')
temp_row << (school_data_field[field_key].to_s rescue '')
end
export_data_rows << temp_row
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|
sheet.add_row infos_row , :style=> column
sheet.add_row infos_row , :style=> column , :types => :string
end
end

View File

@ -14,14 +14,14 @@ wb.add_worksheet(name: "school_class") do |sheet|
@OlympiaSchoolDataFields.each do |school_data_field|
temp_row = []
@fields.each do |field_key|
temp_row << (school_data_field[field_key] rescue '')
temp_row << (school_data_field[field_key].to_s rescue '')
end
export_data_rows << temp_row
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|
sheet.add_row infos_row , :style=> column
sheet.add_row infos_row , :style=> column , :types => :string
end
end