修改xlsx的样式

dev_forum
SylorHuang 6 years ago
parent 0b529f7d39
commit fa86d4477e

@ -14,7 +14,7 @@ wb.styles do |s|
group_info_d = course_group_info[0] group_info_d = course_group_info[0]
group_info_detail = course_group_info[1] group_info_detail = course_group_info[1]
course_main_info.each do |c| course_main_info.each do |c|
sheet.add_row c, :style => sz_all #用户id sheet.add_row c, :height => 20, :style => sz_all #用户id
end end
sheet["A1:A7"].each { |c| c.style = row_cell } sheet["A1:A7"].each { |c| c.style = row_cell }
sheet.add_row [],:style => sz_all sheet.add_row [],:style => sz_all
@ -32,12 +32,12 @@ wb.styles do |s|
sheet.sheet_view.show_grid_lines = false sheet.sheet_view.show_grid_lines = false
sheet_title = activity_level[1] sheet_title = activity_level[1]
sheet_content = activity_level[2] sheet_content = activity_level[2]
sheet.add_row sheet_title, :style => blue_cell sheet.add_row sheet_title, :height => 20,:style => blue_cell
if sheet_content.count > 0 if sheet_content.count > 0
sheet_content.each_with_index do |c,index| sheet_content.each_with_index do |c,index|
c_1 = (index+1) c_1 = (index+1)
c_2 = [c_1] + c.values c_2 = [c_1] + c.values
sheet.add_row c_2, :style => sz_all #用户id sheet.add_row c_2, :height => 20, :style => sz_all #用户id
end end
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
sheet.column_info.first.width = 8 sheet.column_info.first.width = 8
@ -82,7 +82,7 @@ wb.styles do |s|
sheet_content.each_with_index do |c,index| sheet_content.each_with_index do |c,index|
c_1 = (index+1) c_1 = (index+1)
c_2 = [c_1] + c c_2 = [c_1] + c
sheet.add_row c_2, :style => sz_all #用户id sheet.add_row c_2, :height => 20,:style => sz_all #用户id
end end
end end
sheet.column_widths *([15]*sheet.column_info.count) sheet.column_widths *([15]*sheet.column_info.count)
@ -100,7 +100,7 @@ wb.styles do |s|
sheet.add_row head_title, :style => blue_cell sheet.add_row head_title, :style => blue_cell
if content_shixun.count > 0 if content_shixun.count > 0
content_shixun.each do |user| content_shixun.each do |user|
sheet.add_row user, :style => sz_all sheet.add_row user, :height => 20,:style => sz_all
end #each_widh_index end #each_widh_index
end end
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
@ -119,7 +119,7 @@ wb.styles do |s|
sheet.add_row head_title, :style => blue_cell sheet.add_row head_title, :style => blue_cell
if content_.count > 0 if content_.count > 0
content_.each do |user| content_.each do |user|
sheet.add_row user, :style => no_wrap_sz sheet.add_row user, :height => 20,:style => no_wrap_sz
end #each_widh_index end #each_widh_index
end end
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
@ -138,7 +138,7 @@ wb.styles do |s|
sheet.add_row head_title, :style => blue_cell sheet.add_row head_title, :style => blue_cell
if content_.count > 0 if content_.count > 0
content_.each do |user| content_.each do |user|
sheet.add_row user, :style => sz_all sheet.add_row user, :height => 20,:style => sz_all
end #each_widh_index end #each_widh_index
end end
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
@ -155,7 +155,7 @@ wb.styles do |s|
content_ = task[2] content_ = task[2]
sheet.add_row task[1], :style => blue_cell sheet.add_row task[1], :style => blue_cell
content_.each do |user| content_.each do |user|
sheet.add_row user, :style => sz_all sheet.add_row user, :height => 20,:style => sz_all
end #each_widh_index end #each_widh_index
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
sheet.column_info.first.width = 12 sheet.column_info.first.width = 12
@ -171,7 +171,7 @@ wb.styles do |s|
content_ = ex[2] content_ = ex[2]
sheet.add_row ex[1], :style => blue_cell sheet.add_row ex[1], :style => blue_cell
content_.each do |user| content_.each do |user|
sheet.add_row user, :style => sz_all #用户id sheet.add_row user, :height => 20,:style => sz_all #用户id
end #each_widh_index end #each_widh_index
sheet.column_widths *([20]*sheet.column_info.count) sheet.column_widths *([20]*sheet.column_info.count)
sheet.column_info.first.width = 12 sheet.column_info.first.width = 12

@ -8,7 +8,7 @@ wb.styles do |s|
sheet.add_row table_columns,:height =>20, :style => blue_cell sheet.add_row table_columns,:height =>20, :style => blue_cell
sheet.column_info.first.width = 12 sheet.column_info.first.width = 12
task_users.each do |user| task_users.each do |user|
sheet.add_row user, :style => sz_all sheet.add_row user, :height =>20, :style => sz_all
end #each_widh_index end #each_widh_index
sheet.column_widths *([25]*sheet.column_info.count) sheet.column_widths *([25]*sheet.column_info.count)
sheet.column_info.first.width = 12 sheet.column_info.first.width = 12

Loading…
Cancel
Save